/* two up. house layer over the PRESS START door and world. tokens come from hub.css. see ../DESIGN.md */

.period { color: var(--period); }

/* the bar on the door: wordmark left, three quiet links right */
.house-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + var(--safe-t)) max(16px, var(--safe-r)) 10px max(16px, var(--safe-l));
  pointer-events: none;
}
.house-bar > * { pointer-events: auto; }
body.in-world .house-bar { display: none; }
.hb-mark { font: 400 20px/1 var(--print); color: var(--cream); text-decoration: none; letter-spacing: .01em; }
.hb-links { display: flex; gap: 16px; align-items: center; }
.hb-link {
  font: 400 12px/1 var(--mono); color: var(--dust); background: none; border: 0; padding: 8px 0; cursor: pointer;
  text-decoration: none;
}
.hb-link:hover, .hb-link:focus-visible { color: var(--cream); }
@media (max-width: 420px) { .hb-links { gap: 12px; } .hb-link { font-size: 11px; } }
#hub { padding-top: max(52px, calc(44px + var(--safe-t))); }

/* in the world: one small tag you can always reach */
.house-chip {
  position: fixed; z-index: 20; /* above #world (8) */
  right: max(14px, var(--safe-r)); bottom: calc(70px + var(--safe-b));
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 9px 12px 8px;
  background: var(--cream); color: var(--ink);
  border: 0; cursor: pointer;
  font: 400 17px/1 var(--print);
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .12s var(--ease);
}
.house-chip .chip-sub { font: 400 10px/1 var(--mono); color: var(--ink-dim); }
.house-chip:hover { transform: translateY(-2px); }
.house-chip:active { transform: translateY(1px); }
.house-chip[hidden] { display: none; }

/* the drawer: a hang tag that slides up over the room */
.house-drawer {
  margin: 0 auto 0; padding: 0; border: 0; max-width: 560px; width: 100%;
  max-height: min(86svh, 720px);
  position: fixed; inset: auto 0 0 0;
  background: transparent; color: var(--ink);
  overflow: visible;
}
.house-drawer::backdrop { background: rgba(10, 9, 9, .55); }
.hd-sheet {
  background: var(--cream) var(--paper); color: var(--ink);
  padding: 18px 20px calc(22px + var(--safe-b));
  max-height: min(86svh, 720px); overflow-y: auto;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
}
@media (prefers-reduced-motion: no-preference) {
  .house-drawer[open] .hd-sheet { animation: hd-up .28s var(--ease) both; }
  @keyframes hd-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.hd-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.hd-mark { margin: 0; font: 400 26px/1 var(--print); }
.hd-close { font: 400 12px/1 var(--mono); background: none; border: 0; color: var(--ink-dim); padding: 8px 0 8px 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.hd-tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--ink); margin-bottom: 16px; }
.hd-tabs button {
  font: 400 20px/1 var(--print); text-transform: lowercase;
  background: none; border: 0; color: var(--ink-dim); padding: 8px 12px 9px; cursor: pointer;
  border-bottom: 4px solid transparent; margin-bottom: -2.5px;
}
.hd-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.hd-pane[hidden] { display: none; }
.hd-lead { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.hd-keys { display: grid; gap: 10px; margin-bottom: 16px; }
@media (min-width: 520px) { .hd-keys { grid-template-columns: repeat(3, 1fr); } }
.hd-key { border: 1.5px solid var(--ink); padding: 12px 12px 10px; background: rgba(255, 248, 240, .55); }
.hd-key h3 { margin: 0 0 6px; font: 400 40px/.9 var(--print); }
.hd-key h3 small { display: block; font: 400 11px/1.6 var(--mono); color: var(--ink-dim); }
.hd-key .plus { margin: 0 0 4px; font-size: 11px; color: var(--ink-dim); }
.hd-key ul { margin: 0; padding: 0 0 0 1em; font-size: 12px; line-height: 1.45; }
.hd-key li { margin: 4px 0; }
.hd-key li::marker { content: '+ '; color: var(--ink-dim); }
.hd-woven { display: inline-block; margin: 0 0 10px; padding: 5px 9px 4px; background: var(--ink); color: var(--bone); font: 400 9px/1.4 var(--silk); letter-spacing: .26em; text-transform: uppercase; }
.hd-go {
  display: inline-block; font: 400 22px/1 var(--print); text-transform: lowercase; text-decoration: none;
  background: var(--ink); color: var(--cream); border: 0; padding: 13px 20px 12px; cursor: pointer;
}
.hd-go:active { transform: translateY(2px); }
.hd-fine { margin: 16px 0 0; font-size: 11.5px; color: var(--ink-dim); }
.hd-fine a { color: var(--ink-dim); }

/* the door on desktop: one centered frame, three columns on one middle line (Dec 3, Trey: "it just feels wonky") */
@media (min-width: 900px) {
  .stitch-mark { display: none; } /* the bar already carries the mark */
  #hub { padding-inline: max(40px, calc((100vw - 1320px) / 2)); }
}
@media (min-width: 1180px) {
  #hub {
    grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.1fr) 330px;
    grid-template-rows: auto 1fr auto auto 1fr auto;
    column-gap: clamp(24px, 3vw, 48px);
  }
  .hub-top { grid-row: 3; align-self: end; }
  .ip-btn--go { grid-row: 4; }
  #cube-stage { grid-row: 2 / 6; min-height: 420px; max-height: 640px; align-self: center; }
  .cube-meta { grid-row: 6; margin: 0 0 4px; }
  .tag-card { grid-column: 3; grid-row: 2 / 6; align-self: center; width: 330px; transform: rotate(1.2deg); }
}

/* Dec 4: one PRESS START. the big title is the button; it says it once. */
.title-btn { all: unset; display: block; width: 100%; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; line-height: inherit; text-align: inherit; transition: transform .12s ease-out; }
.title-btn:hover { transform: translate(-.01em, -.01em); }
.title-btn:active { transform: translate(.03em, .035em); }
.title-btn:focus-visible { outline: 2px dashed var(--cream); outline-offset: 6px; }
.title-btn:disabled { cursor: default; }
@media (min-width: 900px) and (max-width: 1179px) { .tag-card { grid-row: 4; margin-top: 34px; } }
@media (min-width: 1180px) { .hub-top { grid-row: 3 / 5; align-self: center; } }

/* Dec 4: on a phone the cube was a wall. it took the full width with touch-action none, so a swipe over it twisted
   the cube instead of scrolling down to the sign-up tag. now it is smaller and centered, with gutters to scroll in. */
@media (max-width: 899px) {
  #cube-stage { width: min(76vw, 320px); min-height: 0; height: min(76vw, 320px, 42svh); flex: 0 0 auto; margin: 10px auto 2px; }
  .cube-meta { max-width: 340px; margin-inline: auto; }
  .tag-card { margin-top: 26px; }
  .house-bar { background: linear-gradient(var(--wash, #212121) 70%, rgba(33,33,33,0)); padding-bottom: 14px; }
}

/* the cube is the lock: rooms past room 1 wait for a solve */
.door[aria-disabled="true"] { opacity: .45; }
.door[aria-disabled="true"]::after { content: ' · locked'; font-size: .8em; }
.lock-note { position: fixed; z-index: 90; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: max-content; max-width: min(92vw, 440px); margin: 0; padding: 12px 18px 11px; background: var(--cream, #F7EDD9); color: var(--ink, #161514); font: 13px/1.4 var(--mono, ui-monospace, monospace); box-shadow: 0 10px 30px rgba(0,0,0,.45); text-align: center; }

/* the sign-up's spam trap sat off the bottom and made #hub a second scroller: the last swipe to the email form stuck. */
.hp { top: 0; left: 0; clip-path: inset(50%); overflow: hidden; }
#hub { overflow: visible; }
/* Dec 4 (v3): on a phone the door is one screen, no scroll. the sign-up lives in the drawer's list tab
   (house-drawer.js moves it there); the door keeps one line that opens it. Trey: make the sign up box somewhere else so there is no scroll down. */
.list-open { display: none; }
#tab-list { display: none; }
@media (max-width: 899px) {
  .list-open { display: inline-block; margin-top: 14px; }
  #tab-list { display: revert; }
  #pane-list .tag-card { margin: 4px 0 0; box-shadow: none; }
  #pane-list .tag-hole { display: none; }
}
/* v3: the door fits one phone screen. the cube takes what is left after the title, the hint and the sign-up line. */
@media (max-width: 899px) {
  #cube-stage { height: clamp(150px, calc(100svh - 345px - min(45vw, 198px)), min(76vw, 320px)); width: min(76vw, 320px); }
}
@media (max-width: 899px) and (max-height: 760px) {
  .hub-title { font-size: min(27vw, 11.5svh); }
  .neck-label { margin-bottom: 6px; }
  .cube-meta { margin-bottom: 4px; }
  .list-open { margin-top: 4px; }
  .stitch-mark { margin-top: 8px; }
  #cube-stage { height: clamp(140px, calc(100svh - 420px), min(76vw, 320px)); }
}
/* the bag (Dec 4): a Shopify cart in the drawer. ink and cream only; press start keeps the one red */
/* the bag chip and the house chip share one strip, and step aside while a piece is up in the room */
.house-chips {
  position: fixed; z-index: 20; /* above #world (8) */
  right: max(14px, var(--safe-r)); bottom: calc(70px + var(--safe-b));
  display: flex; gap: 8px; align-items: stretch; pointer-events: none;
}
.house-chips > * { pointer-events: auto; }
.house-chips .house-chip { position: static; }
@media (min-width: 721px) { body.piece-open .house-chips { right: calc(min(392px, 92vw) + 14px); } }
@media (max-width: 720px) { body.piece-open .house-chips { bottom: calc(50vh + 12px); } }
@media (prefers-reduced-motion: no-preference) { .house-chips { transition: right .25s var(--ease), bottom .25s var(--ease); } }
.bag-chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 12px 7px;
  background: var(--wash-deep) var(--paper); color: var(--cream);
  border: 1.5px solid var(--cream); cursor: pointer;
  font: 400 16px/1 var(--print);
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.bag-chip .chip-sub { font: 400 11px/1 var(--mono); color: var(--cream); }
.bag-chip[hidden], .hb-bag[hidden] { display: none; }
.hb-bag [data-bag-count] { color: var(--bone); }
@media (prefers-reduced-motion: no-preference) {
  .bag-chip.bump, .hb-bag.bump { animation: bag-bump .5s var(--ease); }
  @keyframes bag-bump { 0% { transform: translateY(0); } 35% { transform: translateY(-5px); } 100% { transform: none; } }
}
.hd-tabs button[hidden] { display: none; }
.hd-count { font: 400 11px/1 var(--mono); vertical-align: 3px; margin-left: 2px; }
.bag-lines { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1.5px solid var(--ink); }
.bag-line {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: start;
  padding: 12px 0 10px; border-bottom: 1px dashed rgba(22, 21, 20, .35);
}
.bl-name h4 { margin: 0; font: 400 21px/1.05 var(--print); text-transform: lowercase; }
.bl-opt { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-dim); }
.bl-amt { margin: 0; font: 400 21px/1.05 var(--print); text-align: right; }
.bl-ctl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.bag-qty { display: inline-flex; align-items: stretch; border: 1.5px solid var(--ink); }
.bag-qty button { min-width: 40px; min-height: 36px; background: none; border: 0; color: var(--ink); font: 400 16px/1 var(--mono); cursor: pointer; }
.bag-qty button:disabled, .bag-out:disabled { opacity: .4; cursor: default; }
.bag-qty output { display: grid; place-items: center; min-width: 30px; font: 400 13px/1 var(--mono); border-inline: 1px solid rgba(22, 21, 20, .3); }
.bag-out { background: none; border: 0; color: var(--ink-dim); font: 400 11.5px/1 var(--mono); text-decoration: underline; text-underline-offset: 3px; padding: 10px 0 10px 12px; cursor: pointer; }
.bag-sum { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 16px; font-size: 12px; }
.bag-sum b { font: 400 32px/1 var(--print); font-weight: 400; }
.bag-sum[hidden], #bag-checkout[hidden] { display: none; }
.hd-go:disabled { opacity: .5; cursor: default; }

/* the keys, once a key is set in shop.json: each tag takes you to checkout, the list steps back to a text link */
.hd-take {
  display: block; width: 100%; margin-top: 10px;
  font: 400 17px/1 var(--print); text-transform: lowercase;
  background: none; color: var(--ink); border: 1.5px solid var(--ink); padding: 11px 8px 10px; cursor: pointer;
}
.hd-take:hover, .hd-take:focus-visible { background: var(--ink); color: var(--cream); }
.hd-take:disabled { opacity: .6; cursor: default; }
.hd-go.hd-quiet { background: none; color: var(--ink); font: 400 12.5px/1 var(--mono); text-decoration: underline; text-underline-offset: 4px; padding: 10px 0; }
/* v3b: iPhone Safari floats its address bar over the bottom of the page (Trey's screenshot, Dec 4).
   keep the sign-up line and the stitch mark above it: room at the bottom, and the cube gives up the same height. */
@media (max-width: 899px) and (pointer: coarse) {
  #hub { padding-bottom: calc(78px + var(--safe-b, 0px)); }
  #cube-stage { height: clamp(140px, calc(100svh - 405px - min(45vw, 198px)), min(76vw, 320px)); }
}
@media (max-width: 899px) and (max-height: 760px) and (pointer: coarse) {
  #cube-stage { height: clamp(130px, calc(100svh - 480px), min(76vw, 320px)); }
}

/* v3c: a chalk arrow points at the sign-up line so folks see it (Trey, Dec 4). drawn once, then it rests. */
.list-open { position: relative; }
.chalk-arrow { position: absolute; width: 66px; height: 50px; left: -60px; top: -38px; color: #FFF8F0; pointer-events: none; transform: rotate(-4deg); }
@media (prefers-reduced-motion: no-preference) {
  .chalk-arrow path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: chalk-draw .7s cubic-bezier(.5,.1,.3,1) .9s forwards; }
  .chalk-arrow .ca-head { animation-delay: 1.55s; animation-duration: .3s; }
  @keyframes chalk-draw { to { stroke-dashoffset: 0; } }
}

/* v5 (Trey, Dec 4): no tag. the sign-up stays a link into the key drawer. on a phone, top to bottom:
   the cube (it fills the screen), scramble, the move counter, the sign-up link, and a chalk arrow rising from
   the bottom edge to point up at the link. one screen, no scroll. */
.list-wrap { display: contents; }
@media (max-width: 899px) {
  #hub { height: 100svh; min-height: 0; overflow: clip; padding-bottom: 0; }
  .stitch-mark { display: none; }
  .cube-meta { margin-bottom: 0; }
  #cube-stage { flex: 1 1 0; height: auto; min-height: 140px; max-height: min(96vw, 440px); width: min(96vw, 440px); margin: 4px auto 0; }
  .list-wrap { display: block; position: relative; flex: 0 0 auto; width: 100%; text-align: center; margin-top: 10px; padding-bottom: 112px; }
  .list-wrap .list-open { margin: 0; }
  .list-wrap .chalk-up { left: calc(50% - 150px); top: 28px; bottom: -6px; width: 70px; height: auto; transform: rotate(6deg); }
}
/* v4b (Trey, Dec 4): on a phone the move counter sits under scramble, above the sign-up tag. */
@media (max-width: 899px) {
  .cube-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .cube-meta #cube-scramble { order: 1; }
  .cube-meta #cube-hint { order: 2; margin: 0; text-align: center; }
}

/* v6 (Trey, Dec 4): a fluid floating cube, ready for folks. nothing flashes or boxes in when you touch it
   (the keyboard ring stays for keys only), and on desktop the cube fills the space it is given. */
#cube-stage { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
#cube-stage:focus:not(:focus-visible) { outline: none; }
@media (min-width: 900px) {
  #cube-stage { min-height: min(72vh, 760px); max-height: none; align-self: stretch; }
}
@media (min-width: 1180px) {
  #cube-stage { min-height: min(78vh, 860px); max-height: none; }
}
@media (min-width: 1180px) {
  #hub { grid-template-columns: minmax(340px, .85fr) minmax(480px, 1.75fr) 330px; }
}

/* Dec 4 (Trey: very cluttered on mobile): on a phone the key chip gets out of the way while a piece is up in a room */
@media (max-width: 720px) { body.piece-open .house-chips, body.piece-open .house-chip { opacity: 0; visibility: hidden; pointer-events: none; } }
