/* ==========================================================================
   Minesweeper Y — marketing site
   Design tokens are lifted 1:1 from the app's asset catalog
   (Minesweeper/Resources/Assets.xcassets/Colors/*.colorset) and the Classic
   bevel geometry from UI/Classic UI/{Outer,Inner}Background.swift.
   ========================================================================== */

@font-face {
  font-family: "Digital7Mono";
  src: url("assets/digital7mono.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* --- Surfaces (sand.colorset et al.) --- */
  --sand: #d8d1b1;              /* screen background + bevel centre */
  --sand-bg: #c8c0a4;           /* opened field */
  --sand-light: #c5c1a8;        /* button bevel highlight */
  --border-light: #e4e0c9;      /* card bevel highlight */
  --border-dark: #828677;       /* bevel shadow (all components) */
  --sand-grid: #585b50;         /* board grid lines */
  --pressed-bg: #cdc5a8;
  --pressed-border: rgba(130, 134, 119, 0.5);
  --light-bg: #fef5f8;

  /* --- Type --- */
  /* The app paints every label in sand-text-primary (#828677). That is a
     stylistic choice which does not survive long-form prose on the web, so
     labels inside game chrome keep the exact app value while running text
     uses a darker step of the same hue. */
  --ink: #4b4f42;
  --ink-2: #5e6153;

  /* --- Accents --- */
  --lcd-bg: #20373b;            /* number-background */
  --red: #e94d3d;               /* red-number */
  --red-deep: #970c10;          /* number-5 */
  --n1: #59709b;
  --n2: #53957b;
  --n3: #e35b5b;
  --n4: #222674;
  --n5: #970c10;
  --n6: #066e6e;
  --n7: #000000;
  --n8: #585858;

  --shadow: rgba(88, 91, 80, 0.28);

  /* --- Geometry (BoardDimensions.swift) --- */
  --field: 40px;                /* BoardDimensions.fieldSize */
  --grid-gap: 1px;              /* Spacing.grid */
  --grid-pad: 6px;              /* Padding.gridBackground */
  --bevel: 5px;                 /* OuterBackground margin = min(size/8, padding) */

  --wrap: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sand: #2d2f25;
    --sand-bg: #3b3e30;
    --sand-light: #4a4d3d;
    --border-light: #565848;
    --border-dark: #14160e;
    --sand-grid: #0b0d06;
    --pressed-bg: #3d4032;
    --pressed-border: rgba(86, 88, 72, 0.5);
    --light-bg: #1a1b14;

    --ink: #caceb6;
    --ink-2: #a3a68c;

    --lcd-bg: #0a0c05;
    --red: #ff6655;
    --red-deep: #ff4f60;
    --n1: #7fb1ff;
    --n2: #6fe08a;
    --n3: #ff8f7a;
    --n4: #bfa6ff;
    --n5: #ff4f60;
    --n6: #4fd8e0;
    --n7: #f0ebd6;
    --n8: #a8ad96;

    --shadow: rgba(0, 0, 0, 0.45);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  /* The app renders every string with .monospaced() .textCase(.uppercase). */
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco,
    "Cascadia Mono", "Roboto Mono", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0.15px;
  color: var(--ink);
  background: var(--sand);
  overflow-x: hidden;
}

/* Effects/noise.imageset — 4% black grain, overlaid exactly as the app does. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: url("assets/noise.png") repeat;
  pointer-events: none;
  z-index: 20;
}

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

a { color: var(--ink); text-decoration-color: var(--border-dark); }

::selection { background: var(--red); color: var(--light-bg); }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--sand);
  border: 3px solid var(--border-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 16px; }

/* --------------------------------------------------------------------------
   Classic bevels — CSS mitred borders reproduce the app's two-triangle fill
   (FlippedTriangle = top + left highlight, Triangle = right + bottom shadow).
   -------------------------------------------------------------------------- */

.bevel,
.bevel-btn,
.bevel-in {
  border-style: solid;
  border-width: var(--bevel);
}

/* cardBackground() → OuterBackground(topColor: .borderSandLight) */
.bevel {
  background: var(--sand);
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
}

/* buttonBackground() → OuterBackground(topColor: .sandLight) */
.bevel-btn {
  background: var(--sand);
  border-color: var(--sand-light) var(--border-dark) var(--border-dark) var(--sand-light);
}

/* InnerBackground — sunken well */
.bevel-in {
  background: var(--sand);
  border-color: var(--border-dark) var(--sand-light) var(--sand-light) var(--border-dark);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 13px 26px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  border-style: solid;
  border-width: var(--bevel);
  background: var(--sand);
  border-color: var(--sand-light) var(--border-dark) var(--border-dark) var(--sand-light);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ButtonBackgroundModifier isPressed branch: flat fill + uniform 4.5pt border */
.btn:active {
  background: var(--pressed-bg);
  border-color: var(--pressed-border);
  border-width: 4.5px;
  padding: 13.5px 26.5px;
}

.btn-red {
  color: var(--light-bg);
  background: var(--red);
  border-color: #f2907f var(--red-deep) var(--red-deep) #f2907f;
}
.btn-red:active {
  background: #c43a2b;
  border-color: rgba(151, 12, 16, 0.5);
}
@media (prefers-color-scheme: dark) {
  .btn-red { border-color: #ff9b8e #7d2018 #7d2018 #ff9b8e; }
  .btn-red:active { background: #d94f42; border-color: rgba(125, 32, 24, 0.6); }
}

.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 1px;
  border-width: 4px;
}
.btn-sm:active { border-width: 4px; padding: 8px 16px; }

/* --------------------------------------------------------------------------
   LCD counter — NumberLabel.swift (72×48, Digital-7 Mono 42, ghost "000")
   -------------------------------------------------------------------------- */

.lcd {
  position: relative;
  display: inline-grid;
  place-items: center end;
  min-width: 72px;
  height: 48px;
  padding: 0 6px;
  background: var(--lcd-bg);
  color: var(--red);
  font-family: "Digital7Mono", ui-monospace, monospace;
  font-size: 42px;
  line-height: 48px;
  letter-spacing: -0.15px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.lcd::before {
  content: "000";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center end;
  padding: 0 6px;
  opacity: 0.25;
}

.lcd > span { position: relative; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--sand);
  border-bottom: 1px solid var(--border-dark);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.brand span { white-space: nowrap; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.site-nav a {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); }
.site-nav .btn { margin-left: 4px; }

@media (max-width: 900px) { .site-nav a:not(.btn) { display: none; } }
@media (max-width: 420px) {
  .brand span { display: none; }
  .site-header .wrap { min-height: 64px; }
}

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

section { position: relative; z-index: 1; }

.band { padding: 88px 0; }
@media (max-width: 700px) { .band { padding: 60px 0; } }

.band-sunk {
  background: var(--sand-bg);
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--ink-2);
}

h1, h2, h3 {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.18;
  text-wrap: balance;
}

.sec-head { max-width: 60ch; margin-bottom: 44px; }
.sec-head.center { margin-left: auto; margin-right: auto; text-align: center; }

.sec-head h2 { font-size: clamp(22px, 3.2vw, 30px); margin-bottom: 14px; }
.sec-head p { color: var(--ink-2); font-size: 15px; }

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

.hero { padding: 72px 0 80px; text-align: center; }
@media (max-width: 700px) { .hero { padding: 48px 0 56px; } }

.hero-chrome {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}
.hero-chrome .face {
  width: 48px;
  height: 48px;
  padding: 5px;
  border-width: 5px;
  flex: none;
}
.hero-chrome .face img { width: 100%; height: 100%; }

.hero h1 {
  font-size: clamp(30px, 6vw, 56px);
  letter-spacing: 1px;
  margin-bottom: 22px;
}
.hero h1 .accent { color: var(--red); }

.hero .lead {
  max-width: 56ch;
  margin: 0 auto 34px;
  font-size: 16px;
  color: var(--ink-2);
  text-wrap: pretty;
}

.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero .meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 26px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.hero .meta strong { color: var(--ink); font-weight: 700; }

/* --------------------------------------------------------------------------
   Ticker strip
   -------------------------------------------------------------------------- */

.strip {
  position: relative;
  z-index: 1;
  background: var(--lcd-bg);
  padding: 15px 0;
  overflow: hidden;
}
.strip .wrap {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 34px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #d8d1b1;
}
.strip .wrap span { display: inline-flex; align-items: center; gap: 10px; }
.strip .dot { color: var(--red); }

/* --------------------------------------------------------------------------
   Playable board
   -------------------------------------------------------------------------- */

.play-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Difficulty picker — mirrors the leaderboard segmented control */
.diffs {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.diff {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
  color: var(--ink);
  background: var(--sand);
  border-style: solid;
  border-width: 4px;
  border-color: var(--sand-light) var(--border-dark) var(--border-dark) var(--sand-light);
  -webkit-tap-highlight-color: transparent;
}
.diff small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.6px;
  color: var(--ink-2);
  margin-top: 1px;
}
.diff[aria-pressed="true"] {
  background: var(--pressed-bg);
  border-color: var(--pressed-border);
}
.diff[aria-pressed="true"] small { color: var(--ink); }

/* BoardTopBar.swift — back, flag LCD, status, timer LCD, tap mode */
.board-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
  border-bottom: 1px solid var(--border-dark);
}

.bar-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  padding: 4px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: var(--sand);
  border-style: solid;
  border-width: 5px;
  border-color: var(--sand-light) var(--border-dark) var(--border-dark) var(--sand-light);
  -webkit-tap-highlight-color: transparent;
}
.bar-btn img { width: 26px; height: 26px; }
.bar-btn:active,
.bar-btn[aria-pressed="true"] {
  background: var(--pressed-bg);
  border-color: var(--pressed-border);
  border-width: 4.5px;
}
.bar-btn.status { margin: 0 auto; }

/* gridBackground() — sandGrid well inside a 5pt InnerBackground */
.board-well {
  padding: var(--bevel);
  border-style: solid;
  border-width: var(--bevel);
  border-color: var(--border-dark) var(--sand-light) var(--sand-light) var(--border-dark);
  background: var(--sand);
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
}

.board {
  display: grid;
  gap: var(--grid-gap);
  padding: var(--grid-pad);
  background: var(--sand-grid);
  touch-action: manipulation;
  margin: 0 auto;
  width: max-content;
}

.cell {
  width: var(--field);
  height: var(--field);
  padding: 0;
  font: inherit;
  font-size: calc(var(--field) * 0.62);
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--sand);
  border-style: solid;
  border-width: calc(var(--field) / 8);
  border-color: var(--sand-light) var(--border-dark) var(--border-dark) var(--sand-light);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  color: transparent;
}

.cell img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

/* Flag sits on a still-closed, still-bevelled field. */
.cell.flagged { color: transparent; }

.cell.open {
  border: 0;
  background: var(--sand-bg);
  cursor: default;
}

.cell.exploded { background: color-mix(in srgb, var(--red) 80%, var(--sand-bg)); }

.cell.n1 { color: var(--n1); }
.cell.n2 { color: var(--n2); }
.cell.n3 { color: var(--n3); }
.cell.n4 { color: var(--n4); }
.cell.n5 { color: var(--n5); }
.cell.n6 { color: var(--n6); }
.cell.n7 { color: var(--n7); }
.cell.n8 { color: var(--n8); }

.cell.wrong { position: relative; }
.cell.wrong::after {
  content: "";
  position: absolute;
  inset: 8%;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 2px), var(--red) calc(50% - 2px), var(--red) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(to bottom left, transparent calc(50% - 2px), var(--red) calc(50% - 2px), var(--red) calc(50% + 2px), transparent calc(50% + 2px));
}

.play-hint {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: center;
  max-width: 52ch;
}
.play-hint kbd {
  font: inherit;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--sand-bg);
  border: 1px solid var(--border-dark);
}

/* Win / lose banner */
.play-result {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  max-width: 420px;
  width: 100%;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.play-result.show { display: flex; }
.play-result img { width: 34px; height: 34px; flex: none; }
.play-result b { color: var(--red); }

/* --------------------------------------------------------------------------
   Features
   -------------------------------------------------------------------------- */

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

.feat {
  padding: 26px;
  box-shadow: 5px 5px 0 var(--shadow);
}
.feat .icon {
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  display: grid;
  place-items: center;
}
.feat .icon img { width: 100%; height: 100%; object-fit: contain; }
.feat .icon .digit {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.feat h3 {
  font-size: 13px;
  letter-spacing: 1.4px;
  margin-bottom: 10px;
}
.feat p { font-size: 14px; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Screenshots
   -------------------------------------------------------------------------- */

.shots {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 6px 4px 26px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.shot {
  flex: 0 0 246px;
  scroll-snap-align: center;
}
.shot .frame {
  padding: 8px;
  box-shadow: 6px 6px 0 var(--shadow);
}
.shot img { width: 100%; height: auto; }
.shot figcaption {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Split: what's new
   -------------------------------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 800px) { .split { grid-template-columns: 1fr; gap: 32px; } }

.release {
  padding: 30px;
  box-shadow: 6px 6px 0 var(--shadow);
}
.release .ver {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.release .ver b { color: var(--red); font-size: 15px; letter-spacing: 1px; }
.release p { font-size: 15px; }

.undo-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.undo-demo .cell { cursor: default; }

/* --------------------------------------------------------------------------
   Developer note
   -------------------------------------------------------------------------- */

.note {
  max-width: 680px;
  margin: 0 auto;
  padding: 38px;
  text-align: center;
  box-shadow: 6px 6px 0 var(--shadow);
}
.note img { width: 54px; height: 54px; margin: 0 auto 20px; }
.note blockquote { font-size: 16px; text-wrap: pretty; }
.note .sig {
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Final CTA
   -------------------------------------------------------------------------- */

.final { text-align: center; }
.final h2 {
  font-size: clamp(24px, 4vw, 38px);
  margin-bottom: 16px;
}
.final p { color: var(--ink-2); margin: 0 auto 32px; max-width: 46ch; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-dark);
  padding: 30px 0;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  flex-wrap: wrap;
}
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
