/* ==========================================================================
   Wizard Chess page. The elman.group "Vercel light" system: white canvas,
   Geist, zinc neutrals, hairlines. The one colour is the torch brass from the
   scene, as a three-stop gradient.
   ========================================================================== */

@property --ga {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f5;
  --fg: #0a0a0a;
  --fg-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: #e4e4e7;
  --line-2: #d4d4d8;

  /* brass, from the app's accent (oklch 0.55 0.10 70) */
  --g1: #8a5a12;
  --g2: #b8862b;
  --g3: #d9b25f;
  --accent: #9a6b1f;
  --accent-tint: rgba(154, 107, 31, 0.1);
  --grad: linear-gradient(100deg, var(--g1), var(--g2) 55%, var(--g3));

  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 76rem;
  --radius: 12px;

  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.05), 0 1px 1px rgba(9, 9, 11, 0.04);
  --shadow-md: 0 2px 4px rgba(9, 9, 11, 0.04), 0 12px 28px -12px rgba(9, 9, 11, 0.18);
  --shadow-lg: 0 4px 8px rgba(9, 9, 11, 0.05), 0 32px 64px -24px rgba(9, 9, 11, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-2);
  font-family: var(--font-sans);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-wrap: balance;
  margin: 0;
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }
::selection { background: var(--accent-tint); color: var(--fg); }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------------------------------------------------------------- layout */

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.75rem; }
.section { position: relative; padding-block: clamp(4rem, 8vw, 6.5rem); }
.section--panel { background: var(--bg-2); border-block: 1px solid var(--line); }

.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 4.5vw, 3.25rem); }
.section-head h2 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin-bottom: 1rem; }
.lede { color: var(--muted); font-size: 1.125rem; max-width: 40rem; }
.lede strong { color: var(--fg); font-weight: 600; }

/* ---------------------------------------------------------------- chips, buttons */

.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  background: var(--bg); color: var(--fg-2);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 0.8125rem; font-weight: 500;
}
.chip::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--grad); }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  white-space: nowrap; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-sans); font-weight: 600;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--sm { height: 2.3rem; padding-inline: 0.95rem; font-size: 0.875rem; }
.btn--lg { height: 3.1rem; padding-inline: 1.6rem; font-size: 1rem; }
.btn--primary { background: var(--fg); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); background: #1f1f23; }
.btn--primary:disabled { opacity: 0.7; cursor: default; transform: none; }
.btn--ghost { background: var(--bg); color: var(--fg); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--fg); transform: translateY(-1px); }
.btn--soft { background: var(--bg-3); color: var(--fg); }
.btn--soft:hover { background: var(--line); }

.focus-ring { outline: none; }
.focus-ring:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 75%, transparent);
  border-radius: 8px;
}

.text-link { font-weight: 600; color: var(--fg); transition: color 0.2s var(--ease); }
.text-link:hover { color: var(--accent); }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 30; height: 4.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-inline: max(1.75rem, calc((100% - var(--maxw)) / 2));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.03em; color: var(--fg); }
.logo-mark { width: 1.7rem; height: 1.7rem; border-radius: 7px; background: var(--grad); display: grid; place-items: center; color: #fff; }
.site-nav { display: flex; align-items: center; gap: 1.6rem; }
.nav-link { color: var(--muted); font-size: 0.9rem; font-weight: 500; transition: color 0.2s var(--ease); }
.nav-link:hover { color: var(--fg); }
@media (max-width: 860px) { .site-nav .nav-link { display: none; } }

/* ---------------------------------------------------------------- hero */

.hero { position: relative; padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5rem); overflow: hidden; }
.hero-layout { display: grid; grid-template-columns: 1fr 1.05fr; gap: 3rem; align-items: center; }
.hero-content { max-width: 34rem; }
.hero-title { font-size: clamp(2.6rem, 5.6vw, 4.3rem); letter-spacing: -0.04em; margin: 1.3rem 0 1.25rem; }
.hero-sub { max-width: 30rem; font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* The two real screenshots: the desktop card with the phone tucked into its
   corner. The desktop image carries the animated brass ring, the one moving
   thing on the page. */
.hero-visual { position: relative; }
.shot { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg); background: #16181d; }
.shot img { width: 100%; }
.shot--ring { position: relative; }
.shot--ring::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; z-index: 3;
  background: conic-gradient(from var(--ga), var(--g1), var(--g2), var(--g3), var(--g1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: ga-spin 8s linear infinite; pointer-events: none;
}
@keyframes ga-spin { to { --ga: 360deg; } }
.hero-desktop { width: 100%; }
.hero-phone {
  position: absolute; z-index: 4; right: 0; bottom: 0; width: 30%; max-width: 15rem;
  border-radius: 1.6rem; overflow: hidden; border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg); background: #16181d;
}
.hero-phone img { width: 100%; }
@media (max-width: 940px) {
  .hero-layout { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* ---------------------------------------------------------------- lessons (split, image left) */

.split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.split .section-head { margin-bottom: 0; }
.split .section-head h2 { font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
.facts { display: grid; gap: 1.1rem; margin-top: 2rem; }
.fact { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.fact h3 { font-size: 1.05rem; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.fact p { color: var(--muted); font-size: 0.95rem; }
.gloss-note { display: inline-flex; align-items: baseline; gap: 0.35rem; padding: 0.1rem 0.5rem; border-radius: 6px; background: var(--bg-3); color: var(--fg); font-size: 0.9em; }
.gloss-note span { color: var(--muted); }
@media (max-width: 940px) {
  .split { grid-template-columns: 1fr; }
  .split .shot { order: 2; }
}

/* ---------------------------------------------------------------- how it works (three columns under one rule) */

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.step h3 { font-size: 1.15rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.step p { color: var(--muted); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 1.6rem; } }

/* ---------------------------------------------------------------- features (bento) */

.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.cell {
  position: relative; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg);
  box-shadow: var(--shadow-sm); padding: 1.6rem; display: flex; flex-direction: column; gap: 0.6rem; overflow: hidden;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.cell:hover { box-shadow: var(--shadow-md); border-color: var(--line-2); }
.cell h3 { font-size: 1.2rem; letter-spacing: -0.025em; }
.cell p { color: var(--muted); font-size: 0.95rem; max-width: 34rem; }
.cell--wide { grid-column: span 2; }
.cell--image { background: var(--bg-2); }
.cell--image { padding-bottom: 0; }
.cell--image .cell-shot { margin: 0.9rem -1.6rem 0; border-top: 1px solid var(--line); }
.cell--image .cell-shot img { width: 100%; }
.lang-grid { list-style: none; padding: 0; margin: 0.9rem 0 0; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.lang { padding: 0.5rem 0.9rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--fg); font-weight: 500; font-size: 0.95rem; box-shadow: var(--shadow-sm); }
.levels { margin-top: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--muted); }
.levels b { font-weight: 600; color: var(--fg); padding: 0.15rem 0.5rem; border-radius: 6px; background: var(--bg-3); }
@media (max-width: 900px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .bento { grid-template-columns: 1fr; } .cell--wide { grid-column: auto; } }

/* ---------------------------------------------------------------- platforms (two columns split by a rule) */

.platforms { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow-sm); overflow: hidden; }
.platform { padding: 2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.platform + .platform { border-left: 1px solid var(--line); }
.platform-os { font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.platform h3 { font-size: 1.5rem; letter-spacing: -0.03em; }
.platform p { color: var(--muted); }
.platform-links { margin-top: auto; padding-top: 0.8rem; display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: 0.9rem; }
@media (max-width: 760px) {
  .platforms { grid-template-columns: 1fr; }
  .platform + .platform { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------------------------------------------------------------- closing call to action */

.play { max-width: 40rem; margin-inline: auto; text-align: center; }
.play h2 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin-bottom: 1rem; }
.play .lede { margin-inline: auto; }
.play .hero-cta { justify-content: center; }
.credit { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding-block: 2rem; color: var(--muted); font-size: 0.9rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: 0.8rem 2rem; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.footer-links a:hover, .footer-row a:hover { color: var(--fg); }

/* ---------------------------------------------------------------- reveal, reduced motion */

[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .shot--ring::before { animation: none; }
  .btn, .cell { transition: none; }
  .btn:hover, .btn--primary:hover, .btn--ghost:hover { transform: none; }
}

/* --- images while they load ------------------------------------------------
   An image is an empty frame until its bytes arrive. Until then the <img>
   itself carries a moving band mixed from the text colour, so it reads the
   same in both themes; the picture covers it when it paints, and app.js adds
   .is-loaded so the animation stops and nothing shows through a transparent
   file. SVG badges are tiny and inline-cheap, so they are left out. The box is
   already sized by width and height, so nothing moves. */
img:not([src$=".svg"]):not(.is-loaded) {
  background-color: color-mix(in srgb, var(--fg) 5%, var(--bg));
  background-image: linear-gradient(
    100deg,
    transparent 30%,
    color-mix(in srgb, var(--fg) 16%, transparent) 50%,
    transparent 70%
  );
  background-size: 250% 100%;
  background-repeat: no-repeat;
  animation: img-shimmer 1.6s ease-in-out infinite;
}
@keyframes img-shimmer {
  from {
    background-position: 125% 0;
  }
  to {
    background-position: -125% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  img:not([src$=".svg"]):not(.is-loaded) {
    background-image: none;
    animation: none;
  }
}
