/* The Pack Machine — styles. Tokens come from the art style guide. */
:root {
  --black: #1B1714; --iron: #2E2723;
  --brass: #D9A23A; --brass-hi: #F5C451; --brass-lo: #8C5E1C; --glow: #FFD36B;
  --parch: #F3E6CC; --parch-deep: #E2CFA8; --parch-hi: #FFF6E2;
  --ink: #2B1D12; --ink-soft: #5A4632;
  --timber: #6B4426; --oak: #3E2614;
  --teal: #1F5C63; --teal-lo: #123B40;
  --logo: #FFC814;
  --pixel: 'Pixelify Sans', ui-monospace, monospace;
  --serif: 'Vollkorn', Georgia, serif;
  --nav-h: 68px;
  --gut: clamp(12px, 3vw, 48px);
}
* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html { background: var(--black); }
body { margin: 0; background: var(--black); color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* stepped "pixel" corners */
.step { clip-path: polygon(0 16px,8px 16px,8px 8px,16px 8px,16px 0,calc(100% - 16px) 0,calc(100% - 16px) 8px,calc(100% - 8px) 8px,calc(100% - 8px) 16px,100% 16px,100% calc(100% - 16px),calc(100% - 8px) calc(100% - 16px),calc(100% - 8px) calc(100% - 8px),calc(100% - 16px) calc(100% - 8px),calc(100% - 16px) 100%,16px 100%,16px calc(100% - 8px),8px calc(100% - 8px),8px calc(100% - 16px),0 calc(100% - 16px)); }
.step-sm { clip-path: polygon(0 8px,4px 8px,4px 4px,8px 4px,8px 0,calc(100% - 8px) 0,calc(100% - 8px) 4px,calc(100% - 4px) 4px,calc(100% - 4px) 8px,100% 8px,100% calc(100% - 8px),calc(100% - 4px) calc(100% - 8px),calc(100% - 4px) calc(100% - 4px),calc(100% - 8px) calc(100% - 4px),calc(100% - 8px) 100%,8px 100%,8px calc(100% - 4px),4px calc(100% - 4px),4px calc(100% - 8px),0 calc(100% - 8px)); }

[hidden] { display: none !important; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--parch); padding: 10px 14px; font-weight: 700; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 40; min-height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px var(--gut); background: rgba(243,230,204,.95); border-bottom: 4px solid var(--timber);
}
.wordmark { font-family: var(--pixel); font-weight: 700; font-size: 22px; letter-spacing: .5px; text-decoration: none; color: var(--ink); }
.dots { display: flex; gap: 6px; }
.dots a { width: 14px; height: 14px; background: var(--timber); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); transition: background .2s, transform .2s; }
.dots a[aria-current] { background: var(--brass); transform: translateY(-2px); }
.links { display: flex; align-items: center; gap: 22px; font-size: 17px; flex-wrap: wrap; }
.links a { text-decoration: none; }
.links a:hover { color: var(--teal); }
.btn-outline { background: var(--timber); padding: 3px; display: flex; }
.btn-outline span { background: var(--parch); padding: 8px 16px; font-weight: 600; }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--black); }
.still, .clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.still { object-position: 50% 50%; }
.clip { opacity: 0; transition: opacity .15s linear, object-position 1.4s ease-in-out; object-position: var(--focus, 50% 50%); }
.clip.on { opacity: 1; }
.shade { position: absolute; inset: 0; pointer-events: none; transition: background .5s; }
body[data-scene="3"] .shade { background: linear-gradient(90deg, rgba(27,23,20,0) 45%, rgba(27,23,20,.55)); }
body[data-scene="4"] .shade { background: linear-gradient(90deg, rgba(18,14,11,.75), rgba(18,14,11,0) 55%); }
body[data-scene="5"] .shade { background: linear-gradient(180deg, rgba(27,23,20,0) 22%, rgba(27,23,20,.55) 50%, rgba(27,23,20,.92)); }
body[data-scene="7"] .shade { background: linear-gradient(180deg, rgba(27,23,20,0) 55%, rgba(27,23,20,.9)); }

.dip-layer { position: absolute; inset: 0; z-index: 99999; background: var(--black); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.stage.dip .dip-layer { opacity: 1; }
.next { position: fixed; right: var(--gut); bottom: 18px; z-index: 30; display: flex; align-items: center; gap: 6px; border: 0; cursor: pointer; min-height: 44px; padding: 10px 16px; background: rgba(27,23,20,.85); color: var(--parch); font-size: 15px; transition: opacity .3s; }
.next span { font-weight: 700; color: var(--brass-hi); }
.next b { font-family: var(--pixel); animation: bob 1.6s steps(3) infinite; }
.next:hover { background: var(--black); }
.is-moving .next { opacity: 0; pointer-events: none; }
body[data-scene="7"] .next { display: none; }

/* ---------- scene UI layers ---------- */
.ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.scene-ui { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
.scene-ui.is-active { opacity: 1; visibility: visible; transition: opacity .45s ease .05s, visibility 0s; }
.scene-ui.is-active > * { pointer-events: auto; }
.scene-ui .frame { position: absolute; left: var(--fl); top: var(--ft); width: var(--fw); height: var(--fh); pointer-events: none !important; }
.scene-ui .frame > * { position: absolute; pointer-events: auto; }

/* ---------- shared pieces ---------- */
.plaque { background: var(--timber); padding: 6px; }
.plaque__in { background: var(--parch); padding: clamp(18px, 2vw, 26px); }
.label { margin: 0; font-family: var(--pixel); font-weight: 500; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.label--brass { color: var(--brass-lo); }
h1, h2 { margin: 0; font-weight: 700; line-height: 1.06; }
h1 { font-size: clamp(26px, 2.7vw, 40px); }
h2 { font-size: clamp(26px, 2.4vw, 36px); }
.body { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-soft); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 11px 18px; font-size: 16px; font-weight: 600; text-decoration: none; border: 0; cursor: pointer; }
.btn--teal { background: var(--teal); color: var(--parch); box-shadow: inset 0 -4px 0 var(--teal-lo); }
.btn--teal:hover { background: #276F77; }
.btn--paper { background: var(--parch); color: var(--ink); border: 2px solid var(--timber); }
.link { display: inline-block; font-weight: 600; color: var(--teal); text-decoration: none; }
.link:hover { text-decoration: underline; }
.sign { display: inline-block; margin: 0; background: var(--timber); border: 4px solid var(--oak); box-shadow: inset 0 -6px 0 #4A2E18, inset 0 4px 0 #8A5A34; padding: 6px 14px; font-family: var(--pixel); font-size: 17px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--parch); }

/* ---------- scene 1 ---------- */
.plaque--hero { position: absolute; left: var(--gut); bottom: clamp(16px, 7vh, 72px); width: min(560px, calc(100% - 2 * var(--gut))); }
.plaque--hero .plaque__in { display: flex; gap: 16px; }
.plaque__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.portrait { width: 64px; height: 64px; flex-shrink: 0; background: var(--timber); padding: 3px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.bubble { transform: translateY(-50%); background: var(--parch-hi); color: var(--ink); padding: 12px 18px; font-size: 17px; text-decoration: none; box-shadow: inset 0 -4px 0 var(--parch-deep); white-space: nowrap; animation: bob 2.4s steps(4) infinite; }
.hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0; font-family: var(--pixel); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--parch-hi); text-shadow: 0 2px 0 rgba(0,0,0,.5); pointer-events: none !important; }
.hint span { display: inline-block; animation: bob 1.6s steps(3) infinite; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* ---------- side plaques (scenes 2, 3) ---------- */
.plaque--side { position: absolute; right: var(--gut); top: calc(50% + var(--nav-h) / 2); transform: translateY(-50%); width: min(400px, 34vw); }
.plaque--side .plaque__in { display: flex; flex-direction: column; gap: 14px; }

.locs, .packs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.locs li { display: flex; flex-direction: column; gap: 2px; }
.loc__dir { align-self: flex-end; font-size: 14px; font-weight: 600; color: var(--teal); text-decoration: none; padding: 2px 4px; }
.loc__dir:hover { text-decoration: underline; }
.loc { width: 100%; display: flex; gap: 14px; align-items: flex-start; text-align: left; border: 0; cursor: pointer; padding: 12px 14px; background: var(--parch); box-shadow: inset 0 0 0 2px var(--parch-deep); }
.loc:hover { background: var(--parch-hi); }
.loc.is-sel { background: var(--parch-hi); box-shadow: inset 0 0 0 3px var(--brass); }
.chip { width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #8A2A1A; color: var(--parch-hi); font-family: var(--pixel); font-weight: 700; font-size: 16px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.loc.is-sel .chip { background: var(--black); color: var(--brass-hi); }
.loc__txt { display: flex; flex-direction: column; gap: 2px; }
.loc__txt strong { font-size: 18px; }
.loc__txt em { font-style: normal; font-family: var(--pixel); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--timber); }
.loc__txt span { font-size: 14px; color: var(--ink-soft); }

.pins { }
.pin { width: 40px; height: 48px; transform: translate(-50%, -100%) scale(.4); opacity: 0; border: 0; padding: 0; cursor: pointer; background: transparent;
  transition: transform .35s steps(4), opacity .2s; }
.pin::before { content: ''; position: absolute; inset: 0; background: #8A2A1A;
  clip-path: polygon(20% 0,80% 0,80% 8%,90% 8%,90% 16%,100% 16%,100% 58%,90% 58%,90% 66%,80% 66%,80% 75%,70% 75%,70% 83%,60% 83%,60% 92%,40% 92%,40% 83%,30% 83%,30% 75%,20% 75%,20% 66%,10% 66%,10% 58%,0 58%,0 16%,10% 16%,10% 8%,20% 8%); }
.pin::after { content: ''; position: absolute; left: 10%; right: 10%; top: 8%; height: 52%; background: #D9452B; }
.pin span { position: relative; z-index: 1; display: block; margin-top: 7px; text-align: center; font-family: var(--pixel); font-weight: 700; font-size: 17px; color: var(--parch-hi); }
.pins-on .pin { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.pins-on .pin:nth-child(2) { transition-delay: .12s; }
.pins-on .pin:nth-child(3) { transition-delay: .24s; }
.pin.is-sel::before { background: var(--black); }
.pin.is-sel::after { background: var(--brass-hi); }
.pin.is-sel span { color: var(--black); }
.pins-on .pin.is-sel { animation: pinbob .9s steps(3) infinite; }
@keyframes pinbob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }

.packs li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 2px dashed var(--parch-deep); }
.packs i { width: 24px; height: 34px; flex-shrink: 0; background: var(--foil); box-shadow: 0 0 12px color-mix(in srgb, var(--foil) 60%, transparent), inset 0 4px 0 rgba(0,0,0,.25), inset 0 -4px 0 rgba(0,0,0,.25); }
.packs span { display: flex; flex-direction: column; flex-grow: 1; }
.packs strong { font-size: 17px; }
.packs em { font-style: normal; font-family: var(--pixel); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--timber); }
.price { background: var(--black); color: var(--brass-hi); font-family: var(--pixel); font-size: 14px; padding: 5px 9px; }

/* ---------- scene 4 ---------- */
.arcade { position: absolute; left: var(--gut); top: calc(50% + var(--nav-h) / 2); transform: translateY(-50%); width: min(520px, 44vw); display: flex; flex-direction: column; gap: 18px; color: var(--parch); }
.arcade .label, .guild .label { color: var(--brass-hi); }
.arcade h2 { font-size: clamp(32px, 4vw, 58px); color: var(--parch-hi); }
.arcade .body { color: #E2D2AE; font-size: 18px; }
.rip { align-self: flex-start; border: 0; cursor: pointer; background: var(--brass); padding: 3px; }
.rip span { display: block; background: var(--black); color: var(--brass-hi); font-family: var(--pixel); font-size: 22px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding: 14px 26px; box-shadow: inset 0 0 24px rgba(255,211,107,.35); }
.rip:hover span { background: #2a211b; }
.is-ripping .rip { opacity: .5; pointer-events: none; }
.toast { position: absolute; left: var(--gut); bottom: clamp(16px, 8vh, 80px); width: min(380px, calc(100% - 2 * var(--gut))); background: var(--brass); padding: 6px; opacity: 0; transform: translateY(16px); transition: opacity .3s, transform .3s steps(3); pointer-events: none !important; }
.toast .plaque__in { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.toast__title { margin: 0; font-size: 26px; font-weight: 700; }
.toast-on .toast { opacity: 1; transform: none; pointer-events: auto !important; }
.toast-on .arcade { opacity: 0; transition: opacity .3s; }

/* ---------- scene 5 ---------- */
.guild { position: absolute; left: var(--gut); right: var(--gut); bottom: clamp(16px, 6vh, 64px); display: flex; flex-direction: column; gap: 18px; max-width: 1280px; margin: 0 auto; }
.guild__head { color: var(--parch-hi); display: flex; flex-direction: column; gap: 8px; }
.guild__head .body { color: #E7D7B6; font-size: 18px; }
.guild h2 { font-size: clamp(30px, 3.6vw, 50px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.steps li { background: var(--parch); padding: 20px; display: flex; flex-direction: column; gap: 6px; border-bottom: 6px solid #C9B48E; }
.steps b { font-family: var(--pixel); font-size: 28px; color: var(--brass); }
.steps strong { font-size: 20px; }
.steps span { font-size: 15px; color: var(--ink-soft); }
.guild .btn { align-self: flex-start; }

/* ---------- scene 6 ---------- */
.board-title { position: absolute; left: 50%; top: calc(var(--nav-h) + 18px); transform: translateX(-50%); margin: 0; background: var(--oak); color: var(--parch); font-family: var(--pixel); font-size: 22px; letter-spacing: 3px; text-transform: uppercase; padding: 8px 20px; white-space: nowrap; }
.board-title span { font-size: 12px; letter-spacing: 2px; color: var(--brass-hi); margin-left: 10px; }
.note { width: 9.2%; height: 22%; transform: translate(-50%, -50%); background: transparent; border: 0; cursor: pointer; padding: 6% .8% 0;
  font-family: var(--serif); font-weight: 700; font-size: calc(var(--fw) * .0098); line-height: 1.22; color: var(--ink); text-align: center; }
.note:hover, .note:focus-visible { background: rgba(255,246,226,.35); }
.answer { position: absolute; left: 50%; bottom: clamp(16px, 7vh, 72px); transform: translateX(-50%); width: min(520px, calc(100% - 2 * var(--gut))); }
.answer .plaque__in { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.answer .q { margin: 0; font-size: 22px; font-weight: 700; }

/* ---------- scene 7 ---------- */
.plaque--post { position: absolute; left: var(--gut); top: calc(var(--nav-h) + clamp(16px, 6vh, 64px)); width: min(480px, calc(100% - 2 * var(--gut))); }
.plaque--post .plaque__in { display: flex; flex-direction: column; gap: 12px; }
.signup { display: flex; flex-direction: column; gap: 6px; }
.signup input { flex: 1 1 200px; min-height: 44px; padding: 10px 14px; font: 17px var(--serif); color: var(--ink); background: #FFF9EE; border: 3px solid var(--timber); }
.form-msg { margin: 0; min-height: 1.2em; font-size: 15px; color: var(--teal); }
.foot { position: absolute; left: var(--gut); right: var(--gut); bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 16px; border-top: 2px solid rgba(243,230,204,.3); color: var(--parch); font-size: 15px; }
.foot .wordmark { color: var(--logo); font-size: 18px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--brass-hi); }
.foot small { color: #C9B48E; font-size: 13px; }

/* ---------- loader ---------- */
.loader { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12vh; background: rgba(27,23,20,.35); transition: opacity .6s, visibility 0s linear .6s; pointer-events: none; }
.loader span { font-family: var(--pixel); letter-spacing: 2px; text-transform: uppercase; color: var(--brass-hi); background: rgba(27,23,20,.85); padding: 10px 16px; }
.loader.done { opacity: 0; visibility: hidden; }

/* ---------- narrow / portrait screens ---------- */
@media (max-width: 860px) {
  :root { --nav-h: 96px; }
  .links { gap: 14px; font-size: 15px; }
  .links a:not(.btn-outline) { display: none; }
  .plaque--side, .arcade { top: auto; bottom: 12px; transform: none; left: 12px; right: 12px; width: auto; }
  .plaque--side .plaque__in { gap: 10px; padding: 16px; }
  .packs li:nth-child(n+4) { display: none; }
  .loc { padding: 9px 12px; }
  .loc__txt span { display: none; }
  .arcade { background: rgba(18,14,11,.8); padding: 18px; }
  .steps { grid-template-columns: 1fr; gap: 8px; }
  .steps li { padding: 12px 14px; }
  .steps span { display: none; }
  .bubble { display: none; }
}
@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .s6 .frame.notes { position: absolute; left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto !important; height: auto !important;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .s6 .note { position: static; transform: none; width: auto; height: auto; padding: 14px 12px; font-size: 16px; background: var(--parch); box-shadow: 3px 4px 0 rgba(0,0,0,.3); }
  .answer { bottom: auto; top: calc(var(--nav-h) + 70px); }
}
@media (max-height: 640px) and (min-width: 861px) {
  .steps span, .loc__txt span { display: none; }
}

/* ---------- reduced motion ---------- */
.reduce .clip, .reduce .bubble, .reduce .hint span, .reduce .pin { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- phones: tall stills, slide transitions, gentle motion ---------- */
.phone .still { object-position: 50% 50%; transform-origin: 50% 60%; }
.phone .still.incoming { z-index: 2; opacity: 0; transition: transform .65s cubic-bezier(.2,.7,.2,1), opacity .5s ease; }
.phone .still.incoming.from-below { transform: translateY(16%); }
.phone .still.incoming.from-above { transform: translateY(-16%); }
.phone .still.incoming.go { transform: none; opacity: 1; }
.phone .still.out-up, .phone .still.out-down { transition: transform .65s cubic-bezier(.2,.7,.2,1), opacity .65s ease; opacity: .25; }
.phone .still.out-up { transform: translateY(-10%) scale(1.04); }
.phone .still.out-down { transform: translateY(10%) scale(1.04); }
.phone .still.drift { animation: drift 16s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.02) translateY(0); } to { transform: scale(1.08) translateY(-1.8%); } }
/* warm lantern light that breathes a little */
.phone .shade::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(255,179,71,.16), rgba(255,179,71,0) 60%); animation: flicker-glow 3.2s steps(6) infinite; }
@keyframes flicker-glow { 0%, 100% { opacity: .55; } 30% { opacity: .9; } 55% { opacity: .65; } 80% { opacity: 1; } }
/* "Rip a pack" on phones: a burst of gold light */
.stage.flash .dip-layer { background: radial-gradient(circle at 50% 62%, rgba(255,211,107,.95), rgba(255,179,71,.35) 35%, rgba(27,23,20,0) 70%); animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
.phone .hint { display: none; }
.phone .plaque--side, .phone .arcade, .phone .plaque--hero, .phone .answer, .phone .s6 .frame.notes, .phone .toast { bottom: 70px !important; }
.phone .guild { bottom: 70px; }
.phone .next { bottom: 14px; right: 12px; }
.phone .shade { background: linear-gradient(180deg, rgba(27,23,20,0) 30%, rgba(27,23,20,.7) 55%, rgba(27,23,20,.9)) !important; }
.phone .plaque--post { top: calc(var(--nav-h) + 12px); }
.phone .foot { bottom: 70px; }
.reduce.phone .shade::after { animation: none; }
