/* Arcade discovery page. Tokens, .wrap/.btn/.cards/.gcard/.badge/.empty-state
   all come from site.css — only arcade-specific surfaces live here. Dark-first. */

/* The `hidden` ATTRIBUTE loses to any `display` declaration, and every element
   this page toggles (#acStats, #acToolbar, #acFilters, #acClear, #grid) sets
   one. The `[hidden] { display: none !important }` rule that makes that work
   lives in site.css — do not add a `display` here that assumes otherwise. */

.ac-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* —— Page head —— */
.ac-head-in {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
}
.ac-head-in .eyebrow { margin-bottom: 14px; }
.ac-head-in p { max-width: 40em; }
.ac-proof {
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-faint);
}
.ac-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 550;
  padding-bottom: 6px;
  flex-wrap: wrap;
}
.ac-stats b {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* —— Your games (signed-in author only) ——
   Quiet on purpose. The arcade is a discovery page; this is context, and it must
   not out-shout the featured game directly beneath it. One rule, no fill — the
   only colour is the unlisted count and the link. */
.ac-mine {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-faint);
}
.ac-mine-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-soft);
}
/* Matches .badge.unlisted in site.css — one colour for this idea site-wide. */
.ac-mine-un { color: var(--amber); font-weight: 600; }
.ac-mine-go {
  /* The row's only control, sitting among plain text: it carries its own 24px
     target rather than leaning on the WCAG 2.2 inline-link exception. */
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: auto;
  font-weight: 600;
  color: var(--accent);
}
.ac-mine-go:hover { color: var(--accent-press); text-decoration: underline; }

/* —— Featured —— */
.ac-featured { margin-top: 28px; }
.ac-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--card);
  transition: border-color 0.15s ease;
}
.ac-hero:hover { border-color: var(--line-2); }
.ac-hero:focus-within { border-color: var(--accent-line); }
.ac-hero-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0a0b0e;
}
.ac-hero-media img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ac-hero-media .play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ac-hero:hover .ac-hero-media .play,
.ac-hero-media:focus-visible .play { opacity: 1; }
@media (hover: none) {
  .ac-hero-media .play { opacity: 1; background: rgba(0, 0, 0, 0.2); }
}
.ac-hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-weight: 750;
  font-size: clamp(19px, 2.6vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: rgba(255, 255, 255, 0.9);
}
.ac-hero-body {
  border-left: 1px solid var(--line);
  padding: 26px 26px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}
/* .eyebrow is inline-flex, but a flex column stretches it edge-to-edge. */
.ac-hero-body .eyebrow { align-self: flex-start; }
.ac-hero-body h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.ac-hero-by { font-size: 13.5px; color: var(--text-soft); }
.ac-hero-desc {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ac-hero-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-faint);
  font-weight: 550;
}
.ac-hero-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.ac-hero-cta .btn { position: relative; z-index: 2; }

/* —— Toolbar —— */
.ac-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 30px;
}
.ac-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 280px;
  min-width: 0;
}
.ac-search .ac-ico {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.ac-search input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-control);
  border-radius: var(--r-md);
  padding: 10px 38px 10px 36px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.ac-search input::placeholder { color: var(--text-faint); }
.ac-search input:hover { border-color: var(--line-2); }
.ac-search input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.ac-search input::-webkit-search-cancel-button,
.ac-search input::-webkit-search-decoration { -webkit-appearance: none; }
.ac-clear {
  position: absolute;
  right: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 1;
}
.ac-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.ac-clear svg { width: 14px; height: 14px; }

.ac-sort { position: relative; display: flex; align-items: center; flex: 0 0 auto; }
.ac-sort select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px 15px;
  border: 1px solid var(--line-control);
  border-radius: var(--r-md);
  padding: 10px 32px 10px 13px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease;
}
.ac-sort select:hover { border-color: var(--line-2); }
.ac-sort select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ac-sort select option { background: var(--card); color: var(--text); }

/* —— Filter chips —— */
.ac-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.ac-chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ac-chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}
.ac-chip[aria-pressed="true"] {
  background: var(--accent-bg);
  border-color: var(--accent-line);
  color: var(--accent);
}
.ac-chip .n {
  font-weight: 550;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.ac-chip[aria-pressed="true"] .n { color: var(--accent); opacity: 0.72; }
.ac-chip svg { width: 12px; height: 12px; }
.ac-chip-sep {
  width: 1px;
  height: 20px;
  background: var(--line-2);
  margin: 0 4px;
  flex: none;
}

/* —— Status line —— */
.ac-status {
  margin-top: 20px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-faint);
  min-height: 20px;
}
/* Script-managed focus target (tabindex -1): a control that erases itself —
   Retry, Clear filters, a card tag pill — hands focus here so the next Tab
   resumes from the results rather than from the top of the document. */
.ac-status:focus { outline: none; }
.ac-status:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 4px;
  border-radius: 4px;
}

/* —— Grid + cards —— */
.ac-grid { margin-top: 10px; }
.ac-tail { height: 80px; }

.ac-card {
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: default;
}
.ac-card:focus-within { border-color: var(--accent-line); }
.ac-stretch {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
/* The stretched link fills the card's padding box, and .gcard is
   `overflow: hidden` — so site.css's default `outline-offset: 2px` draws the
   focus ring OUTSIDE the clip and it vanishes entirely. Keyboard users got no
   focus indicator on any card. Inset it instead (site.css does the same for
   .gcard-link::after, for the same reason). */
.ac-stretch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  border-radius: var(--r-lg);
}
.ac-card .thumb,
.ac-card .body { position: relative; }
/* Thumb layers: label (0) under image (1) under the hover play overlay (3).
   All three are click-through so the stretched card link stays the hit target. */
.ac-card .thumb img,
.ac-card .thumb .ac-thumb-label,
.ac-card .thumb .play { pointer-events: none; }
.ac-card .thumb img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ac-card .thumb .ac-thumb-label {
  position: relative;
  z-index: 0;
  color: rgba(255, 255, 255, 0.86);
}
.ac-card .thumb .play { z-index: 3; }

/* On touch the play affordance is permanently visible (site.css forces
   opacity:1 under hover:none), so a CENTERED button lands straight on top of
   the fallback title of any game without a thumbnail. Move it to the corner
   and drop the scrim so the title stays readable. Ordered after site.css, so
   equal-specificity rules here win. */
@media (hover: none) {
  .ac-card .thumb .play,
  .ac-hero-media .play {
    place-items: end;
    padding: 10px;
    background: transparent;
  }
  .ac-card .thumb .pbtn,
  .ac-hero-media .pbtn { width: 38px; height: 38px; }
}
.ac-card .body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.ac-card .title { margin: 0; font-size: 14px; }
.ac-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ac-from { font-size: 11.5px; color: var(--text-faint); font-weight: 550; }
.ac-from b { color: var(--text-soft); font-weight: 600; }
.ac-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.ac-tag {
  position: relative;
  z-index: 2;
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-soft);
  cursor: pointer;
  line-height: 1.2;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.ac-tag:hover { color: var(--text); border-color: var(--line-2); }
/* These sit inside a card that is otherwise one big link, so they need a real
   target: 24px is the WCAG 2.2 AA minimum, coarse pointers get more. */
.ac-tag { min-height: 24px; align-items: center; display: inline-flex; }
@media (pointer: coarse) {
  .ac-tag { min-height: 30px; padding: 5px 11px; }
}
.ac-card .meta { margin-top: auto; padding-top: 2px; }
/* The author link overlaps the stretched card link, so the WCAG 2.2 spacing
   exception can't rescue it — it has to carry its own 24px target (2.5.8). */
.ac-author {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}
.ac-author:hover { color: var(--text); text-decoration: underline; }
.ac-card time { color: inherit; }

/* —— Loading skeletons —— */
.ac-skel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.ac-skel .sk-thumb { aspect-ratio: 16 / 10; background: var(--card-2); }
.ac-skel .sk-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ac-skel .sk-line { height: 10px; border-radius: 6px; background: var(--card-2); }
.ac-skel .sk-line.w70 { width: 70%; }
.ac-skel .sk-line.w45 { width: 45%; }
.ac-shimmer { position: relative; overflow: hidden; }
.ac-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
  animation: ac-sweep 1.4s ease-in-out infinite;
}
@keyframes ac-sweep { to { transform: translateX(100%); } }

/* —— Empty / error —— */
.ac-empty { margin-top: 4px; }
.ac-empty .empty-state { margin-top: 8px; }
.ac-empty .btn { cursor: pointer; }
.ac-how {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 40em;
  margin: 0 auto 22px;
  text-align: left;
}
.ac-how li {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.4;
}
.ac-how b {
  display: block;
  color: var(--text);
  font-weight: 650;
  margin-bottom: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ac-shimmer::after { animation: none; }
  .ac-hero,
  .ac-chip,
  .ac-tag,
  .ac-author,
  .ac-search input,
  .ac-sort select { transition: none; }
  /* .gcard / .gcard .thumb .play transitions come from site.css; kill them for
     the surfaces this page owns (site.css has no reduced-motion block at all). */
  .ac-card,
  .ac-card .thumb .play,
  .ac-hero-media .play,
  .ac-empty .btn { transition: none; }
}

@media (max-width: 900px) {
  .ac-hero { grid-template-columns: 1fr; }
  .ac-hero-body { border-left: 0; border-top: 1px solid var(--line); padding: 20px; }
  .ac-hero-media { aspect-ratio: 16 / 8; }
}
@media (max-width: 560px) {
  .ac-head-in { align-items: flex-start; }
  .ac-stats { padding-bottom: 0; gap: 16px; }
  /* Once the row wraps, `margin-left:auto` strands the link hard-right on its
     own line. Give it the full row instead. */
  .ac-mine { gap: 6px 12px; }
  .ac-mine-go { margin-left: 0; flex-basis: 100%; }
  .ac-toolbar { margin-top: 24px; }
  .ac-search { flex: 1 1 100%; }
  .ac-sort { flex: 1 1 100%; }
  .ac-sort select { width: 100%; }
  .ac-hero-media { aspect-ratio: 16 / 10; }
  .ac-how { grid-template-columns: 1fr; }
}
.ac-mine-section { padding: 0; border: 0; }
.ac-mine-manage { margin: 14px 0 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.ac-mine-manage summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.ac-mine-game { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.ac-mine-game:first-of-type { margin-top: 14px; }
.ac-mine-game > a { flex: 1; min-width: 120px; color: var(--text); overflow-wrap: anywhere; }
.ac-mine-game > span { font-size: 12px; color: var(--text-faint); }
.ac-mine-manage > p { color: var(--text-soft); font-size: 14px; }
