/* site.css — shared styles for the static marketing/content pages (/, /how-to-play/, /cards/).
   The game app has its own stylesheet (src/client/styles.css); keep the two independent.
   These pages practice what the a11y audit preached: rem sizes, :focus-visible, reduced motion. */

:root {
  --bg: #0e1014;
  --panel: #171b22;
  --panel-2: #1f2530;
  --ink: #e8edf2;
  --muted: #a6b0c0;
  --green: #46e3a0;
  --gold: #e0a13c;
  --red: #e36a6a;
  --line: #2a3140;
  --maxw: 68rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  /* Night-city ambience: faint faction-glow pools over the base dark. */
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(70, 227, 160, 0.07), transparent 60%),
    radial-gradient(50rem 35rem at -10% 30%, rgba(224, 161, 60, 0.06), transparent 60%),
    radial-gradient(40rem 30rem at 60% 100%, rgba(232, 73, 29, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 10;
  background: var(--green); color: #04130c; padding: 0.5rem 1rem; font-weight: 700;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

a { color: var(--green); }
a:hover { color: #6fe9b6; }

h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* --- header / footer chrome --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 16, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: 0.06em;
}
.brand img { width: 2rem; height: 2rem; }
.site-nav { display: flex; gap: 0.25rem 1.25rem; flex-wrap: wrap; align-items: center; margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 0.75rem 0.5rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--green); }
.nav-cta { padding: 0.65rem 1.25rem; }

/* --- mobile header: tight brand + CTA row, scrollable pill nav below --- */
@media (max-width: 45rem) {
  .site-header { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
  .site-header .wrap { padding-top: 0.45rem; padding-bottom: 0.4rem; gap: 0 0.75rem; }
  .brand { font-size: 0.9rem; gap: 0.45rem; }
  .brand img { width: 1.5rem; height: 1.5rem; }
  .nav-cta {
    margin-left: auto; font-size: 0.78rem; padding: 0.5rem 0.9rem;
    box-shadow: 0 0 14px rgba(70, 227, 160, 0.3), 0 3px 10px rgba(0, 0, 0, 0.4);
  }
  .site-nav {
    order: 3; flex-basis: 100%; margin-left: 0;
    flex-wrap: nowrap; overflow-x: auto; gap: 0.4rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding: 0.3rem 0.1rem 0.45rem;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a {
    white-space: nowrap; flex-shrink: 0;
    background: rgba(31, 37, 48, 0.55); border: 1px solid var(--line); border-radius: 999px;
    padding: 0.44rem 0.9rem; font-size: 0.82rem; font-weight: 600; color: var(--muted);
  }
  .site-nav a:hover { color: var(--ink); }
  .site-nav a[aria-current="page"] {
    background: linear-gradient(160deg, #5aeab0, var(--green));
    border-color: transparent; color: #04130c; font-weight: 800;
  }
}

.btn {
  display: inline-block; padding: 0.85rem 1.6rem; border-radius: 0.6rem;
  font-weight: 800; letter-spacing: 0.06em; text-decoration: none; text-align: center;
  text-transform: uppercase; border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: linear-gradient(160deg, #5aeab0, var(--green) 55%, #2fbf82);
  color: #04130c;
  box-shadow: 0 0 22px rgba(70, 227, 160, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
}
.btn-primary:hover {
  color: #04130c;
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(70, 227, 160, 0.55), 0 8px 20px rgba(0, 0, 0, 0.5);
}
.btn-ghost { border-color: var(--line); color: var(--ink); background: rgba(31, 37, 48, 0.5); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); box-shadow: 0 0 18px rgba(70, 227, 160, 0.2); }
.btn-big { font-size: 1.1rem; padding: 1.05rem 2.3rem; }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 27, 34, 0.55), rgba(10, 12, 16, 0.9));
  padding: 2.75rem 0 2rem;
  color: var(--muted); font-size: 0.9rem;
}
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; }
.foot-brand .brand { font-size: 0.95rem; }
.foot-brand p { margin: 0.8rem 0 1.1rem; max-width: 17rem; line-height: 1.5; }
.foot-brand .btn { padding: 0.6rem 1.2rem; font-size: 0.82rem; }
.foot-col { display: flex; flex-direction: column; }
.fc-h {
  color: var(--gold); font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.45rem;
}
.foot-col a { color: var(--muted); text-decoration: none; padding: 0.34rem 0; }
.foot-col a:hover { color: var(--green); }
.lang-nav {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  font-size: 0.82rem;
}
.lang-nav a, .lang-nav span[aria-current] {
  color: var(--muted); text-decoration: none;
  background: rgba(31, 37, 48, 0.6); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.42rem 0.9rem;
}
.lang-nav a:hover { color: var(--green); border-color: var(--green); }
.lang-nav span[aria-current] { color: var(--green); border-color: var(--green); font-weight: 700; }
.foot-legal { margin: 1.75rem 0 0; font-size: 0.8rem; color: #8b95a6; }

@media (max-width: 45rem) {
  .foot-grid { grid-template-columns: repeat(2, 1fr); gap: 1.9rem 1rem; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-col a { padding: 0.45rem 0; }
}

/* breadcrumbs: one line, scroll instead of wrap on narrow screens */
@media (max-width: 45rem) {
  .crumbs { white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
  .crumbs::-webkit-scrollbar { display: none; }
}

/* --- hero --- */
.hero {
  position: relative;
  padding: 4.5rem 0 3rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  /* Full-bleed night-street art under a heavy scrim — text zones stay AA-safe. */
  background:
    linear-gradient(100deg, rgba(14, 16, 20, 0.97) 0%, rgba(14, 16, 20, 0.88) 45%, rgba(14, 16, 20, 0.62) 100%),
    url("/art/rk_nightly_blaze.jpg") center 30% / cover no-repeat;
}
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2.5rem; align-items: center; position: relative; }
.hero h1 {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 900;
  text-wrap: balance;
  background: linear-gradient(175deg, #f6e8cf 20%, var(--gold) 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 14px rgba(0, 0, 0, 0.75));
}
.hero p.lead { font-size: 1.15rem; color: var(--ink); max-width: 34rem; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.hero-ctas { display: flex; gap: 0.9rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero-note { color: var(--muted); font-size: 0.9rem; margin-top: 0.9rem; }
.kicker {
  color: var(--gold); font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; font-size: 0.8rem; margin-bottom: 0.6rem;
}
.hero .kicker { color: var(--green); text-shadow: 0 0 14px rgba(70, 227, 160, 0.5); }

/* Fan of faction faces — one character card per crew; the game's faces sell the click.
   Tall poster-strip crop is intentional: square art clipped at the sides, faces centered. */
.hero-fan { position: relative; display: flex; justify-content: center; align-items: flex-end; padding: 1.5rem 0 2.25rem; }
.hero-fan img {
  width: clamp(6rem, 9vw, 9.5rem);
  height: clamp(20rem, 30vw, 32rem);
  object-fit: cover;
  /* Tall strip crops the sides; keep the face's x centered (from the art focus map). */
  object-position: var(--ax, 50%) 50%;
  border-radius: 0.7rem;
  border: 1px solid rgba(224, 161, 60, 0.45);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65), 0 0 22px rgba(224, 161, 60, 0.12);
  margin: 0 -1.1rem;
  transform: rotate(var(--r, 0deg)) translateY(var(--y, 0));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-fan img:hover {
  transform: rotate(0deg) translateY(-0.8rem) scale(1.05);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.7), 0 0 30px rgba(224, 161, 60, 0.3);
  z-index: 3;
}
.hero-fan img:nth-child(1) { --r: -15deg; --y: 2.1rem; }
.hero-fan img:nth-child(2) { --r: -9deg; --y: 0.85rem; z-index: 1; }
.hero-fan img:nth-child(3) { --r: -3deg; --y: 0.1rem; z-index: 2; }
.hero-fan img:nth-child(4) { --r: 3deg; --y: 0.1rem; z-index: 2; }
.hero-fan img:nth-child(5) { --r: 9deg; --y: 0.85rem; z-index: 1; }
.hero-fan img:nth-child(6) { --r: 15deg; --y: 2.1rem; }
@media (max-width: 50rem) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero { background-position: 70% 30%; }
  .hero-fan { padding-top: 0.5rem; }
  .hero-fan img { width: clamp(3.4rem, 13vw, 7rem); height: clamp(11.5rem, 44vw, 24rem); margin: 0 -0.7rem; }
}

/* --- stats band --- */
.stats-band { border-block: 1px solid var(--line); background: rgba(23, 27, 34, 0.75); }
.stats-band .wrap { display: flex; justify-content: space-around; gap: 1rem 2rem; flex-wrap: wrap; padding-top: 1.4rem; padding-bottom: 1.4rem; }
.stat { text-align: center; min-width: 7rem; }
.stat .n { display: block; font-size: 2rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 18px rgba(224, 161, 60, 0.35); line-height: 1.15; }
.stat .l { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }

/* --- sections + cards --- */
.section { padding: 1.5rem 0; }
.section-alt { background: var(--panel); border-block: 1px solid var(--line); }
.grid { display: grid; gap: 1rem; margin-top: 1.25rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 56rem) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 38rem) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.tile {
  background: linear-gradient(170deg, #232a37, var(--panel-2) 60%);
  border: 1px solid var(--line);
  border-radius: 0.8rem; padding: 1.25rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-3px); border-color: #3a4456; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); }
.tile h3 { color: var(--gold); }
.tile p { margin: 0; color: var(--muted); }
.tile .big { color: var(--ink); font-weight: 700; }

.faction { border-top: 3px solid var(--fc, var(--gold)); }
/* Headings use the text-safe tint (--fct); the saturated faction color stays on the border. */
.faction h3 { color: var(--fct, var(--gold)); }
.faction:hover { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 24px color-mix(in srgb, var(--fc, #e0a13c) 22%, transparent); }

/* Art-backed faction tiles: card art on top, text over a near-solid scrim below. */
.art-tile { position: relative; overflow: hidden; padding: 0; }
.art-tile .ft-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--ax, 50%) var(--ay, 18%);
  transition: transform 0.25s ease;
}
.art-tile:hover .ft-art { transform: scale(1.05); }
.art-tile .ft-body {
  position: relative;
  padding: 7.5rem 1.25rem 1.25rem;
  background: linear-gradient(180deg, rgba(14, 16, 20, 0) 0%, rgba(14, 16, 20, 0.88) 32%, rgba(16, 19, 25, 0.96) 48%);
}
.art-tile .ft-body h3 { margin-top: 0; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9); }

/* Faction-page art hero */
.art-hero { background-size: cover; background-position: center 22%; border-bottom: 1px solid var(--line); }
.art-hero .wrap { padding-top: 4.5rem; padding-bottom: 2.5rem; }
.art-hero h1, .art-hero .lead { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85); }

/* --- FAQ --- */
.faq details {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 0.6rem; margin-top: 0.6rem; padding: 0;
}
.faq summary {
  cursor: pointer; font-weight: 700; padding: 0.9rem 1.1rem; list-style-position: inside;
}
.faq summary:hover { color: var(--green); }
.faq details > p { margin: 0; padding: 0 1.1rem 1rem; color: var(--muted); }

/* --- how-to-play --- */
.rule-block { margin-top: 1.25rem; }
.rule-block h3 { color: var(--gold); font-size: 1.15rem; }
.steps { counter-reset: step; padding-left: 0; margin: 1rem 0 0; list-style: none; }
.steps li { counter-increment: step; margin: 0.8rem 0; padding-left: 2.6rem; position: relative; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0.1rem;
  width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--green); color: #04130c;
  font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
table.loc-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.loc-table th, .loc-table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.loc-table thead th { color: var(--gold); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.loc-table tbody th { color: var(--ink); font-weight: 700; white-space: nowrap; }
.loc-table td { color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* --- cards gallery --- */
.cg-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); margin-top: 1rem; }
.gc {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 0.8rem;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.gc:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55); border-color: #3a4456; }
/* Rarity is labelled in text; the border tint is a supporting cue only. */
.gc:has(.r-legendary) { border-color: rgba(224, 161, 60, 0.4); }
.gc:has(.r-legendary):hover { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55), 0 0 26px rgba(224, 161, 60, 0.22); }
.gc:has(.r-rare) { border-color: rgba(70, 227, 160, 0.28); }
.gc-art { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.gc-body { padding: 0.85rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.gc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.gc-head h3 { margin: 0; font-size: 1rem; }
.gc-rarity { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.r-common { color: var(--muted); }
.r-rare { color: var(--green); }
.r-legendary { color: var(--gold); }
.gc-stats { display: flex; gap: 0.9rem; font-size: 0.85rem; font-weight: 700; }
.gc-stats .cost { color: var(--green); }
.gc-stats .power { color: var(--gold); }
.gc-ability { margin: 0; font-size: 0.9rem; }
.gc-flavor { margin: 0; margin-top: auto; color: var(--muted); font-size: 0.85rem; font-style: italic; }

.rarity-legend { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.75rem; font-weight: 700; }

/* --- CTA band --- */
.cta-band {
  text-align: center; padding: 3.5rem 0;
  background: radial-gradient(38rem 16rem at 50% 100%, rgba(70, 227, 160, 0.12), transparent 70%);
}
.cta-band h2 { margin-top: 0; }

/* --- card detail: faction-tinted glow behind the art --- */
.card-hero .cd-art { box-shadow: 0 0 70px color-mix(in srgb, var(--fc, #e0a13c) 24%, transparent), 0 14px 34px rgba(0, 0, 0, 0.6); }

/* --- HTML sitemap page --- */
.map-cols { columns: 3 16rem; column-gap: 2rem; margin-top: 1rem; }
.map-cols section { break-inside: avoid-column; margin-bottom: 1.5rem; }
.map-cols ul { list-style: none; padding: 0; margin: 0; }
.map-cols li a { display: inline-block; padding: 0.28rem 0.1rem; color: var(--muted); text-decoration: none; }
.map-cols li a:hover { color: var(--green); }
.map-cols h2 { font-size: 1rem; color: var(--gold); margin: 0 0 0.35rem; }

/* --- breadcrumbs (generated subpages) --- */
.crumbs { max-width: var(--maxw); margin: 0 auto; padding: 0.9rem 1.25rem 0; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; padding: 0.4rem 0.1rem; display: inline-block; }
.crumbs a:hover { color: var(--green); }

/* --- card detail page --- */
.card-hero { display: grid; grid-template-columns: minmax(15rem, 22rem) 1fr; gap: 2.5rem; align-items: start; }
.cd-art { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 0.8rem; border: 1px solid var(--line); }
.cd-stats { font-size: 1.1rem; margin: 0.5rem 0 1rem; }
.cd-note { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 0; }
@media (max-width: 50rem) { .card-hero { grid-template-columns: 1fr; } .cd-art { max-width: 22rem; } }

/* --- comparison table: make the Street Wars column read as ours --- */
.compare-table td:last-child { color: var(--ink); }
.compare-table thead th:last-child { color: var(--green); }

.disclaimer { color: var(--muted); font-size: 0.8rem; margin-top: 2.5rem; }

/* Faction crest icons (white-on-transparent PNGs). */
.f-ic { height: 1.15em; width: auto; vertical-align: -0.18em; filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.18)); }
.f-ic.lg { height: 1.25em; }

/* Touch devices: taps must not leave lift transforms stuck mid-scroll. */
@media (hover: none) {
  .tile:hover, .gc:hover { transform: none; }
  .btn-primary:hover { transform: none; }
  .hero-fan img:hover { transform: rotate(var(--r, 0deg)) translateY(var(--y, 0)); }
  .art-tile:hover .ft-art { transform: none; }
}

/* faction tile / hub heading links keep their tint; persistent underline = non-color affordance */
.faction h3 a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.faction h3 a, .gc-head h3 a { padding: 0.25rem 0; display: inline-block; }
