:root {
  --noir: #1F2617;
  --loden: #36402A;
  --sage: #7D8560;
  --gold: #BFA06A;
  --gold-hi: #D9C08E;
  --parch: #E9E1CE;
  --ivory: #F6F2E8;
  --hair: rgba(191, 160, 106, .28);
  --display: Cinzel, 'Times New Roman', serif;
  --text: 'Cormorant Garamond', Garamond, Georgia, serif;
  --ease: cubic-bezier(.22, .7, .12, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--noir); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--noir);
  color: var(--parch);
  font-family: var(--text);
  font-size: 18px;
  line-height: 1.5;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
p, h1, h2, ul { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--gold-hi); outline-offset: 4px; }

/* ---------- Backdrop: lattice + slow glow ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 45% at 50% 38%, rgba(74, 86, 60, .55), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg fill='none' stroke='%23BFA06A' stroke-width='.6' opacity='.5'%3E%3Cpath d='M0 0L64 64M64 0L0 64'/%3E%3C/g%3E%3Cg fill='%23BFA06A' opacity='.75'%3E%3Cpath d='M32 24.5l1.6 5.9 5.9 1.6-5.9 1.6-1.6 5.9-1.6-5.9-5.9-1.6 5.9-1.6z'/%3E%3Cpath d='M0 29v6l1-2 2-1-2-1zM64 29v6l-1-2-2-1 2-1zM29 0h6l-2 1-1 2-1-2zM29 64h6l-2-1-1-2-1 2z'/%3E%3Ccircle cx='32' cy='0' r='1'/%3E%3Ccircle cx='0' cy='32' r='1'/%3E%3Ccircle cx='64' cy='32' r='1'/%3E%3Ccircle cx='32' cy='64' r='1'/%3E%3C/g%3E%3C/svg%3E") center / 64px 64px,
    var(--noir);
  opacity: .9;
}
.backdrop::after {
  content: ""; position: absolute; inset: -20%;
  background: radial-gradient(40% 30% at 50% 50%, rgba(191, 160, 106, .08), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate(-8%, -6%); } to { transform: translate(8%, 10%); } }

/* ---------- Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-content: center; justify-items: center; gap: 0;
  background: radial-gradient(55% 40% at 50% 45%, #2E3824, var(--noir) 75%);
  transition: opacity .9s var(--ease), filter .9s var(--ease), transform 1.1s var(--ease), visibility 0s linear 1.1s;
}
.intro-mark { width: min(34vw, 150px); height: auto; overflow: visible; }
.intro-mark .stroke {
  fill: var(--gold); fill-opacity: 0;
  stroke: var(--gold); stroke-width: 1.1;
  stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200);
}
.intro-word {
  margin-top: 30px;
  font-family: var(--display); font-size: clamp(19px, 5.4vw, 26px);
  letter-spacing: .32em; margin-right: -.32em; color: var(--gold); white-space: nowrap;
}
.intro-word span { display: inline-block; opacity: 0; filter: blur(6px); transform: translateY(8px); }
.intro-rule { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.intro-rule span { width: 64px; height: 1px; background: var(--gold); transform: scaleX(0); }
.intro-rule span:first-child { transform-origin: right; }
.intro-rule span:last-child { transform-origin: left; }
.intro-rule i { width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg) scale(0); }
.intro-tag { margin-top: 12px; font-style: italic; font-size: clamp(19px, 5vw, 24px); color: var(--gold); opacity: 0; letter-spacing: .04em; }
.intro-skip {
  position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  font-family: var(--display); font-size: 11px; letter-spacing: .3em; color: var(--sage); opacity: 0;
  padding: 10px 16px; transition: opacity .6s .9s;
}
body.is-playing .intro-skip { opacity: .8; }

/* intro timeline, driven by body.is-playing */
body.is-playing .intro-mark .stroke { animation: draw 1.5s var(--ease) forwards, fill .7s ease 1.15s forwards; }
body.is-playing .intro-mark .p { animation-delay: .25s, 1.3s; }
body.is-playing .intro-word span { animation: letter .9s var(--ease) forwards; animation-delay: calc(1.25s + var(--n) * 45ms); }
body.is-playing .intro-rule span { animation: grow .9s var(--ease) 1.9s forwards; }
body.is-playing .intro-rule i { animation: pop .6s var(--ease) 1.8s forwards; }
body.is-playing .intro-tag { animation: fadeUp .9s var(--ease) 2.05s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fill { to { fill-opacity: 1; stroke-width: 0; } }
@keyframes letter { to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes grow { to { transform: scaleX(1); } }
@keyframes pop { to { transform: rotate(45deg) scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

body.is-leaving .intro { opacity: 0; filter: blur(10px); transform: scale(1.06) translateY(-2%); visibility: hidden; pointer-events: none; }
body.is-done .intro { display: none; }

/* ---------- Card ---------- */
.card {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  padding: 52px 28px 30px;
  display: grid; gap: 30px;
  background: linear-gradient(180deg, rgba(54, 64, 42, .92), rgba(41, 49, 32, .94));
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 7px rgba(41, 49, 32, .0), inset 0 0 0 8px var(--hair), 0 30px 80px -30px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.corner { position: absolute; width: 18px; height: 18px; background: var(--gold); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
.corner.tl { top: -9px; left: -9px; } .corner.tr { top: -9px; right: -9px; }
.corner.bl { bottom: -9px; left: -9px; } .corner.br { bottom: -9px; right: -9px; }

/* staged entrance */
.rise, .corner { opacity: 0; transform: translateY(16px); }
.corner { transform: scale(.2) rotate(-45deg); }
body.is-ready .rise { animation: rise .9s var(--ease) forwards; animation-delay: calc(.15s + var(--i) * 90ms); }
body.is-ready .corner { animation: star .9s var(--ease) .1s forwards; }
body.is-ready .card { animation: frame 1s var(--ease) both; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes star { to { opacity: 1; transform: none; } }
@keyframes frame { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
body.is-intro .card { opacity: 0; }

.brand { display: grid; justify-items: center; text-align: center; gap: 0; }
.brand-mark { width: 54px; height: auto; fill: var(--gold); }
.brand-word { margin-top: 16px; font-family: var(--display); font-size: 15px; letter-spacing: .34em; margin-right: -.34em; color: var(--gold); }
.brand-tag { margin-top: 4px; font-style: italic; font-size: 17px; color: var(--sage); }

.person { text-align: center; display: grid; justify-items: center; }
.person h1 { font-weight: 500; font-size: clamp(46px, 13vw, 58px); line-height: 1.05; color: var(--ivory); letter-spacing: .005em; }
.role { margin-top: 10px; font-family: var(--display); font-size: 13px; letter-spacing: .42em; margin-right: -.42em; color: var(--gold); text-transform: uppercase; }
.rule { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.rule span { width: 56px; height: 1px; background: var(--gold); opacity: .8; }
.rule i { width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); }

/* actions */
.actions { display: grid; }
.action {
  display: grid; grid-template-columns: 46px 1fr 14px; align-items: center; gap: 16px;
  padding: 16px 4px; border-top: 1px solid var(--hair); position: relative;
  overflow: hidden; /* keep the hover sheen inside the row */
  transition: background-color .4s var(--ease);
}
.action:last-child { border-bottom: 1px solid var(--hair); }
.action::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(191, 160, 106, .12), transparent);
  opacity: 0; transform: translateX(-100%);
  transition: transform .8s var(--ease), opacity .3s;
}
.action:hover::before, .action:focus-visible::before { opacity: 1; transform: translateX(100%); }
.ico { width: 46px; height: 46px; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-items: center; transition: background-color .4s var(--ease); }
.ico svg { width: 21px; height: 21px; fill: none; stroke: var(--gold); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; transition: stroke .4s; }
.ico svg .solid { fill: var(--gold); stroke: none; transition: fill .4s; }
.action:hover .ico, .action:active .ico { background: var(--gold); }
.action:hover .ico svg, .action:active .ico svg { stroke: var(--noir); }
.action:hover .ico svg .solid, .action:active .ico svg .solid { fill: var(--noir); }
.txt { display: grid; gap: 1px; min-width: 0; }
.lbl { font-family: var(--display); font-size: 11px; letter-spacing: .3em; color: var(--sage); text-transform: uppercase; }
.val { font-size: 22px; font-weight: 600; color: var(--ivory); font-variant-numeric: lining-nums; overflow-wrap: anywhere; }
.chev { width: 9px; height: 9px; border-top: 1px solid var(--gold); border-right: 1px solid var(--gold); transform: rotate(45deg); transition: transform .4s var(--ease); }
.action:hover .chev { transform: translateX(4px) rotate(45deg); }

/* delivery */
.delivery { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.delivery-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--gold); stroke-width: 1.3; }
.delivery p { font-size: 19px; color: var(--parch); }
.delivery em { color: var(--gold-hi); }

/* buttons */
.buttons { display: grid; grid-template-columns: 1fr 54px; gap: 12px; }
.btn.ghost { padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 16px;
  font-family: var(--display); font-size: 12px; letter-spacing: .24em; text-transform: uppercase;
  border: 1px solid var(--gold); position: relative; overflow: hidden;
  transition: color .4s var(--ease), background-color .4s var(--ease), transform .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); color: var(--noir); }
.btn.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 248, 230, .55), transparent);
  animation: sheen 6s ease-in-out 4.5s infinite;
}
@keyframes sheen { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.btn.primary:hover { background: var(--gold-hi); }
.btn.ghost { color: var(--gold); }
.btn.ghost:hover { background: rgba(191, 160, 106, .12); }

/* houses marquee */
.houses { display: grid; gap: 18px; margin-inline: -28px; }
.houses h2 { text-align: center; font-family: var(--display); font-weight: 400; font-size: 11px; letter-spacing: .38em; margin-right: -.38em; color: var(--sage); text-transform: uppercase; }
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
  padding-block: 14px; border-block: 1px solid var(--hair);
}
.track { list-style: none; padding: 0; display: flex; align-items: center; width: max-content; animation: slide var(--dur, 36s) linear infinite; }
.track li { flex: none; padding-inline: 26px; display: grid; place-items: center; height: 56px; }
.track img { height: var(--h, 36px); width: auto; opacity: .85; transition: opacity .3s; }
.track img:hover { opacity: 1; }
.marquee:hover .track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }

.foot { text-align: center; font-family: var(--display); font-size: 10px; letter-spacing: .3em; color: var(--sage); opacity: .8; margin-top: -6px; }

/* share sheet */
.sheet {
  border: 0; padding: 16px; margin: 0; background: transparent; color: var(--parch);
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  display: none; place-items: center; overflow-y: auto;
}
.sheet[open] { display: grid; }
.sheet::backdrop { background: rgba(20, 25, 15, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s var(--ease); }
.sheet.is-open::backdrop { opacity: 1; }
.sheet-panel {
  position: relative; width: 100%; max-width: 360px;
  padding: 34px 26px 26px; display: grid; justify-items: center; text-align: center;
  background: linear-gradient(180deg, #3A452D, #2B3322);
  border: 1px solid var(--gold); box-shadow: inset 0 0 0 7px transparent, inset 0 0 0 8px var(--hair), 0 40px 90px -30px rgba(0, 0, 0, .8);
  opacity: 0; transform: translateY(24px) scale(.96);
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}
.sheet.is-open .sheet-panel { opacity: 1; transform: none; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center; }
.sheet-close span { grid-area: 1 / 1; width: 18px; height: 1px; background: var(--gold); transform: rotate(45deg); }
.sheet-close span + span { transform: rotate(-45deg); }
.sheet-kicker { font-family: var(--display); font-size: 11px; letter-spacing: .34em; margin-right: -.34em; color: var(--sage); text-transform: uppercase; }
.sheet-title { margin-top: 6px; font-family: var(--text); font-weight: 500; font-size: 34px; line-height: 1.1; color: var(--ivory); }
.qr-frame { position: relative; margin-top: 22px; padding: 10px; border: 1px solid var(--gold); width: min(100%, 260px); }
.qr-frame .corner { opacity: 1; transform: none; animation: none !important; width: 14px; height: 14px; }
.qr-frame .corner.tl { top: -7px; left: -7px; } .qr-frame .corner.tr { top: -7px; right: -7px; }
.qr-frame .corner.bl { bottom: -7px; left: -7px; } .qr-frame .corner.br { bottom: -7px; right: -7px; }
.qr { aspect-ratio: 1; background: var(--ivory); }
.qr svg { display: block; width: 100%; height: 100%; }
.sheet.is-open .qr svg { animation: qrIn .8s var(--ease) .15s both; }
@keyframes qrIn { from { opacity: 0; filter: blur(4px); transform: scale(.97); } to { opacity: 1; filter: none; transform: none; } }
.sheet-url { margin-top: 16px; font-size: 18px; color: var(--gold-hi); overflow-wrap: anywhere; user-select: all; }
.sheet-actions { margin-top: 20px; width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.btn.wide { padding: 0 12px; min-height: 50px; font-size: 11px; letter-spacing: .2em; }
.sheet .btn.ghost { padding: 0 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--parch); color: var(--noir); padding: 12px 20px;
  font-family: var(--display); font-size: 11px; letter-spacing: .24em; text-transform: uppercase;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .card { padding: 60px 44px 34px; }
  .houses { margin-inline: -44px; }
}
@media (max-width: 360px) {
  .card { padding-inline: 20px; }
  .houses { margin-inline: -20px; }
  .val { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .track { animation: none !important; flex-wrap: wrap; justify-content: center; width: auto; row-gap: 12px; }
  .track li[aria-hidden] { display: none; }
}
[hidden] { display: none !important; }
