/* Final cascade layer: Saga Member V3 — Contemporary Coffee Club */
:root {
  --v3-ink: #1d1714;
  --v3-espresso: #33231d;
  --v3-brown: #5b3b30;
  --v3-caramel: #c86f3d;
  --v3-apricot: #f2ba83;
  --v3-sage: #a8bd83;
  --v3-lime: #c9e79e;
  --v3-paper: #f7f3ed;
  --v3-cloud: #e9e5df;
  --v3-card: #fffdf9;
}

html { background: #d7d2cc; }

body {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
  background: var(--v3-paper);
  background-image: none;
}

body::before { background: none; opacity: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  min-height: calc(62px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  border-bottom: 0;
  background: rgb(247 243 237 / 96%);
  box-shadow: none;
}

.brand { display: flex; align-items: baseline; gap: 4px; color: var(--v3-ink); font-size: 0.83rem; }
.brand b { color: #743417; font-weight: 800; }
.brand span { margin-left: 3px; color: #47413d; font-size: 0.58rem; font-weight: 750; }

#runtime-scope {
  padding: 5px 8px;
  border-radius: 999px;
  background: #ded9d2;
  color: #423c38;
  font-size: 0.58rem;
}

.topbar .icon-button { min-width: 44px; min-height: 44px; border-color: rgb(29 23 20 / 10%); background: var(--v3-card); box-shadow: none; }
.scale-context { width: max-content; max-width: calc(100% - 28px); margin: 8px 14px 0; }
main { min-height: calc(100dvh - 150px); padding: 12px 14px 36px; }

.member-view { display: grid; gap: 20px; animation: v3-member-enter 180ms ease-out both; }

@keyframes v3-member-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.member-view h1, .member-view h2, .member-view h3 { text-wrap: balance; }
.member-view p, .member-view small { text-wrap: pretty; }
.member-view h1 { font-size: clamp(1.75rem, 8vw, 2.1rem); font-weight: 780; }
.member-view h2 { font-size: 1.18rem; font-weight: 730; }
.member-view p { color: #514a45; font-size: 0.88rem; line-height: 1.55; }
.eyebrow { margin-bottom: 4px; color: inherit; font-size: 0.68rem; font-weight: 750; text-transform: none; }

.editorial-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: stretch;
  min-height: 238px;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  box-shadow: 0 1px 0 rgb(29 23 20 / 7%), 0 14px 28px rgb(29 23 20 / 7%);
  isolation: isolate;
}

.editorial-hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: end;
  width: auto;
  margin: 0;
  padding: 20px 4px 20px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.editorial-hero-copy h1 { max-width: 12ch; margin: 4px 0 8px; font-size: clamp(1.8rem, 8.2vw, 2.2rem); line-height: 1.02; }
.editorial-hero-copy > p:not(.eyebrow) { max-width: 28ch; color: inherit; font-size: 0.78rem; opacity: 0.82; }
.member-view .editorial-hero-copy .eyebrow { color: currentColor; opacity: 1; }
.editorial-hero-home { color: #18311f; background: linear-gradient(145deg, #e4efd7, var(--v3-lime)); }
.editorial-hero-explore { color: #1f2e22; background: linear-gradient(145deg, #e7efe1, var(--v3-sage)); }
.editorial-hero-pass { color: #fffaf4; background: linear-gradient(145deg, var(--v3-espresso), #684231); }
.editorial-hero-rewards, .editorial-hero-quest { color: #3b2317; background: linear-gradient(145deg, #ffe0bd, var(--v3-apricot)); }
.editorial-hero-profile { color: #fffaf4; background: linear-gradient(145deg, #25211f, #534a43); }
.editorial-hero-pass h1, .editorial-hero-profile h1 { color: #fffaf4; }
.editorial-hero-pass .editorial-hero-copy > p, .editorial-hero-profile .editorial-hero-copy > p { color: #fffaf4; }

.hero-object { position: relative; min-width: 112px; overflow: hidden; }
.hero-object-orbit { position: absolute; top: 42px; right: -30px; width: 142px; height: 142px; border: 1px solid currentColor; border-radius: 50%; opacity: 0.22; }
.hero-object-mark { position: absolute; top: 78px; right: 26px; display: grid; width: 70px; height: 70px; place-items: center; border: 1px solid rgb(255 255 255 / 32%); border-radius: 24px; background: rgb(255 253 249 / 58%); color: inherit; transform: rotate(8deg); }
.editorial-hero-pass .hero-object-mark, .editorial-hero-profile .hero-object-mark { background: rgb(255 255 255 / 10%); }
.hero-object i { position: absolute; width: 9px; height: 9px; border-radius: 3px; background: currentColor; opacity: 0.4; }
.hero-object i:nth-of-type(1) { top: 42px; right: 38px; transform: rotate(12deg); }
.hero-object i:nth-of-type(2) { top: 170px; right: 22px; }
.hero-object i:nth-of-type(3) { top: 152px; right: 102px; transform: rotate(45deg); }

.hero-metrics { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.hero-metrics > div { display: grid; min-width: 54px; }
.hero-metrics strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hero-metrics span:not(.tier-chip) { color: inherit; font-size: 0.68rem; opacity: 0.75; }
.tier-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 0; border-radius: 999px; background: rgb(255 253 249 / 68%); font-size: 0.64rem; font-weight: 760; }
.hero-balance-inline { display: flex; align-items: baseline; gap: 7px; margin-top: 12px; }
.hero-balance-inline strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.hero-balance-inline span { font-size: 0.68rem; font-weight: 650; }
.profile-avatar { display: grid; width: 34px; height: 34px; margin-top: 13px; place-items: center; border: 1px solid rgb(255 255 255 / 20%); border-radius: 50%; background: rgb(255 255 255 / 12%); color: #fff; font-weight: 780; }

.freshness-row { display: flex; align-items: center; justify-content: space-between; margin: -8px 2px 0; }
.freshness-label { color: #4d4641; font-size: 0.66rem; font-weight: 700; }
.pill { min-height: 26px; border-color: rgb(29 23 20 / 9%); font-size: 0.63rem; }
.content-section { display: grid; gap: 11px; }
.editorial-section-heading { align-items: center; margin: 0 2px; }
.editorial-section-heading .eyebrow, .editorial-card > .eyebrow { color: #6f3015; }
.editorial-section-heading h2 { margin: 0; font-size: 1.16rem; }

.destination-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.destination-card { display: grid; grid-template-columns: 1fr; justify-items: center; min-height: 92px; gap: 6px; padding: 9px 4px; border: 1px solid rgb(29 23 20 / 8%); border-radius: 18px; background: var(--v3-card); color: var(--v3-ink); text-align: center; box-shadow: none; transition: transform 120ms ease-out, opacity 120ms ease-out; }
.destination-card:active, .button:active, .settings-row:active, .tenant-card:active, .reward-card:active { transform: scale(0.98); }
.destination-card > .feather-icon:first-child { padding: 8px; box-sizing: content-box; border-radius: 14px; background: #f1e6da; color: var(--v3-brown); }
.destination-card > .feather-icon:last-child, .destination-card small { display: none; }
.destination-card strong { font-size: 0.68rem; }

.progress-card, .editorial-card, .tenant-card, .quest-card, .reward-card, .owned-reward, .inbox-item, .quest-detail, .settings-row { border-color: rgb(29 23 20 / 8%); border-radius: 20px; background: var(--v3-card); box-shadow: none; }
.progress-card, .editorial-card, .quest-detail { padding: 16px; }
.progress { height: 8px; background: #e9e4de; }
.progress span { background: var(--v3-caramel); }
.member-view-rewards .progress span, .member-view-quest .progress span { background: #536f3c; }
.home-context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-context-grid .editorial-card { min-width: 0; }
.home-context-grid .editorial-card h2 { font-size: 1rem; }
.home-context-grid .editorial-card p { font-size: 0.72rem; }

.discovery-tools { display: grid; gap: 10px; }
.search-field { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid rgb(29 23 20 / 9%); border-radius: 17px; background: var(--v3-card); }
.search-field input { min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; color: var(--v3-ink); font-size: 0.82rem; }
.filter-rail { display: flex; gap: 7px; margin: 0; padding: 0 1px 2px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; }
.filter-rail::-webkit-scrollbar { display: none; }
.filter-chip { min-height: 44px; padding: 8px 14px; flex: 0 0 auto; border: 1px solid rgb(29 23 20 / 10%); border-radius: 999px; background: var(--v3-card); color: var(--v3-ink); font-size: 0.72rem; font-weight: 670; scroll-snap-align: start; transition: transform 120ms ease-out, opacity 120ms ease-out; }
.filter-chip[aria-pressed="true"] { border-color: var(--v3-ink); background: var(--v3-ink); color: #fff; }

.tenant-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); min-height: 202px; overflow: hidden; background: var(--v3-card); }
.tenant-card-compact { min-height: 176px; }
.object-art { position: relative; display: grid; min-height: 176px; place-items: center; overflow: hidden; background: #eee7df; color: var(--v3-ink); isolation: isolate; }
.object-art-coffee { background: linear-gradient(150deg, #f6ca9c, #d97d48); }
.object-art-studio { background: linear-gradient(150deg, #dce9d0, #9bb27c); }
.object-art-quest { background: linear-gradient(150deg, #f6e49b, #f0bd53); }
.object-art-scan { background: linear-gradient(150deg, #d9cabf, #a88875); }
.object-art-reward { background: linear-gradient(150deg, #dff1c6, #a5c976); }
.object-art-kicker { position: absolute; top: 12px; left: 12px; max-width: 12ch; font-size: 0.58rem; font-weight: 720; }
.object-art-icon { position: relative; z-index: 2; display: grid; width: 72px; height: 72px; place-items: center; border: 1px solid rgb(255 255 255 / 50%); border-radius: 25px; background: rgb(255 253 249 / 68%); transform: rotate(-6deg); }
.object-art-shadow { position: absolute; right: 20%; bottom: 23%; width: 64px; height: 14px; border-radius: 50%; background: rgb(29 23 20 / 18%); transform: rotate(-8deg); }
.object-art i { position: absolute; width: 30px; height: 30px; border: 1px solid currentColor; border-radius: 50%; opacity: 0.22; }
.object-art i:nth-of-type(1) { top: 25%; right: -8px; }
.object-art i:nth-of-type(2) { bottom: -12px; left: 16%; width: 54px; height: 54px; }

.tenant-copy { display: grid; align-content: center; padding: 15px; }
.tenant-copy h2 { margin: 7px 0 4px; }
.tenant-copy p { margin: 0 0 12px; font-size: 0.72rem; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.card-meta > span:last-child { color: #4e4843; font-size: 0.58rem; font-weight: 700; }

.wide-story-card { display: grid; grid-template-columns: 44% minmax(0, 1fr); min-height: 164px; overflow: hidden; border-radius: 22px; background: var(--v3-ink); color: white; }
.wide-story-card > div:last-child { align-self: center; padding: 14px; background: var(--v3-ink); }
.wide-story-card h2 { color: white; }
.wide-story-card p:not(.eyebrow) { color: #e7ddd4; }
.wide-story-card .eyebrow { color: #f0cba8; }
.wide-story-visual { position: relative; display: grid; grid-template-columns: repeat(2, 50px); place-content: center; gap: 8px; background: #c9df9e; color: var(--v3-ink); }
.wide-story-visual span { display: grid; width: 50px; height: 50px; place-items: center; border: 1px solid rgb(29 23 20 / 14%); border-radius: 17px; background: rgb(255 253 249 / 58%); }
.wide-story-visual span:last-child { grid-column: 1 / -1; justify-self: center; }

.member-pass-card { position: relative; min-height: 250px; padding: 20px; overflow: hidden; border: 0; border-radius: 28px; color: white; background: linear-gradient(145deg, #211916, #57372b 62%, #8a573b); box-shadow: 0 18px 32px rgb(29 23 20 / 18%); }
.cacao-surface { background-image: linear-gradient(145deg, #211916, #57372b 62%, #8a573b); }
.cacao-surface::before { position: absolute; inset: 0; background-image: radial-gradient(circle at 82% 22%, rgb(255 229 184 / 22%) 0 1px, transparent 1.5px); background-size: 13px 13px; content: ""; opacity: 0.42; }
.member-pass-card > * { position: relative; }
.member-pass-card h2, .member-pass-card strong { color: #fffaf4; }
.member-pass-card .pass-identity p, .member-pass-card .pass-disclosure, .member-pass-card .pass-balances span { color: #f0d9c8; }
.member-pass-card .masked-code { color: #fffaf4; }
.pass-spark { position: absolute; top: 72px; right: 34px; width: 26px; height: 26px; border: 1px solid rgb(255 255 255 / 28%); transform: rotate(45deg); }
.pass-identity { margin-top: 42px; }
.instruction-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); align-items: center; overflow: hidden; border-radius: 22px; background: var(--v3-card); }
.instruction-card .object-art { min-height: 230px; }
.instruction-card > div:last-child { padding: 14px; }

.reward-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.reward-card { min-width: 0; overflow: hidden; }
.reward-card.featured { display: grid; grid-template-columns: 45% minmax(0, 1fr); grid-column: 1 / -1; }
.reward-card.featured .object-art { min-height: 238px; }
.reward-monogram { display: grid; aspect-ratio: 16 / 10; place-items: center; background: #e8f1d9; }
.reward-copy { display: grid; align-content: start; height: 100%; padding: 13px; }
.reward-copy h3 { margin: 7px 0 4px; font-size: 0.92rem; }
.reward-copy p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 0.68rem; }
.reward-action { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: auto; }
.profile-summary { margin-top: -6px; }
.profile-summary .eyebrow { color: #4d4641; opacity: 1; }
.settings-row { background: var(--v3-card); }
.settings-row > .feather-icon:first-child { padding: 7px; box-sizing: content-box; border-radius: 12px; background: #ece7e2; }

.button { min-height: 44px; border-radius: 14px; background: var(--v3-ink); transition: transform 120ms ease-out, opacity 120ms ease-out; }
.button.secondary { border-color: rgb(29 23 20 / 13%); background: var(--v3-card); color: var(--v3-ink); }
.text-action { min-height: 44px; color: #65301b; }

.bottom-nav {
  position: fixed;
  top: auto;
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
  z-index: var(--z-nav);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: auto;
  max-width: 406px;
  margin: 0 auto;
  padding: 7px;
  border: 0;
  border-radius: 25px;
  background: rgb(29 23 20 / 96%);
  box-shadow: 0 16px 32px rgb(29 23 20 / 24%);
}

.bottom-nav button { display: grid; grid-template-columns: 1fr; place-items: center; min-height: 58px; padding: 0; border: 0; border-radius: 18px; background: transparent; color: #f3eee9; font-size: 0.68rem; transition: transform 120ms ease-out, opacity 120ms ease-out; }
.bottom-nav button[aria-current="page"] { background: #f5dfbf; color: var(--v3-ink); }
.bottom-nav button[aria-current="page"] .feather-icon { transform: translateY(-2px); }
.bottom-nav .pass-destination, .bottom-nav .pass-destination .feather-icon { color: #fff; background: transparent; }
.bottom-nav .pass-destination[aria-current="page"], .bottom-nav .pass-destination[aria-current="page"] .feather-icon { color: var(--v3-ink); }
.secondary-intro { border-radius: 22px; }
[data-filter-item][hidden] { display: none !important; }

@media (max-width: 350px) {
  .editorial-hero { grid-template-columns: minmax(0, 1fr) 94px; min-height: 224px; }
  .editorial-hero-copy { padding-left: 16px; }
  .destination-grid { gap: 5px; }
  .destination-card strong { font-size: 0.62rem; }
  .tenant-card, .reward-card.featured { grid-template-columns: 40% minmax(0, 1fr); }
}

@media (min-width: 700px) {
  body, .topbar, .scale-context, main { width: 430px; }
  .bottom-nav { right: calc((100vw - 406px) / 2); left: calc((100vw - 406px) / 2); width: 406px; }
}

@media (min-width: 960px) {
  .bottom-nav { right: calc((100vw - 406px) / 2); bottom: calc(10px + env(safe-area-inset-bottom)); left: calc((100vw - 406px) / 2); width: 406px; padding: 7px; border-radius: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .member-view { animation: none; }
  .destination-card, .button, .settings-row, .tenant-card, .reward-card, .filter-chip, .bottom-nav button { transition: none; }
}

@media (forced-colors: active) {
  .hero-object, .object-art, .wide-story-visual { display: none; }
  .editorial-hero { grid-template-columns: 1fr; }
}
