/* ==========================================================================
   RESPONSIVE — base styles are mobile-first (375–430px portrait).
   Tablets and desktops get genuinely different, more spacious compositions.
   ========================================================================== */

/* ---------- small phones (≤ 360px or short screens) ---------- */
@media (max-width: 360px) {
  .btn { font-size: .66rem; padding: .75em .9em; letter-spacing: .1em; }
  .s7-actions__row { grid-template-columns: 1fr; }
}
@media (max-height: 640px) and (max-width: 699px) {
  .wall__cabinet { display: none; }
  .s1-letter { padding-top: 20px; }
  .fold-panel { padding: 14px 18px; }
  .letter__p { font-size: .98rem; line-height: 1.5; }
  .s6-top { min-height: 52px; }
  .popup { min-height: 220px; }
}

/* ---------- tablet+ ---------- */
@media (min-width: 600px) {
  :root { --hud-h: 60px; }
  .hud__title { display: flex; }
  .hud__dot { width: 26px; height: 22px; display: grid; place-items: center; }
  .hud__dot span { display: inline; font: 600 .56rem var(--f-mono); letter-spacing: .04em; }
  .hud__dot.is-current { width: 34px; color: var(--paper-hi); }
  .hud__dot.is-done { color: var(--paper); }
  [data-theme='night'] .hud__dot.is-done, [data-theme='future'] .hud__dot.is-done { color: var(--night); }
  .hud__sound-label { display: inline; }
  .dept-sign__room, .dept-sign__floor { display: inline; }
  .dept-sign { gap: 22px; padding: 10px 24px; }

  .envelope { width: min(70vw, 560px); }

  /* HQ */
  .hq { width: min(140vw, 1180px, 135vh); }
  .hq-desk { aspect-ratio: 1000 / 320; }
  .dispenser-tag { right: auto; left: 50%; translate: -50% 0; }
  .wall__window { left: 3%; width: 22vw; }
  .wall__clock { right: auto; left: 31%; width: 11vw; max-width: 118px; top: calc(var(--top) + 6%); }
  .wall__insignia { width: 16vw; max-width: 170px; }
  .wall__poster { display: block; right: 19%; top: calc(var(--top) + 5%); width: 12vw; max-width: 140px; filter: drop-shadow(4px 5px 0 rgba(39, 60, 74, .18)); }
  .wall__notice { right: 5%; top: calc(var(--top) + 8%); width: 112px; }
  .wall__cabinet { left: auto; right: 2%; bottom: 7%; width: 12vw; max-width: 160px; }
  .hq-pigeon { left: 41%; width: 18%; bottom: 27%; }
  .obj--nameplate { width: 12%; bottom: 44%; }
  .obj--lamp, .obj--stack1 { display: block; }
  .obj--phone { left: 14%; width: 11%; }
  .obj--stack2 { left: 64%; width: 9%; }
  .obj--dispenser { left: 77%; width: 10%; }
  .slip--hq { left: 55%; bottom: 100%; width: max-content; max-width: 320px; }
  .slip--hq::after { left: 22px; margin-left: 0; }
  .ticket-stage { top: calc(var(--top) + 12%); }

  /* Good Things */
  .form-b1 { padding: 28px 30px 28px; }
  .q__options { grid-template-columns: 1fr 1fr; }

  /* Future */
  .printer { width: 340px; }

  /* Recognition */
  .certificate { aspect-ratio: 1.414; }
  .cert__inner { padding: 7.5cqw 10cqw 8cqw; gap: .9cqw; }
  .cert__kicker { font-size: 1.25cqw; }
  .cert__pre { font-size: 2.3cqw; margin-top: .4cqw; }
  .cert__title { font-size: 4.4cqw; max-width: 80%; }
  .cert__presented { font-size: 1.3cqw; margin-top: .8cqw; }
  .cert__name { font-size: 9.5cqw; padding: 0 4cqw .3cqw; border-bottom-width: .3cqw; }
  .cert__citation { font-size: 1.85cqw; max-width: 64%; margin-top: .6cqw; }
  .cert__meta { width: 70%; margin-top: .8cqw; padding: .9cqw 0; gap: 1.5cqw; }
  .cert__meta dt { font-size: 1.05cqw; }
  .cert__meta dd { font-size: 1.45cqw; }
  .cert__sigs { width: 70%; gap: 22cqw; margin-top: .6cqw; }
  .sig__hand { font-size: 2.4cqw; }
  .sig__role { font-size: .95cqw; }
  .cert__ribbon { width: 6.4cqw; bottom: 4.2cqw; }
  .cert__impression { right: 7cqw; bottom: 9cqw; width: 15cqw; }
  .cert__serial { font-size: .85cqw; bottom: 3.3cqw; right: 10cqw; }
  .s5-pigeon { left: auto; right: 16px; bottom: calc(80px + var(--safe-b)); width: 110px; }
  .slip--s5 { left: auto; right: 10px; }
  .slip--s5::after { left: auto; right: 30px; }
  .cert__stamp-slot { left: 5cqw; top: 5cqw; }
  .award-btn svg { width: 64px; }

  /* Chamber */
  .s6-wish__prompt { display: none; }
  .s6-pigeon { left: 4%; bottom: 14%; }
}

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  /* Scene 01 — more desk, more drafting detail */
  .s1-mat { inset: 5vmin 7vmin; }
  .envelope { width: min(46vw, 600px); }

  /* HQ: the full illustrated hall */
  .wall__window { left: 4%; top: calc(var(--top) + 5%); width: 17vw; max-width: 260px; }
  .wall__insignia { top: calc(var(--top) + 4%); width: 13vw; max-width: 190px; }
  .wall__clock { left: 27%; top: calc(var(--top) + 7%); width: 8.5vw; }
  .wall__poster { right: 21%; width: 10vw; max-width: 150px; }
  .wall__notice { right: 9%; top: calc(var(--top) + 9%); width: 124px; }
  .wall__cabinet { right: 1.5%; bottom: 6%; width: 9vw; max-width: 150px; }
  .slip--hq { bottom: 104%; }

  /* Good Things: cabinet becomes a real piece of furniture beside the form */
  .s3 { padding-bottom: 60px; }
  .dept__blotter { display: block; position: absolute; left: 50%; top: calc(var(--top) + 70px); width: min(1060px, 94vw); min-height: calc(100% - var(--top) - 90px); translate: -50% 0; background: #4E5C44 var(--noise); border: 2px solid #3B4733; outline: 2px dashed rgba(231, 187, 104, .45); outline-offset: -12px; border-radius: 6px; box-shadow: 0 20px 40px rgba(0, 0, 0, .25); }
  .s3-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: 36px; padding: 10px 24px 0; }
  .s3-cabinet { position: sticky; top: calc(var(--top) + 24px); order: 0; left: auto; right: auto; bottom: auto; width: 210px; padding: 0; background: none; border: 0; box-shadow: none; transform: none; visibility: visible; transition: none; flex: none; }
  .s3-cabinet .cabinet { max-width: none; }
  .s3-cabinet__hint { color: var(--paper); }
  .form-b1 { order: 1; transform: rotate(-.4deg); }
  .s3-desk-items { display: block; order: 2; position: relative; width: 150px; height: 420px; flex: none; }
  .item-pen { position: absolute; left: 30px; top: 40px; width: 16px; height: 200px; background: linear-gradient(var(--ink) 0 72%, var(--ochre) 72% 76%, var(--ink) 76% 94%, #C7CFD2 94%); border-radius: 8px 8px 3px 3px; transform: rotate(14deg); box-shadow: 5px 6px 0 rgba(0, 0, 0, .2); }
  .item-clip { position: absolute; left: 80px; top: 280px; width: 18px; height: 52px; border: 3px solid #B9C2C3; border-radius: 9px; transform: rotate(-20deg); }
  .item-clip--2 { left: 40px; top: 330px; transform: rotate(30deg); }
  .s3-dock { left: auto; justify-content: flex-end; }
  .s3-cabinet-toggle { display: none; }
  .s3-pigeon, .s3-pigeon__art { width: 150px; }
  .s3-pigeon__art { margin-bottom: -40px; }

  /* Future Affairs: machine + spike side by side */
  .s4-layout { flex-direction: row; justify-content: center; align-items: flex-start; gap: 48px; }
  .s4-machine { width: auto; }
  .printer { width: 380px; }
  .s4-spike { position: sticky; top: calc(var(--top) + 30px); width: 300px; margin-top: 40px; }
  .spike__pin { display: block; width: 4px; height: 36px; margin: -30px auto 10px; background: #B9C2C3; border-radius: 2px; box-shadow: 0 36px 0 -1px #6F7F88; }

  /* Recognition: awards hang on the wall beside the certificate */
  .s5-layout { flex-direction: row; justify-content: center; align-items: flex-start; gap: 28px; }
  .s5-cert-wrap { width: min(860px, calc(100vw - 260px)); }
  .s5-awards { width: 150px; margin-top: 60px; }
  .s5-awards__list { flex-direction: column; gap: 22px; }
  .award-btn { width: 120px; }
  .award-btn svg { width: 80px; }
  .s5-pigeon { width: 150px; right: 24px; bottom: 90px; }

  /* Chamber */
  .popup { width: min(820px, 100%); min-height: 360px; }
  .pl--cake { width: min(360px, 50%, 30vh); }
  .pl--bunting { height: 80%; }
  .matchbox { width: 250px; }
  .s6-pigeon { left: 8%; bottom: 10%; width: 180px; }
  .s6-bottom { min-height: 170px; }

  /* Final document */
  .s7-cord { right: 22%; height: 116px; }
  .cord__line { height: 88px; }
  .s7-stage { padding-top: calc(var(--top) + 34px); }
}

/* ---------- wide desktop ---------- */
@media (min-width: 1360px) {
  .hud { padding-left: 24px; padding-right: 24px; }
  .wall__window { left: 6%; }
}

/* ---------- landscape phones: keep everything reachable ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --hud-h: 46px; }
  .envelope { width: min(52vw, 400px); }
  .s1-stage { gap: 10px; }
  .hq { width: min(110vw, 150vh); }
  .wall__window, .wall__cabinet, .wall__poster { display: none; }
  .s6 { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .s6-top { width: 100%; min-height: 40px; }
  .popup { min-height: 180px; height: calc(100% - 90px); flex: 1 1 50%; }
  .s6-bottom { width: auto; flex: 0 1 40%; justify-content: center; min-height: 0; }
}
