/*
 * PixLogic — landing.
 *
 * The tokens are the app's, copied exactly from packages/ui/src/theme/tokens.ts.
 * A landing page that is a shade off from the product it sells reads as someone
 * else's page about the product.
 *
 * System fonts on purpose: the app itself uses them (Phase 0), so this matches,
 * and it means no font request, no CDN, no layout shift.
 */

:root {
  --paper: #f7f4ee;
  --surface: #ffffff;
  --surface-raised: #fdfbf7;
  --ink: #26221b;
  --ink-muted: #6e675a;
  --ink-faint: #a39b8b;
  --accent: #4a7c59;
  --accent-soft: #e3ece5;
  --border: #e4dfd4;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --measure: 62ch;
  --page: 1080px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161511;
    --surface: #201e19;
    --surface-raised: #262420;
    --ink: #ece7dc;
    --ink-muted: #9b9484;
    --ink-faint: #6b6558;
    --accent: #6fa37f;
    --accent-soft: #28352c;
    --border: #33302a;
  }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Bilingual swap -------------------------------------------------------
 * Both languages are in the DOM, and the <html lang> attribute decides which
 * one is shown. That keeps the page readable with JavaScript disabled (the
 * markup is authored lang="fr") and means the toggle costs no request.
 */
[data-lang] {
  display: none;
}
html[lang='fr'] [data-lang='fr'],
html[lang='en'] [data-lang='en'] {
  display: revert;
}

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

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

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

/*
 * The mark: the `stairs` staircase, the same drawing as the app icon.
 *
 * ONE solid shape, not a grid of cells. The grid version drew the five filled
 * rows as separated squares — 1, 2, 3, 4, 5 of them — and at 26 px that reads
 * as a bar chart, not as a staircase. The icon works because its ink is
 * contiguous; the gaps were the whole problem.
 *
 * The polygon traces the boundary of the filled region of the 5×5 puzzle:
 * right along the top of each step, down its riser, and back along the bottom.
 * Percentages, so it stays exact at any size and costs no image request.
 */
.mark {
  display: block;
  width: 26px;
  height: 26px;
  flex: none;
  background: var(--accent);
  clip-path: polygon(
    0 0,
    20% 0,
    20% 20%,
    40% 20%,
    40% 40%,
    60% 40%,
    60% 60%,
    80% 60%,
    80% 80%,
    100% 80%,
    100% 100%,
    0 100%
  );
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-raised);
}
.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  cursor: pointer;
}
.lang-toggle button[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}
.lang-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 56px;
  align-items: center;
  padding: 64px 0 72px;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 0 48px;
  }
}

h1 {
  font-size: clamp(34px, 5.2vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 20px;
  text-wrap: balance;
}

.lede {
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: var(--measure);
  margin: 0 0 32px;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--paper);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
}
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}
.btn-secondary:hover {
  border-color: var(--ink-faint);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/*
 * The store links have no URL yet. Rather than a live-looking button that goes
 * nowhere — the worst version, because it costs a real visitor a real tap — the
 * placeholder states plainly that the app is not out.
 */
.btn[aria-disabled='true'] {
  opacity: 0.45;
  pointer-events: none;
}

.note {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--ink-faint);
}

/* --- The board preview ---------------------------------------------------- */

.board {
  --cell: clamp(38px, 7.2vw, 54px);
  --clue: 13px;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 8px;
  justify-content: center;
  padding: 28px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.board-corner {
  grid-column: 1;
  grid-row: 1;
}

.clues-col {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(5, var(--cell));
}
.clues-col > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.clues-row {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(5, var(--cell));
}
.clues-row > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-right: 4px;
}

.clues-col span,
.clues-row span {
  font-size: var(--clue);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  line-height: 1.25;
}

.cells {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(5, var(--cell));
  grid-template-rows: repeat(5, var(--cell));
  background: var(--border);
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.cells i {
  background: var(--surface);
  display: block;
  position: relative;
}
.cells i.on {
  background: var(--accent);
}
/*
 * A cross, drawn rather than typed: a glyph would shift with the system font.
 *
 * Each half is a line CENTRED in the cell, not a border on an inset box. The
 * border version put both segments along the top edge of their box, so
 * rotating them ±45° made them meet in a point — a chevron, which reads as
 * nothing at all on a nonogram, where the X is the universal convention.
 *
 * 51% width, rotated 45°, spans 36% of the cell on each axis — the same
 * geometry as the board itself, which insets its diagonals by 0.32 of a cell
 * (`BoardCanvas.tsx`). The preview and the game draw the same mark.
 */
.cells i.x::before,
.cells i.x::after {
  content: '';
  position: absolute;
  left: 24.5%;
  right: 24.5%;
  top: 50%;
  height: 2px;
  background: var(--ink-faint);
}
.cells i.x::before {
  transform: translateY(-50%) rotate(45deg);
}
.cells i.x::after {
  transform: translateY(-50%) rotate(-45deg);
}

.board-caption {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}

/* --- Pillars -------------------------------------------------------------- */

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 8px 0 80px;
}
@media (max-width: 860px) {
  .pillars {
    grid-template-columns: 1fr;
    padding-bottom: 56px;
  }
}

.pillar {
  padding: 28px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pillar h2 {
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.pillar p {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink-muted);
}

.pillar-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}

/* --- Daily page ----------------------------------------------------------- */

.daily {
  padding: 72px 0 80px;
  max-width: var(--measure);
}
.day-number {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.day-date {
  font-size: 16px;
  color: var(--ink-muted);
  margin: -8px 0 28px;
}
.daily h1 {
  margin-bottom: 16px;
}

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

footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 56px;
  font-size: 14px;
  color: var(--ink-faint);
}
footer p {
  margin: 0 0 8px;
  max-width: var(--measure);
}
footer a {
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

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

.prose {
  max-width: var(--measure);
  padding: 56px 0 72px;
}
.prose h1 {
  font-size: clamp(30px, 4vw, 40px);
  margin-bottom: 8px;
}
.prose .updated {
  color: var(--ink-faint);
  font-size: 14px;
  margin: 0 0 40px;
}
.prose h2 {
  font-size: 21px;
  letter-spacing: -0.01em;
  margin: 44px 0 12px;
}
.prose h3 {
  font-size: 17px;
  margin: 28px 0 8px;
}
.prose p,
.prose li {
  color: var(--ink-muted);
}
.prose li {
  margin-bottom: 8px;
}
.prose strong {
  color: var(--ink);
  font-weight: 600;
}
.prose ul {
  padding-left: 22px;
}
/* The summary box: the one part most people will actually read. */
.prose .summary {
  background: var(--accent-soft);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 0 0 8px;
}
.prose .summary p:last-child {
  margin-bottom: 0;
}
.prose .summary li,
.prose .summary p {
  color: var(--ink);
}
