/* ==========================================================================
   room.css: fonts, header, the pixel room, shelves, books, easter eggs,
   and the "Just show me the work" list view.
   Desktop: the room is drawn on a fixed 1280 x 800 stage and scaled to fit.
   Phones (860px and under): the same pieces stack into one scrolling column.
   ========================================================================== */

@font-face { font-family: "Pixelify Sans"; src: url("../fonts/pixelify-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("../fonts/pixelify-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

/* Arizona golden hour: one bright, single-theme look on purpose */
:root {
  --ink: #3A1F2B;        /* plum: outlines, text */
  --cream: #FFF4DF;      /* paper, labels */
  --paper2: #FFF8EA;
  --muted: #7A5A52;      /* placeholder + secondary text */
  --wall: #F29A6B;
  --wainscot: #DE7A50;
  --floor: #C27A42;
  --wood: #A8602F;
  --wood-dark: #7E4320;
  --wood-light: #C97F45;
  --pink: #F08AA6;
  --pink-deep: #E86A8E;
  --teal: #2BB8B0;
  --gold: #F2B53B;
  --blue: #2F57B5;
  --line: #E3D3B8;
  --pixel: "Pixelify Sans", "Courier New", monospace;
  --read: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--wall); color: var(--ink); font-family: var(--read); font-size: 16px; line-height: 1.5; font-variant-ligatures: none; }
button, input { font-variant-ligatures: none; }
a { color: var(--blue); }
a:hover { color: var(--ink); }
.px { font-family: var(--pixel); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 4px solid var(--cream); outline-offset: 2px; box-shadow: 0 0 0 8px var(--ink); }

.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); padding: 8px 14px; font-family: var(--pixel); }
.skip-link:focus { top: 8px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: 64px; padding-block: 10px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  background: var(--cream); border-bottom: 4px solid var(--ink);
}
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
.brand-name { font-family: var(--pixel); font-size: 26px; font-weight: 600; line-height: 1.1; }
.brand-title { font-size: 15px; color: #6B3A1E; }
.brand-loc { font-family: var(--pixel); font-size: 14px; color: var(--blue); display: inline-flex; align-items: center; gap: 6px; }
.brand-loc::before { content: ""; width: 8px; height: 8px; background: var(--pink-deep); border: 2px solid var(--ink); }
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.toplink { font-family: var(--pixel); font-size: 16px; color: var(--ink); text-underline-offset: 4px; }
.sound-btn { width: 44px; height: 44px; padding: 0; border: 3px solid var(--ink); background: var(--cream); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sound-btn:hover { background: var(--gold); }
.sound-btn .snd-on { display: none; }
.sound-btn.is-on { background: var(--gold); }
.sound-btn.is-on .snd-on { display: inline; }
.sound-btn.is-on .snd-off { display: none; }
.btn-work {
  font-family: var(--pixel); font-size: 18px; text-decoration: none; color: var(--ink);
  background: var(--teal); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center;
}
.btn-work:hover { background: var(--gold); color: var(--ink); }
.btn-work[data-mode="room"] { background: var(--pink); }

/* ---------- Stage (desktop) ---------- */
.room-view { background: var(--wall); overflow: hidden; }
.stage-wrap { position: relative; margin: 0 auto; overflow: hidden; }
.stage { position: relative; width: 1280px; height: 800px; transform-origin: 0 0; }
.room-bg { position: absolute; left: 0; top: 0; display: block; }
.room-mobile { display: none; }
.stage svg { shape-rendering: crispEdges; }
.plant { position: absolute; left: 76px; top: 318px; width: 80px; height: 100px; }
.sign {
  position: absolute; left: 532px; top: 92px; width: 216px; height: 36px; margin: 0;
  background: var(--wood-dark); border: 4px solid #5E3018; color: var(--cream); font-family: var(--pixel); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.sign-touch { display: none; }

.bookcase { position: absolute; left: 448px; top: 140px; width: 384px; height: 524px; background: #5E3018; padding: 6px; }
.case-inner { height: 100%; background: var(--wood); padding: 12px 12px 0; display: flex; flex-direction: column; box-shadow: inset 4px 4px 0 var(--wood-light); }
.shelf {
  position: relative; flex: none; background: #6B3A1E; display: flex; align-items: flex-end; gap: 6px; padding: 0 14px;
  border-bottom: 14px solid var(--wood-light); box-shadow: 0 4px 0 #8A4A24, inset 0 6px 0 #57301A;
}
.shelf + .shelf { margin-top: 4px; }
.shelf--basics { height: 150px; }
.shelf--work { height: 172px; }
.shelf--decor { height: 106px; gap: 10px; padding: 0 20px; }
.shelf-books { display: flex; align-items: flex-end; gap: 6px; }
.bookend { margin-left: auto; width: 14px; height: 70px; background: var(--gold); box-shadow: inset -4px 0 0 #C98A1E; }
.plate {
  position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  background: var(--cream); border: 2px solid var(--ink); padding: 0 8px; font-size: 12px; line-height: 16px;
}

/* ---------- Books ---------- */
.book {
  position: relative; flex: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--cover); color: var(--ink2);
  font-family: var(--pixel);
  box-shadow: inset -5px 0 0 rgba(0,0,0,.18), inset 4px 0 0 rgba(255,255,255,.22);
  transition: transform .18s steps(3);
}
.book:hover, .book:focus-visible { transform: translateY(-12px); }
.book:focus-visible { outline: 4px solid var(--cream); outline-offset: 2px; box-shadow: 0 0 0 8px var(--ink); }
.spine { writing-mode: vertical-rl; font-size: 16px; line-height: 1; letter-spacing: .5px; white-space: nowrap; position: relative; z-index: 1; }
.deco { position: absolute; display: block; }
.book--hardcover .d1 { left: 0; right: 0; top: 10px; height: 4px; background: var(--accent); }
.book--hardcover .d2 { left: 0; right: 0; top: 18px; height: 2px; background: var(--accent); }
.book--hardcover .d3 { left: 0; right: 0; bottom: 18px; height: 2px; background: var(--accent); }
.book--hardcover .d4 { left: 0; right: 0; bottom: 10px; height: 4px; background: var(--accent); }
.book--journal .d1 { left: 0; right: 0; top: 11px; height: 6px; background: var(--accent); }
.book--journal .d2 { left: 0; right: 0; bottom: 11px; height: 6px; background: var(--accent); }
.book--scroll .d1 { left: 10px; right: 10px; top: 10px; height: 3px; background: var(--accent); }
.book--scroll .d2 { left: 10px; right: 18px; top: 16px; height: 3px; background: var(--accent); }
.book--scroll .d3 { left: 10px; right: 14px; top: 22px; height: 3px; background: var(--accent); }
.book--scroll .d4 { left: 10px; right: 10px; bottom: 10px; height: 3px; background: var(--accent); }
.book--cassette .label { width: 28px; height: 76px; margin-top: -18px; background: var(--cream); display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.book--cassette .label .spine { font-size: 15px; }
.book--cassette .d1 { bottom: 12px; left: 50%; margin-left: -5px; width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 12px solid var(--accent); }
.book--chart .d1 { top: 8px; left: 10px; width: 6px; height: 10px; background: var(--pink-deep); }
.book--chart .d2 { top: 4px; left: 19px; width: 6px; height: 14px; background: var(--accent); }
.book--chart .d3 { top: 11px; left: 28px; width: 6px; height: 7px; background: var(--teal); }
.book--chart .spine { font-size: 14px; margin-top: 14px; }

.tag {
  position: absolute; bottom: calc(100% + 16px); left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--cream); color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 6px 10px; white-space: nowrap; text-align: left; display: flex; flex-direction: column; gap: 2px;
  opacity: 0; pointer-events: none;
}
.tag b { font-family: var(--pixel); font-size: 16px; font-weight: 600; }
.tag i { font-family: var(--read); font-style: normal; font-size: 13px; }
.book:hover .tag, .book:focus-visible .tag { opacity: 1; }

/* ---------- Easter eggs ---------- */
.egg { position: relative; flex: none; }
.decor { border: 0; padding: 0; background: none; cursor: pointer; display: block; color: inherit; }
.decor svg { display: block; }
.decor:hover, .decor:focus-visible, .egg.is-open .decor { filter: drop-shadow(0 0 3px #FFF3B0) drop-shadow(0 0 8px #FFE08A); }
.egg--dogs .decor { width: 160px; height: 112px; background: var(--gold); padding: 8px; box-shadow: 0 0 0 4px var(--ink), 6px 6px 0 4px rgba(58,31,43,.25); }
.wallgroup, .floorgroup, .console-spot { display: contents; }
.poster { position: absolute; left: 920px; top: 112px; }
.egg--dogs { position: absolute; left: 932px; top: 314px; }
.egg--nap { position: absolute; left: 916px; top: 560px; }
.egg--console { position: absolute; left: 252px; top: 436px; }
.mtable { display: none; }
.shelf--decor .egg--globe { margin-left: 6px; }
.shelf--decor .egg--bricks { margin-left: auto; }

.pop {
  position: absolute; z-index: 45; width: 300px;
  background: var(--cream); color: var(--ink); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  padding: 10px 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pop-title { font-family: var(--pixel); font-size: 17px; font-weight: 600; margin: 0; }
.pop p { margin: 0; font-size: 15px; line-height: 1.45; padding-right: 4px; }
.x {
  flex: none; width: 36px; height: 36px; padding: 0; border: 2px solid var(--ink); background: var(--pink); color: var(--ink);
  font-family: var(--pixel); font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
}
.x:hover { background: var(--pink-deep); }
.egg--rocket .pop { bottom: calc(100% + 14px); left: -20px; }
.egg--globe .pop { bottom: calc(100% + 14px); left: -60px; }
.egg--bricks .pop { bottom: calc(100% + 14px); right: -20px; width: 270px; }
.egg--dogs .pop { right: calc(100% + 20px); top: 0; }
.egg--nap .pop { right: calc(100% + 4px); bottom: 10px; }
.egg--console .pop { bottom: calc(100% + 14px); left: -20px; }

/* ---------- Ambient motion ---------- */
.glow { animation: flicker 3.2s steps(1) infinite; }
@keyframes flicker { 0%, 100% { opacity: .3; } 46% { opacity: .2; } 48% { opacity: .3; } 72% { opacity: .24; } 74% { opacity: .3; } }
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 2.4s steps(2) infinite alternate; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.zz { animation: zz 2.8s steps(1) infinite; }
@keyframes zz { 0%, 100% { transform: translate(0, 0); opacity: 1; } 50% { transform: translate(1px, -2px); opacity: .6; } }

/* ---------- Footer ---------- */
.site-foot {
  background: var(--ink); color: var(--cream); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-block: 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.site-foot a { color: var(--cream); font-family: var(--pixel); font-size: 16px; }
.site-foot .foot-links { display: flex; gap: 22px; flex-wrap: wrap; }
.foot-line { font-family: var(--pixel); font-size: 19px; }

/* ---------- List view ("Just show me the work") ---------- */
.work-view { background: var(--cream); }
.work-inner { max-width: 1080px; margin: 0 auto; padding-block: 48px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 44px; }
.work-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 32px; flex-wrap: wrap; }
.work-hero h1 { font-family: var(--pixel); font-size: 40px; line-height: 1.1; margin: 0; text-wrap: balance; }
.work-hero p { margin: 8px 0 0; font-size: 18px; color: var(--muted); max-width: 36em; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  font-family: var(--pixel); font-size: 16px; text-decoration: none; color: var(--ink); background: #FFFFFF;
  border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); min-height: 46px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.btn:hover { background: var(--gold); color: var(--ink); }
.btn--pink { background: var(--pink); }
.h2 { font-family: var(--pixel); font-size: 24px; font-weight: 600; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card { background: #FFFFFF; border: 3px solid var(--ink); box-shadow: 6px 6px 0 rgba(58,31,43,.18); display: flex; flex-direction: column; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 7; max-width: 100%; display: flex; align-items: center; justify-content: center; background: #E8DCC6; border-bottom: 3px solid var(--ink); color: var(--muted); font-size: 14px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: var(--cover); z-index: 1; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { font-family: var(--pixel); font-size: 22px; font-weight: 600; margin: 0; }
.card p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--pixel); font-size: 13px; padding: 3px 9px; border: 2px solid var(--ink); background: var(--cream); color: var(--ink); }
.meta { font-size: 14px; color: #6B3A1E; }
.result { font-size: 15px; padding: 8px 10px; background: var(--paper2); border: 2px dashed var(--line); }
.card-links { margin-top: auto; padding-top: 6px; display: flex; gap: 18px; flex-wrap: wrap; font-weight: 700; font-size: 15px; }
.facts-strip { display: flex; gap: 14px; flex-wrap: wrap; }
.fact { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: #FFFFFF; border: 2px solid var(--line); flex: 1 1 180px; min-width: 0; }
.fact b, .label { font-family: var(--pixel); font-size: 13px; font-weight: 400; color: var(--blue); text-transform: uppercase; letter-spacing: 1px; }
.ph { color: var(--muted); }

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  .book { transition: none; }
  .book:hover, .book:focus-visible { transform: none; }
  .glow, .sway, .zz { animation: none; }
}

/* ==========================================================================
   Phones and small tablets: stack the room
   ========================================================================== */
@media (max-width: 860px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); position: static; }
  .brand { flex-direction: column; gap: 2px; }
  .brand-name { font-size: 22px; }
  .brand-title { font-size: 14px; }
  .brand-loc { font-size: 13px; }
  .topnav { gap: 12px; }
  .btn-work { order: -1; width: 100%; justify-content: center; font-size: 17px; }
  .toplink { font-size: 15px; }

  .stage-wrap { width: auto !important; height: auto !important; }
  .stage { width: auto; height: auto; transform: none !important; display: flex; flex-direction: column; background: var(--wainscot); }
  .room-bg, .plant { display: none; }
  .room-mobile { display: block; width: 100%; height: auto; }
  .sign { position: static; width: auto; height: auto; align-self: center; margin: 16px 16px 14px; padding: 6px 16px; font-size: 16px; }
  .sign-desk { display: none; }
  .sign-touch { display: inline; }

  .bookcase { position: static; width: calc(100% - 32px); max-width: 420px; height: auto; margin: 0 auto 24px; }
  .case-inner { height: auto; padding: 10px 10px 14px; }
  .shelf { padding: 0 12px; }
  .shelf--work { order: -1; margin-top: 0 !important; }
  .shelf--basics { margin-top: 4px; }
  .book:hover { transform: none; }
  .book:active { transform: translateY(-8px); }
  .tag { display: none; }

  .wallgroup { display: flex; justify-content: center; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding-block: 24px 20px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-top: 3px solid var(--wood); }
  .poster, .egg--dogs, .egg--nap, .egg--console { position: relative; left: auto; top: auto; }
  .egg--dogs { margin-top: 4px; }
  .floorgroup { display: flex; justify-content: center; align-items: flex-end; gap: 20px; flex-wrap: wrap; background: var(--floor); border-top: 8px solid var(--wood-dark); padding-block: 22px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .console-spot { display: flex; flex-direction: column; align-items: center; }
  .mtable { display: block; width: 60px; height: 24px; border-top: 10px solid var(--wood); border-left: 6px solid var(--wood-dark); border-right: 6px solid var(--wood-dark); }
  .egg--nap svg { width: 200px; height: auto; }

  /* bubbles become a bottom sheet */
  .pop {
    position: fixed; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important;
    border-width: 4px 0 0; box-shadow: 0 -6px 0 rgba(58,31,43,.25);
    padding-block: 16px calc(28px + env(safe-area-inset-bottom, 0px));
    padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  }
  .pop p { font-size: 16px; }
  .x { width: 44px; height: 44px; font-size: 18px; }

  .cards { grid-template-columns: minmax(0, 1fr); }
  .work-hero h1 { font-size: 32px; }
}
