/* ChessMate — chessmate.vickyapp.in
 *
 * Every colour here is sampled from the app icon rather than chosen next to
 * it: the knight is #C9A227 on a field of #0D1B16. That field is a warm dark
 * green, not a neutral black, and the accent is an antique brass rather than
 * anything bright — which is the whole reason the page does not look like the
 * usual dark-with-one-loud-accent.
 *
 * Type carries the rest. Fraunces is a bookish variable serif, used only for
 * the headline of a page. Space Mono appears where chess itself is set in
 * monospace — algebraic notation and board coordinates — and nowhere else, so
 * it reads as notation rather than as styling.
 */

:root {
  --felt: #0d1b16;
  --felt-lift: #12241d;
  --felt-edge: #1b3128;
  --brass: #c9a227;
  --brass-dim: #8c7020;
  --boxwood: #e9e4d6;
  --slate: #8fa396;
  --oxblood: #b4574e;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--felt);
  color: var(--boxwood);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

::selection { background: var(--brass); color: var(--felt); }

a { color: var(--brass); text-underline-offset: 0.2em; }
a:hover { color: var(--boxwood); }

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

.shell {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--felt) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--felt-edge);
}

.masthead .shell {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

/* A wordmark plus three destinations does not fit across a 360px phone. Below
   that the nav drops to its own line rather than overflowing the viewport,
   which is the width most people will arrive at this from a store listing. */
@media (max-width: 30rem) {
  .masthead .shell {
    flex-wrap: wrap;
    padding-block: 0.75rem;
    row-gap: 0.5rem;
  }
  .masthead nav {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    gap: 0.75rem;
  }
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--boxwood);
}
.mark img {
  width: 2rem;
  height: 2rem;
  display: block;
}
.mark b {
  font-family: var(--display);
  font-variation-settings: "SOFT" 20, "WONK" 1, "opsz" 30;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.9rem);
  font-size: 0.875rem;
}
.masthead nav a {
  color: var(--slate);
  text-decoration: none;
}
.masthead nav a:hover,
.masthead nav a[aria-current="page"] { color: var(--boxwood); }

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

.hero {
  position: relative;
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(3rem, 8vw, 5.5rem);
  overflow: hidden;
}

.hero .shell {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 60rem) {
  .hero .shell { grid-template-columns: 1.05fr 0.95fr; }
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 1.25rem;
}

h1 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 144;
  font-weight: 700;
  font-size: clamp(2.6rem, 1.4rem + 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
h1 em {
  font-style: italic;
  color: var(--brass);
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 144;
}

.hero p.lede {
  font-size: 1.075rem;
  color: var(--slate);
  max-width: 30rem;
  margin: 0 0 2rem;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--brass);
  background: var(--brass);
  color: var(--felt);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--boxwood); border-color: var(--boxwood); color: var(--felt); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--boxwood); border-color: var(--felt-edge); }
.btn.ghost:hover { border-color: var(--brass); color: var(--brass); background: transparent; }

/* ---------- the board, which is the signature ---------- */

.board-figure { position: relative; margin: 0; }
.board { position: relative; z-index: 1; }

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  border: 1px solid var(--felt-edge);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
}

.board i {
  display: block;
  position: relative;
}
.board i.light { background: #1c3329; }
.board i.dark { background: #142520; }

/* A move lights its origin and its destination, the way a board does after a
   piece is put down. The origin is only tinted; the destination carries the
   ring, because that is where the eye is meant to end up. */
.board i.from::after,
.board i.to::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brass);
  opacity: 0;
  transition: opacity 0.45s ease;
}
.board i.from.lit::after { opacity: 0.16; }
.board i.to.lit::after { opacity: 0.3; }
.board i.to.lit {
  box-shadow: inset 0 0 0 2px var(--brass);
}

/* The mark is not in the hero. The board is the one thing on this page that
   moves, and a knight laid over it obscured squares and read as a collision.
   It signs the page off in the footer instead. */

.score {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--slate);
  margin: 1.1rem 0 0;
  min-height: 1.5em;
  text-align: center;
}
.score b { color: var(--brass); font-weight: 400; }

/* ---------- what the app is ---------- */

.strip {
  border-top: 1px solid var(--felt-edge);
  border-bottom: 1px solid var(--felt-edge);
  background: var(--felt-lift);
}
.strip .shell {
  display: grid;
  gap: 1.75rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  padding-block: clamp(2.25rem, 5vw, 3.25rem);
}
.strip h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.5rem;
  font-weight: 400;
}
.strip p { margin: 0; color: var(--slate); font-size: 0.95rem; }

/* ---------- the three documents ---------- */

.docs { padding-block: clamp(3rem, 8vw, 5rem); }

.section-head {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 60;
  font-weight: 600;
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.1rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.section-sub { color: var(--slate); margin: 0 0 2rem; max-width: var(--measure); }

.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }

.doc-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.15rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--felt-edge);
  border-radius: 10px;
  background: var(--felt-lift);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.doc-list a:hover { border-color: var(--brass); transform: translateX(3px); }

/* A piece per document, from the app's own set — the rook guards, the king is
   the thing you can lose. Decorative, so the screen reader skips it. */
.doc-list img { width: 2.5rem; height: 2.5rem; display: block; }

.doc-list strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  /* The title sits inside the same span that carries the muted colour for the
     description, so it has to take its own back. */
  color: var(--boxwood);
}
.doc-list span { color: var(--slate); font-size: 0.92rem; }
.doc-list .chev { color: var(--brass); font-size: 1.1rem; }
.doc-list a.danger:hover { border-color: var(--oxblood); }
.doc-list a.danger .chev { color: var(--oxblood); }

/* ---------- document pages ---------- */

.doc { padding-block: clamp(2.5rem, 6vw, 4rem) 5rem; }
.doc .shell { max-width: calc(var(--measure) + var(--gutter) * 2); }

.doc h1 {
  font-size: clamp(2rem, 1.5rem + 2.4vw, 3rem);
  margin-bottom: 0.6rem;
}
.stamp {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 2.5rem;
}
.doc .lede { font-size: 1.06rem; color: var(--slate); margin: 0 0 2.5rem; }

.doc h2 {
  font-family: var(--body);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--felt-edge);
}
.doc h3 { font-size: 0.95rem; font-weight: 700; margin: 1.5rem 0 0.35rem; }
.doc p, .doc li { color: color-mix(in srgb, var(--boxwood) 82%, var(--slate)); }
.doc ul { padding-left: 1.1rem; }
.doc li { margin: 0.4rem 0; }
.doc li::marker { color: var(--brass); }

.doc dl { margin: 0.75rem 0; }
.doc dt { font-weight: 700; margin-top: 1.35rem; color: var(--boxwood); }
.doc dd { margin: 0.2rem 0 0; color: var(--slate); }

.panel {
  border: 1px solid var(--felt-edge);
  background: var(--felt-lift);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  margin: 1.75rem 0;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

.warn {
  border-left: 2px solid var(--brass);
  background: color-mix(in srgb, var(--brass) 7%, transparent);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
}
.warn > :first-child { margin-top: 0; }
.warn > :last-child { margin-bottom: 0; }

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

form label {
  display: block;
  margin: 1.6rem 0 0.3rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.hint { color: var(--slate); font-size: 0.87rem; margin: 0 0 0.5rem; font-weight: 400; }

input[type="email"], input[type="text"], select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.97rem;
  color: var(--boxwood);
  background: var(--felt);
  border: 1px solid var(--felt-edge);
  border-radius: 8px;
}
input::placeholder { color: color-mix(in srgb, var(--slate) 65%, transparent); }
input:focus, select:focus { border-color: var(--brass); outline: none; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin: 1.75rem 0;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--slate);
}
.check input { margin-top: 0.35rem; flex: none; accent-color: var(--brass); }

button.btn { font-size: 0.95rem; }
button.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.result { margin: 1.5rem 0 0; padding: 1.1rem 1.25rem; border-radius: 9px; display: none; }
.result.shown { display: block; }
.result.ok { border: 1px solid var(--brass); background: color-mix(in srgb, var(--brass) 9%, transparent); }
.result.bad { border: 1px solid var(--oxblood); background: color-mix(in srgb, var(--oxblood) 10%, transparent); }
.result p:first-child { margin-top: 0; }
.result p:last-child { margin-bottom: 0; }
.result code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--felt);
  border: 1px solid var(--felt-edge);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
}

/* ---------- foot ---------- */

.foot {
  border-top: 1px solid var(--felt-edge);
  color: var(--slate);
  font-size: 0.875rem;
}
.foot .shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding-block: 2rem 3rem;
}
.foot a { color: var(--slate); text-decoration: none; }
.foot a:hover { color: var(--boxwood); }
.foot-mark { width: 2.25rem; height: 2.25rem; display: block; }
.foot .push { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; }

@media (max-width: 34rem) {
  .foot .push { margin-left: 0; width: 100%; }
}
