/* games.joemorrow.com -- "Chris's Basement" (Concept C), built for production.
   Warm, lit-from-a-lamp light theme. Wood-panel den up top, a marquee ticker, then a shelf of
   game cards like boxed cartridges. Proprietor wording (name, sign, tagline, footer line) is
   rendered by app.js from proprietor.json -- nothing proprietor-specific is hard-coded here. */

@font-face { font-family: "Erica One"; src: url("fonts/EricaOne-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/BricolageGrotesque-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/BricolageGrotesque-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nothing You Could Do"; src: url("fonts/NothingYouCouldDo-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --cream: #f3ead4;
  --paper: #fffaf0;
  --ink: #2a2619;          /* 13:1 on --paper */
  --ink-2: #5d5644;        /* 6.6:1 on --paper */
  --olive: #56622f;
  --olive-dk: #3c4520;
  --gold: #d6a23f;
  --red: #c4432c;
  --teal: #2f6f6a;
  --wood-1: #6b4426;
  --wood-2: #7c5130;
  --wood-3: #5a3820;
  --display: "Erica One", "Cooper Black", Georgia, serif;
  --body: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --hand: "Nothing You Could Do", "Bradley Hand", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.5 var(--body); background: var(--cream);
  background-image: radial-gradient(rgba(90, 56, 32, .07) 1px, transparent 1.2px);
  background-size: 6px 6px;   /* faint carpet grain */
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

/* ---------- top bar ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px); padding-top: max(10px, env(safe-area-inset-top));
  background: #2b1d12; color: #e9dcc0; font: 700 13px/1 var(--body); letter-spacing: .04em;
}
.top-brand { text-decoration: none; }
.top-right { display: flex; align-items: center; gap: 16px; }
.top-open { display: inline-flex; align-items: center; gap: 8px; color: var(--gold); }
.top-open i { width: 8px; height: 8px; border-radius: 50%; background: #ff6a3d; box-shadow: 0 0 0 3px rgba(255, 106, 61, .25), 0 0 10px #ff6a3d; }
.top-switch { font: 700 12px/1 var(--body); letter-spacing: .04em; color: #e9dcc0; text-decoration: underline; text-underline-offset: 3px; opacity: .8; }
.top-switch:hover, .top-switch:focus-visible { opacity: 1; }
.top-switch:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- the den: wood paneling, string lights, framed portrait, painted sign ---------- */
.den {
  position: relative; overflow: hidden; color: var(--paper);
  background:
    linear-gradient(rgba(0, 0, 0, .15), rgba(0, 0, 0, .35)),
    repeating-linear-gradient(90deg, var(--wood-2) 0 3px, var(--wood-1) 3px 58px, var(--wood-3) 58px 62px, var(--wood-2) 62px 120px);
  box-shadow: inset 0 -10px 0 #3e2716, inset 0 -14px 0 var(--gold);   /* chair rail */
}
.lights {
  height: 34px; margin: 0 -10px;
  background:
    radial-gradient(circle at 50% 22px, #ffe7a3 0 5px, rgba(255, 216, 120, .55) 6px, transparent 16px) 0 0 / 56px 34px repeat-x,
    radial-gradient(circle at 50% 22px, #ffb08a 0 5px, rgba(255, 140, 100, .5) 6px, transparent 16px) 28px 0 / 56px 34px repeat-x;
  -webkit-mask: linear-gradient(#000, #000); mask: linear-gradient(#000, #000);
  border-top: 2px solid rgba(0, 0, 0, .35);
}
.den-inner {
  max-width: 1180px; margin: 0 auto; padding: 4px clamp(16px, 4vw, 40px) 36px;
  display: flex; align-items: center; justify-content: center; gap: clamp(20px, 4vw, 48px);
}
.portrait {
  margin: 0; flex: none; padding: 10px 10px 8px; background: #f8f0dc; transform: rotate(-4deg);
  box-shadow: 0 0 0 6px #3a2614, 0 14px 24px rgba(0, 0, 0, .45);
}
.portrait-frame { display: block; position: relative; overflow: hidden; background: #1a120b; }
.portrait-frame img { width: clamp(96px, 13vw, 150px); aspect-ratio: 1; object-fit: cover; object-position: 50% 30%; }
.portrait figcaption { margin-top: 6px; text-align: center; font: 15px/1 var(--hand); color: #4a3a24; }
/* Low-res proprietor photo (e.g. Joe's 188x158 placeholder): lean into a deliberate
   "photo-booth flash" treatment -- crisp pixel edges + a scanline overlay + warm vignette --
   instead of letting it read as an accidental blurry upscale. */
.portrait[data-lowres="true"] .portrait-frame img { image-rendering: pixelated; filter: contrast(1.08) saturate(1.15) sepia(.08); }
.portrait[data-lowres="true"] .portrait-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(20, 12, 4, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(20, 12, 4, .35) 100%);
  mix-blend-mode: multiply;
}
.den-sign {
  padding: 18px 28px 20px; background: var(--paper); color: var(--ink); border-radius: 6px; transform: rotate(1deg);
  box-shadow: 0 0 0 4px var(--olive), 0 0 0 7px var(--paper), 0 18px 30px rgba(0, 0, 0, .4);
}
.den-kicker { font: 22px/1 var(--hand); color: var(--red); }
.den-sign h1 { margin-top: 2px; font: 400 clamp(32px, 4.6vw, 58px)/.95 var(--display); color: var(--olive-dk); letter-spacing: .01em; }
.den-sign h1 .accent { display: block; color: var(--red); }
.den-note { margin-top: 10px; font: 700 14px/1.3 var(--body); color: var(--ink-2); }

/* ---------- marquee ticker ---------- */
.ticker { overflow: hidden; background: var(--ink); color: var(--gold); border-block: 3px solid var(--gold); }
.ticker-track {
  display: flex; width: max-content; gap: 22px; padding: 9px 0;
  font: 400 15px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  animation: scroll 38s linear infinite;
}
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- the shelf (auto-fill grid: 2 games or 20, same rule) ---------- */
.shelf { max-width: 1240px; margin: 0 auto; padding: clamp(24px, 4vw, 44px) clamp(16px, 4vw, 40px) 56px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.shelf-head h2 { font: 400 clamp(24px, 3vw, 32px)/1 var(--display); color: var(--olive-dk); }
.shelf-count { font: 22px/1 var(--hand); color: var(--red); }
.grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(18px, 2.4vw, 28px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

/* ---------- a card = a boxed cartridge ---------- */
.card {
  --stripe: var(--olive);
  display: flex; flex-direction: column; background: var(--paper); border-radius: 10px; overflow: hidden;
  border: 2px solid var(--ink); box-shadow: 5px 6px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
  animation: deal .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 80ms);
}
.card[data-stripe="red"] { --stripe: var(--red); }
.card[data-stripe="gold"] { --stripe: var(--gold); }
.card[data-stripe="teal"] { --stripe: var(--teal); }
@keyframes deal { from { opacity: 0; transform: translateY(14px) rotate(-1deg); } }
.card:hover { transform: translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }

.card-shot { position: relative; display: block; border-bottom: 2px solid var(--ink); background: #111; }
.card-shot::before { /* label stripe across the top, like a cartridge */
  content: ""; position: absolute; inset: 0 0 auto; height: 8px; z-index: 1;
  background: repeating-linear-gradient(90deg, var(--stripe) 0 22px, color-mix(in srgb, var(--stripe) 70%, #000) 22px 26px);
}
.card-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: filter .2s; }
.card:hover .card-shot img { filter: brightness(1.08) saturate(1.1); }
.card-new {
  position: absolute; right: 10px; bottom: -14px; z-index: 2; padding: 6px 12px 4px;
  font: 22px/1 var(--hand); color: var(--paper); background: var(--red); border-radius: 4px; transform: rotate(-5deg);
  box-shadow: 2px 3px 0 var(--ink);
}

.card-body { flex: 1; padding: 16px 18px 6px; }
.card-series { font: 700 11px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--stripe); filter: brightness(.8); }
.card-title { margin-top: 6px; font: 400 23px/1.05 var(--display); color: var(--ink); letter-spacing: .005em; }
.card-pitch { margin-top: 8px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.card-controls { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 5px; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.card-controls li { display: grid; grid-template-columns: 56px 1fr; align-items: start; }
.card-controls b {
  justify-self: start; min-width: 48px; padding: 1px 6px; border-radius: 4px; text-align: center;
  font: 700 10px/1.5 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  background: #ece2c9; box-shadow: inset 0 -2px 0 #cdbf9c;   /* keycap */
}

.card-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px 18px; }
.play {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: 8px; text-decoration: none;
  font: 400 22px/1 var(--display); letter-spacing: .06em; color: var(--paper); background: var(--olive);
  border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.play:hover { background: var(--olive-dk); }
.play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.play:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.play-ext { display: inline-flex; opacity: .85; translate: 0 1px; } /* external-link glyph, only on overridden Play buttons */
.badge { /* round sticker */
  flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 2px;
  font: 700 9px/1.05 var(--body); letter-spacing: .04em; text-transform: uppercase; text-align: center;
  color: var(--ink); background: var(--gold); border: 2px dashed rgba(42, 38, 25, .55); transform: rotate(8deg);
}

.card--soon { background: transparent; border-style: dashed; box-shadow: none; display: grid; place-items: center; min-height: 260px; }
.card--soon:hover { transform: none; box-shadow: none; }
.soon { padding: 24px; text-align: center; }
.soon-hand { font: 26px/1.1 var(--hand); color: var(--olive-dk); }
.soon-small { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.oops { font: 24px/1.2 var(--hand); color: var(--red); }

/* ---------- footer ---------- */
.foot { padding: 22px 16px max(26px, env(safe-area-inset-bottom)); text-align: center; background: #2b1d12; color: #d9cba9; font-size: 13px; }
.foot-hand { margin-top: 4px; font: 18px/1.2 var(--hand); color: var(--gold); }

/* ---------- touch devices: only the controls that apply ---------- */
@media (hover: none) and (pointer: coarse) { .ctl-desktop { display: none; } }

/* ---------- phones ---------- */
@media (max-width: 600px) {
  .den-inner { gap: 16px; padding-bottom: 34px; }
  .portrait { padding: 6px 6px 4px; box-shadow: 0 0 0 4px #3a2614, 0 10px 18px rgba(0, 0, 0, .45); }
  .portrait-frame img { width: 78px; }
  .portrait figcaption { font-size: 12px; }
  .den-sign { padding: 12px 14px 14px; }
  .den-kicker { font-size: 17px; }
  .den-sign h1 { font-size: 27px; }
  .den-note { font-size: 12px; }
  .card-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
