/* home.css — the lobby: the slogan, three offers, the games row, the rewards, the day's pulls.
 *
 * Hallmark · pre-emit critique: P4 H5 E4 S4 R5 V4
 *
 * Built on the house tokens (app.css, obsidian.css, polish.css, surface.css). The values below
 * are the house gold at other alphas, plus Discord's own blue at low alpha for the one banner
 * that opens Discord: the same exception app.css makes for the Discord button. Named here so
 * nothing further down is a raw colour.
 *
 * Linked after every game sheet and before mobile.css: it settles the home view's own pieces,
 * and mobile.css still settles the shell (header, tab bar, chat drawer) around them. */

:root {
  --home-wash:    rgba(255, 170, 0, .14);   /* behind a perk's icon                              */
  --home-wash-hi: rgba(255, 190, 40, .30);  /* behind banner and card art                        */
  --home-ring:    rgba(255, 170, 0, .2);    /* the search field's focus halo                     */
  --home-dc-wash: rgba(88, 101, 242, .22);  /* --discord, faint, behind the Discord banner's art */
  --home-dc-glow: rgba(88, 101, 242, .5);
  --home-on-dc:   #fff;                     /* 4.61:1 on --discord, measured in app.css          */
  --home-shade:   rgba(0, 0, 0, .55);       /* drop shadows, and the shade under a card's name   */
  --home-smoke:   rgba(0, 0, 0, .35);       /* the "Explore games" button, at rest and lit       */
  --home-smoke-hi: rgba(0, 0, 0, .5);
}

/* ── the page head ── the slogan, one line */
.hintro { margin: 2px 2px 14px; }
.hintro__h {
  margin: 0; min-width: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem); line-height: 1.15; letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.hintro__h em { font-style: normal; color: var(--gold-bright); }

/* ── the offers ──
 *
 * Three banners, sized off their own width rather than the window's, since the chat rail takes a
 * share of a laptop screen: three across when there is room, the lead over the other two when
 * there is not, and on a phone the two small ones drop their art and their line. */
.pbans { container-type: inline-size; }
.pbans__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@container (min-width: 560px) {
  .pbans__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pban--lead { grid-column: 1 / -1; }
}
@container (min-width: 860px) {
  .pbans__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pban--lead { grid-column: auto; }
}

.pban {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; min-width: 0; min-height: 184px;
  padding: 20px 22px;
  border: 1px solid var(--ob-line); border-radius: var(--r-panel);
  background:
    radial-gradient(60% 85% at 86% 50%, var(--home-wash), transparent 70%),
    linear-gradient(150deg, var(--panel2), var(--panel) 62%, var(--bg2));
  color: var(--text);
  transition:
    transform .18s var(--ob-ease),
    border-color .18s var(--ob-ease),
    box-shadow .18s var(--ob-ease);
}
/* The lead is lit in lava: the one banner meant to be seen first. */
.pban--lead {
  border-color: var(--gold-edge);
  background:
    radial-gradient(60% 90% at 84% 50%, var(--home-wash-hi), transparent 70%),
    var(--mat-lava);
}
.pban--discord {
  background:
    radial-gradient(55% 85% at 86% 50%, var(--home-dc-wash), transparent 70%),
    linear-gradient(150deg, var(--panel2), var(--panel) 62%, var(--bg2));
}

.pban__copy {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-width: 0; max-width: 64%;
}
.pban__eyebrow {
  font: 700 .6875rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-body);
}
.pban__h {
  font-family: var(--pixel); font-weight: 900;
  font-size: 1.5rem; line-height: 1.1; letter-spacing: -.02em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.pban__h b { color: var(--gold-bright); }
.pban__p { font-size: .8125rem; line-height: 1.45; color: var(--muted); }
/* The buttons are part of the banner's one link, so they light with the banner, not on their own. */
.pban__btn { margin-top: auto; min-height: 40px; }
.pban__btn--dc {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: var(--r-s);
  background: var(--discord); color: var(--home-on-dc);
  font: 700 .875rem/1 var(--body); white-space: nowrap;
  transition: background var(--ob-quick);
}
.pban:hover .pban__btn--dc { background: var(--discord-hi); }

.pban__art {
  position: absolute; z-index: 0;
  right: 16px; top: 50%;
  width: 112px; height: 112px;
  object-fit: contain; image-rendering: pixelated;
  transform: translateY(-50%) rotate(-8deg);
  filter: drop-shadow(0 14px 18px var(--home-shade));
  transition: transform .3s var(--ob-ease);
}
.pban__art--dc {
  width: 92px; height: 92px; right: 22px;
  fill: var(--discord);
  transform: translateY(-50%);
  filter: drop-shadow(0 0 22px var(--home-dc-glow));
}

.pban:hover { transform: var(--ob-lift); border-color: var(--ob-line-hi); box-shadow: var(--ob-glow); }
.pban:hover .pban__art { transform: translateY(-54%) rotate(-3deg) scale(1.06); }
.pban:hover .pban__art--dc { transform: translateY(-54%) scale(1.06); }
.pban:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.pban:active { transform: translateY(-1px) scale(.995); transition-duration: .06s; }

/* The lead carries two actions, so it is laid out differently from the other two banners: the
 * art moves to the top corner and the buttons take a full-width row along the bottom.
 *
 * The cover link sits over the card (z 1) and under the buttons (z 2), so a click anywhere but
 * "Explore games" does the main action. The copy is positioned without a z-index on purpose: a
 * z-index there would make it a stacking context, and the buttons inside it could not rise
 * above the cover. */
.pban__cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.pban--lead .pban__copy { z-index: auto; max-width: none; width: 100%; }
.pban--lead .pban__eyebrow,
.pban--lead .pban__h,
.pban--lead .pban__p { max-width: 64%; }
.pban--lead .pban__art { top: 18px; width: 100px; height: 100px; transform: rotate(-8deg); }
.pban--lead:hover .pban__art { transform: translateY(-4px) rotate(-3deg) scale(1.06); }

.pban__acts { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.pban__acts .pban__btn { position: relative; z-index: 2; margin-top: 0; }
/* .btn sets display, which would otherwise beat the hidden attribute on the signed-in Log in. */
.pban__acts .pban__btn[hidden] { display: none; }
.pban__acts .pban__btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.pban__more {
  background: var(--home-smoke);
  border-color: var(--gold-edge);
  color: var(--text);
  font-weight: 700;
}
.pban__more:hover { background: var(--home-smoke-hi); border-color: var(--gold-edge-hi); }

/* A phone: the lead keeps everything at a smaller size; the other two become a pair of compact
   cards, eyebrow, heading and button, with their art and their line left to the pages they open. */
@container (max-width: 559px) {
  .pbans__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pban { min-height: 0; padding: 14px 12px; }
  .pban__h { font-size: 1.0625rem; }
  .pban__btn { min-height: 44px; }
  .pban--lead { grid-column: 1 / -1; padding: 16px; }
  .pban--lead .pban__eyebrow,
  .pban--lead .pban__h,
  .pban--lead .pban__p { max-width: 70%; }
  .pban--lead .pban__h { font-size: 1.375rem; }
  .pban--lead .pban__art { top: 14px; width: 72px; height: 72px; right: 12px; }
  .pban__acts .pban__btn { flex: 1 1 auto; }
  .pban:not(.pban--lead) .pban__copy { max-width: none; width: 100%; }
  .pban:not(.pban--lead) .pban__p,
  .pban:not(.pban--lead) .pban__art { display: none; }
  .pban:not(.pban--lead) .pban__btn { width: 100%; padding-inline: 8px; font-size: .8125rem; }
}

/* ── section heads ── the Rewards head keeps the gold tick of the "Biggest pulls" card head;
   the games row has the brand chest in its place. */
.lobby__h {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 1.125rem; letter-spacing: -.01em;
  margin: 0;
}
.lobby__h::before {
  content: ""; width: 3px; height: 16px; border-radius: 4px; flex: none;
  background: linear-gradient(180deg, var(--gold-body), transparent);
}
.lobby .lobby__h::before { content: none; }
.lobby__h img { width: 22px; height: 22px; flex: none; image-rendering: pixelated; }

/* ── the lobby ──
 *
 * Search, one tab strip, then the row: the order the big lobbies use, because it is the order a
 * player looks for a game in — by name if they know it, by kind if they do not, by eye otherwise. */
.lobby { margin-top: 24px; container-type: inline-size; }
/* Focused by "Explore games" so a keyboard carries on from the lobby; it is not a control. */
.lobby:focus { outline: none; }

.lobby__search { position: relative; display: flex; min-width: 0; margin-bottom: 12px; }
.lobby__search svg {
  position: absolute; left: 18px; top: 50%;
  width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.lobby__search input {
  width: 100%; min-width: 0; min-height: 48px;
  padding: 0 18px 0 48px;
  border: 1px solid var(--ob-line); border-radius: 999px;
  background: var(--bg2);
  color: var(--text);
  font: 500 1rem var(--body);           /* 16px, or iOS zooms the page in on focus */
  outline: none;
  transition: border-color var(--ob-quick), box-shadow var(--ob-quick);
}
.lobby__search input::placeholder { color: var(--faint); }
.lobby__search input:hover { border-color: var(--ob-line-hi); }
.lobby__search input:focus-visible { border-color: var(--gold-body); box-shadow: 0 0 0 3px var(--home-ring); }

.lobby__tabs {
  display: flex; gap: 4px;
  width: max-content; max-width: 100%;
  padding: 4px; margin-bottom: 20px;
  border: 1px solid var(--ob-line); border-radius: 999px;
  background: var(--bg2);
}
.lobby__tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: none; color: var(--muted);
  font: 700 .875rem/1 var(--body); white-space: nowrap;
  cursor: pointer;
  transition: color var(--ob-quick), background var(--ob-quick);
}
.lobby__tab svg {
  flex: none; width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.lobby__tab .lobby__dot { fill: currentColor; stroke: none; }
.lobby__tab:hover { color: var(--text); background: var(--panel2); }
.lobby__tab:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.lobby__tab:active { transform: translateY(1px); }
.lobby__tab[aria-pressed="true"] {
  color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-body));
}

.lobby__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.lobby__arrows { display: flex; gap: 6px; flex: none; }
.lobby__arrow {
  width: 40px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--ob-line); border-radius: var(--r-soft);
  background: var(--panel); color: var(--text);
  cursor: pointer;
  transition: background var(--ob-quick), border-color var(--ob-quick), opacity var(--ob-quick);
}
.lobby__arrow svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.lobby__arrow:hover:not(:disabled) { background: var(--panel2); border-color: var(--ob-line-hi); }
.lobby__arrow:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.lobby__arrow:active:not(:disabled) { transform: translateY(1px); }
.lobby__arrow:disabled { opacity: .35; cursor: default; }

/* The row. A fraction of the next card always shows at the right edge, which is what says "there
 * is more this way" before anyone finds the arrows. Snaps card by card when swiped. The vertical
 * padding (taken back by the negative margin) is room for a card's hover lift, which an overflow
 * container would otherwise clip; the focus ring is drawn inside the card for the same reason, so
 * the row needs no side padding and lines up with the banners above it. */
.lobby__track {
  list-style: none;
  margin: -8px 0 -10px; padding: 8px 0 10px;
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3 * 10px) / 3.3);
  gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.lobby__track::-webkit-scrollbar { display: none; }
.lobby__track[hidden] { display: none; }
/* The narrowest phones: two and a half cards, so a name like UPGRADER still fits on one line. */
@container (max-width: 339px) {
  .lobby__track { grid-auto-columns: calc((100% - 2 * 10px) / 2.6); }
}
@container (min-width: 480px) {
  .lobby__track { gap: 12px; grid-auto-columns: calc((100% - 4 * 12px) / 4.3); }
}
@container (min-width: 700px) {
  .lobby__track { grid-auto-columns: calc((100% - 5 * 12px) / 5.3); }
}
@container (min-width: 960px) {
  .lobby__track { grid-auto-columns: calc((100% - 6 * 12px) / 6.4); }
}
/* Each slot is a size container, so a card's name is set from the card's own width: a long name
 * like COINFLIP fits an 81px phone card on one line instead of breaking mid-word. */
.lobby__track > li { display: flex; min-width: 0; scroll-snap-align: start; container-type: inline-size; }
.lobby__track > li[hidden] { display: none; }

/* The card. Portrait, the item large in the upper half, the name set big at the foot. One
 * material for all ten, lava gold on the pixel grid. */
.gcard {
  position: relative; isolation: isolate; overflow: hidden;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  aspect-ratio: 3 / 4;
  padding: 10px 8px 14px;
  border: 1px solid var(--gold-edge); border-radius: var(--r-panel);
  background:
    radial-gradient(85% 55% at 50% 36%, var(--home-wash-hi), transparent 72%),
    var(--mat-lava);
  color: var(--text); text-align: center;
  transition:
    transform .2s var(--ob-ease),
    border-color .2s var(--ob-ease),
    box-shadow .2s var(--ob-ease);
}
.gcard::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: var(--grid);
}
.gcard::after {
  content: ""; position: absolute; inset: 50% 0 0; z-index: -1;
  background: linear-gradient(180deg, transparent, var(--home-shade));
}
.gcard__art {
  position: absolute; top: 13%; left: 50%;
  width: 54%; height: auto; aspect-ratio: 1;
  object-fit: contain; image-rendering: pixelated;
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 14px var(--home-shade)) drop-shadow(0 0 18px var(--home-wash-hi));
  transition: transform .25s var(--ob-ease);
}
.gcard__name {
  font-family: var(--pixel); font-weight: 900;
  font-size: clamp(.6875rem, 11cqi, 1.0625rem); line-height: 1.05; letter-spacing: .01em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 var(--home-shade);
  overflow-wrap: anywhere;
}
.gcard__brand {
  margin-top: 5px;
  font: 700 .625rem/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-body);
}
.gcard__badge {
  position: absolute; top: 8px; left: 8px;
  padding: 4px 7px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-body));
  color: var(--gold-ink);
  font: 800 .625rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.gcard__badge[hidden] { display: none; }
.gcard:hover { transform: translateY(-4px); border-color: var(--gold-edge-hi); box-shadow: var(--ember-hi); }
.gcard:hover .gcard__art { transform: translateX(-50%) translateY(-4px) scale(1.08); }
.gcard:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -3px; }
.gcard:active { transform: translateY(-2px) scale(.98); transition-duration: .06s; }

/* Nothing matched: say so where the row was, and give the way back. */
.lobby__none {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px 16px;
  border: 1px dashed var(--ob-line); border-radius: var(--r-panel);
  color: var(--muted); text-align: center;
}
.lobby__none[hidden] { display: none; }
.lobby__none p { margin: 0; }

/* A narrow lobby: the four tabs share the width evenly, and below 400px they drop their icons
   rather than their words. */
@container (max-width: 559px) {
  .lobby__tabs { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lobby__tab { min-height: 44px; padding: 0 6px; gap: 6px; font-size: .8125rem; }
  .lobby__tab svg { width: 16px; height: 16px; }
  .gcard { padding: 8px 6px 12px; }
  .gcard__brand { font-size: .5625rem; letter-spacing: .18em; }
}
@container (max-width: 399px) {
  .lobby__tab svg { display: none; }
}

/* ── rewards ── */
.perks { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.perks__row {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.perks__row > li { display: flex; min-width: 0; }
.perk {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 12px 14px;
  border: 1px solid var(--ob-line); border-radius: var(--r-panel);
  background: linear-gradient(140deg, var(--panel2), var(--panel));
  color: var(--text);
  transition:
    transform .18s var(--ob-ease),
    border-color .18s var(--ob-ease),
    box-shadow .18s var(--ob-ease);
}
.perk__ico {
  flex: none; width: 40px; height: 40px; padding: 9px;
  border-radius: var(--r-soft);
  background: var(--home-wash);
  fill: none; stroke: var(--gold-body); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.perk__copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perk__copy b { font-family: var(--pixel); font-weight: 800; font-size: .9375rem; color: var(--text); }
.perk__copy span { font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.perk__go {
  flex: none; margin-left: auto; width: 18px; height: 18px;
  fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--ob-quick), stroke var(--ob-quick);
}
.perk:hover { transform: var(--ob-lift); border-color: var(--ob-line-hi); box-shadow: var(--ob-glow); }
.perk:hover .perk__go { stroke: var(--gold-body); transform: translateX(2px); }
.perk:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.perk:active { transform: translateY(-1px) scale(.995); transition-duration: .06s; }

/* The empty "Biggest pulls" row is a list item, so it took the three-column row grid and set its
   sentence in the 34px icon column, one word per line. */
.drops li.drops__empty { display: block; }

@media (max-width: 900px) {
  .perks__row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* A finger, at any width: every control at least 44px. */
@media (pointer: coarse) {
  .lobby__tab, .pban__btn { min-height: 44px; }
  .lobby__arrow { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .gcard, .gcard__art, .perk, .perk__go, .lobby__tab, .pban, .pban__art { transition: none; }
  .gcard:hover, .gcard:active, .perk:hover, .perk:active, .pban:hover, .pban:active { transform: none; }
  .gcard:hover .gcard__art { transform: translateX(-50%); }
  .perk:hover .perk__go { transform: none; }
  .pban:hover .pban__art { transform: translateY(-50%) rotate(-8deg); }
  .pban--lead:hover .pban__art { transform: rotate(-8deg); }
  .pban:hover .pban__art--dc { transform: translateY(-50%); }
}
