/* ==========================================================================
   Gambit — johnpalmer.dev
   Palette mirrors shared/GambitRender/Sources/GambitRender/Palette.swift.
   The app is dark-only, so the site is too — there is no light theme by design.
   ========================================================================== */

:root {
  --backdrop:      #14161C;
  --surface:       #1B1E26;
  --surface-2:     #232732;
  --dark-square:   #63805C;
  --light-square:  #E8E0CB;
  --border:        #4A6145;
  --gold:          #F2C14E;
  --brass:         #B5843C;
  --white-piece:   #F2ECDC;
  --black-piece:   #46423A;
  --capture:       #E2603F;
  --hint:          #4E8FD9;

  --text:          #F2ECDC;
  --text-dim:      #A6ABB8;
  --text-faint:    #767C8C;
  --hairline:      rgba(242, 236, 220, 0.09);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;

  --pad: clamp(20px, 5vw, 40px);
  --measure: 1120px;

  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next Rounded",
          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 0.68, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--backdrop);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 8vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 4.6vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.35rem); font-weight: 700; letter-spacing: -0.01em; }
p  { margin: 0 0 1.1em; }

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 var(--pad); }
.narrow { max-width: 760px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--gold); color: #14161C; padding: 12px 18px;
  border-radius: 0 0 var(--r-sm) 0; font-weight: 700; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------- Site chrome ------------------------------------------------- */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 22, 28, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.site-head .wrap {
  display: flex; align-items: center; gap: 14px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 800; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.site-head nav { margin-left: auto; display: flex; gap: clamp(12px, 3vw, 26px); align-items: center; min-width: 0; }
.site-head nav a { color: var(--text-dim); font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--gold); text-decoration: none; }

/* Below this width the four-item nav no longer fits, and the two in-page
   anchors are the ones the reader can do without — the sections are a scroll
   away, whereas Support and Privacy are separate pages. */
@media (max-width: 620px) {
  .site-head nav .jump { display: none; }
  .site-head nav a { font-size: 0.9rem; }
}

.site-foot {
  border-top: 1px solid var(--hairline);
  margin-top: 100px;
  padding: 44px 0 60px;
  color: var(--text-faint);
  font-size: 0.9rem;
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; }
.site-foot nav { margin-left: auto; display: flex; gap: 22px; flex-wrap: wrap; }
.site-foot a { color: var(--text-dim); font-weight: 600; }

/* ---------- Hero -------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(56px, 10vw, 104px) 0 clamp(40px, 7vw, 72px);
  overflow: hidden;
}
/* Soft green/gold wash behind the hero — pure CSS, no image weight. */
.hero::before {
  content: "";
  position: absolute; inset: -30% -20% auto -20%; height: 130%;
  background:
    radial-gradient(50% 55% at 22% 18%, rgba(99, 128, 92, 0.30), transparent 70%),
    radial-gradient(42% 48% at 82% 6%,  rgba(242, 193, 78, 0.14), transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-shot { order: -1; margin-inline: auto; }
  .hero-copy .pill-row { justify-content: center; }
}

.hero-icon {
  width: 88px; height: 88px; border-radius: 20px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  margin-bottom: 22px;
}
@media (max-width: 860px) { .hero-icon { margin-inline: auto; } }

.hero h1 { margin-bottom: 0.18em; }
.hero .sub {
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.7em;
  letter-spacing: -0.01em;
}
.hero .lede { font-size: clamp(1.02rem, 2.2vw, 1.15rem); color: var(--text-dim); max-width: 46ch; }
@media (max-width: 860px) { .hero .lede { margin-inline: auto; } }

.pill-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700; font-size: 0.95rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text-dim);
}
.pill.gold {
  background: linear-gradient(180deg, #F6CE68, var(--gold));
  color: #1A1815;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(242, 193, 78, 0.18);
}
.pill.gold .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1A1815; opacity: 0.55;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.8; } }

a.pill:hover { text-decoration: none; border-color: rgba(242, 193, 78, 0.5); color: var(--gold); }
a.pill.gold:hover { color: #1A1815; filter: brightness(1.05); }

/* Phone frame ------------------------------------------------------------ */

.phone {
  position: relative;
  width: min(300px, 78vw);
  border-radius: 42px;
  padding: 9px;
  background: linear-gradient(160deg, #3A3F4C, #1D202A 55%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(242, 236, 220, 0.06);
}
.phone img { border-radius: 34px; width: 100%; }
.hero-shot .phone { animation: float 7s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ---------- Sections ---------------------------------------------------- */

section { padding: clamp(56px, 9vw, 96px) 0; }
.section-head { max-width: 62ch; margin-bottom: clamp(30px, 5vw, 50px); }
.section-head p { color: var(--text-dim); margin-bottom: 0; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--dark-square);
  margin-bottom: 12px;
}
.eyebrow.gold { color: var(--brass); }

/* Cards ------------------------------------------------------------------ */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px 26px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 193, 78, 0.34);
  background: var(--surface-2);
}
.card h3 { margin-bottom: 0.4em; }
.card p { color: var(--text-dim); margin-bottom: 0; font-size: 0.97rem; }
.card .glyph {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(99, 128, 92, 0.24);
  border: 1px solid rgba(99, 128, 92, 0.4);
  margin-bottom: 18px;
  font-size: 1.4rem; line-height: 1;
}

/* The promise — a highlighted statement block */
.promise {
  background:
    linear-gradient(180deg, rgba(99, 128, 92, 0.18), rgba(99, 128, 92, 0.06));
  border: 1px solid rgba(99, 128, 92, 0.34);
  border-radius: var(--r-lg);
  padding: clamp(30px, 5vw, 52px);
}
.promise h2 { margin-bottom: 0.4em; }
.promise p:last-child { margin-bottom: 0; }
.promise .big {
  font-size: clamp(1.1rem, 2.4vw, 1.28rem);
  color: var(--text);
}

/* Screenshot strip ------------------------------------------------------- */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(16px, 3vw, 28px);
  align-items: start;
}
.shot { text-align: center; }
.shot .frame {
  border-radius: 26px;
  padding: 7px;
  background: linear-gradient(160deg, #3A3F4C, #1D202A 55%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.shot .frame img { border-radius: 20px; }
.shot:hover .frame { transform: translateY(-6px) scale(1.015); box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6); }
.shot figcaption {
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Board motif ------------------------------------------------------------ */

/* A four-square board tracing a knight's move: origin lights up, the L draws
   itself, the landing square rings. Pure SVG + CSS — ~1KB, no library. */
.motif { display: grid; place-items: center; padding-block: 10px; }
.motif svg { width: min(230px, 58vw); height: auto; filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.45)); }

.motif .origin { animation: m-origin 5s var(--ease) infinite; transform-origin: center; }
@keyframes m-origin {
  0%, 6%    { opacity: 0; }
  14%, 74%  { opacity: 1; }
  86%, 100% { opacity: 0; }
}

.motif .trail {
  stroke-dasharray: 132;
  stroke-dashoffset: 132;
  animation: m-trail 5s var(--ease) infinite;
}
@keyframes m-trail {
  0%, 18%   { stroke-dashoffset: 132; opacity: 0.9; }
  46%, 74%  { stroke-dashoffset: 0;   opacity: 0.9; }
  88%, 100% { stroke-dashoffset: 0;   opacity: 0; }
}

.motif .dest { animation: m-dest 5s var(--ease) infinite; transform-origin: center; }
@keyframes m-dest {
  0%, 44%   { opacity: 0; transform: scale(0.6); }
  56%, 74%  { opacity: 1; transform: scale(1); }
  88%, 100% { opacity: 0; transform: scale(1); }
}

/* Price rows ------------------------------------------------------------- */

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 26px; }
.plan {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 24px;
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease);
}
.plan:hover { border-color: rgba(242, 193, 78, 0.34); transform: translateY(-3px); }
.plan .amount { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; color: var(--gold); }
.plan .per { color: var(--text-faint); font-size: 0.9rem; font-weight: 600; }
.plan .label { text-transform: uppercase; letter-spacing: 0.11em; font-size: 0.74rem; font-weight: 800; color: var(--text-faint); margin-bottom: 10px; }
.fineprint { color: var(--text-faint); font-size: 0.87rem; line-height: 1.55; margin-top: 22px; }

/* ---------- Utilities --------------------------------------------------- */
/* These exist as classes rather than style="" attributes on purpose: the CSP
   in public/_headers is `style-src 'self'`, which blocks inline styles
   outright. An inline style here does not degrade — it is dropped, silently,
   and the element falls back to the base rule (a page <h1> jumps to 4.2rem).
   Keep every declaration in this file. */

/* Page titles on the secondary pages: smaller than the hero h1. */
.page-title { font-size: clamp(2.1rem, 6vw, 3rem); }

/* Group heading above a run of FAQ items. */
.group-title { font-size: clamp(1.3rem, 3vw, 1.6rem); margin-bottom: 20px; }
.faq-group { margin-bottom: 46px; }

/* Quiet trailing note — colophon, form disclaimer. */
.note { color: var(--text-faint); font-size: 0.9rem; margin-top: 2.5em; }
.note-sm { color: var(--text-faint); font-size: 0.85rem; margin: 20px 0 0; }

/* Secondary paragraph inside a .promise block. */
.promise .aside { color: var(--text-dim); margin-top: 1.2em; margin-bottom: 0; }

/* A section that butts directly onto the next one. */
.flush-bottom { padding-bottom: 0; }

/* Turnstile widget, once it mounts. */
#turnstile-slot.cf-turnstile { margin-bottom: 18px; }

/* ---------- Long-form prose (privacy) ----------------------------------- */

.prose { max-width: 72ch; }
.prose h2 { font-size: clamp(1.35rem, 3vw, 1.65rem); margin-top: 2.2em; }
.prose h2:first-of-type { margin-top: 1.2em; }
.prose p, .prose li { color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 700; }
.prose ul { padding-left: 1.15em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.55em; }
.prose .stamp {
  display: inline-block;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.callout {
  border-left: 3px solid var(--gold);
  background: rgba(242, 193, 78, 0.07);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 18px 22px;
  margin: 1.6em 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout p { color: var(--text); }

/* ---------- FAQ --------------------------------------------------------- */

.faq { display: grid; gap: 12px; max-width: 820px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.3s var(--ease);
}
.faq details[open] { border-color: rgba(242, 193, 78, 0.3); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 56px 20px 24px;
  font-weight: 700;
  position: relative;
  color: var(--text);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute; right: 24px; top: 50%;
  width: 9px; height: 9px;
  border-right: 2.5px solid var(--gold);
  border-bottom: 2.5px solid var(--gold);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.3s var(--ease);
}
.faq details[open] summary::after { transform: translateY(-20%) rotate(-135deg); }
.faq summary:hover { color: var(--gold); }
.faq .answer { padding: 0 24px 22px; color: var(--text-dim); }
.faq .answer p:last-child { margin-bottom: 0; }
.faq .answer ul { padding-left: 1.15em; margin: 0.4em 0 0.9em; }

/* ---------- Contact form ------------------------------------------------ */

.form-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: clamp(24px, 4vw, 36px);
  max-width: 640px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 0.92rem; margin-bottom: 7px; }
.field .help { color: var(--text-faint); font-size: 0.83rem; font-weight: 500; margin-left: 6px; }

input[type="text"], input[type="email"], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #12141A;
  border: 1px solid rgba(242, 236, 220, 0.14);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
textarea { min-height: 150px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.16);
}
::placeholder { color: #5A6070; }

/* Honeypot: visually and semantically hidden, but still fillable by a bot
   that ignores CSS. Never `display:none` — some bots skip those. */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
}

button.submit {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 30px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #F6CE68, var(--gold));
  color: #1A1815;
  cursor: pointer;
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
}
button.submit:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
button.submit:disabled { opacity: 0.55; cursor: not-allowed; }

.form-status {
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: var(--r-sm);
  font-size: 0.94rem;
  font-weight: 600;
  display: none;
}
.form-status[data-state] { display: block; }
.form-status[data-state="ok"]      { background: rgba(99, 128, 92, 0.2);  border: 1px solid rgba(99, 128, 92, 0.5);  color: #CFE0C9; }
.form-status[data-state="error"]   { background: rgba(226, 96, 63, 0.14); border: 1px solid rgba(226, 96, 63, 0.45); color: #F3B7A6; }
.form-status[data-state="working"] { background: var(--surface-2);         border: 1px solid var(--hairline);         color: var(--text-dim); }

/* ---------- Scroll reveal ----------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
/* If JS never runs, nothing should stay invisible. */
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------------------------------------------- */
/* The app is doing accessibility work; the site must not be the weak link.   */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero-shot .phone { animation: none; }
  .shot:hover .frame, .card:hover, .plan:hover { transform: none; }
}
