/* crossword-md: a desk at night. Deep ink-blue surface, white paper sheets that glow on it,
   one pencil yellow. Fraunces for headlines, DM Sans for text, DM Mono for code.
   Keep the focus ring, the skip link and the 3-width check. */
:root {
  --desk: #0e1531;
  --desk-2: #151f46;
  --sheet: #ffffff;
  --mist: #f2f4fa;
  --ink: #0c1230;
  --muted: #4f587d;
  --on-desk: #eaedf9;
  --on-desk-muted: #a6aed2;
  --line: #d9deef;
  --line-desk: rgba(255, 255, 255, .16);
  --pencil: #ffc933;
  --pencil-ink: #2a2100;
  --display: "Fraunces", "Iowan Old Style", "Charter", Georgia, serif;
  --text: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--mist); color: var(--ink); font: 17px/1.6 var(--text); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pencil); outline-offset: 3px; border-radius: 3px; }
.light :focus-visible { outline-color: #2b45d6; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.08; margin: 0; text-wrap: balance; font-variation-settings: "opsz" 96; }
h2 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.015em; }
h3 { font-size: 21px; letter-spacing: -.005em; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: .86em; }
.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: 12px; top: -64px; background: var(--pencil); color: var(--pencil-ink); padding: 10px 16px; z-index: 20; font-weight: 700; border-radius: 4px; }
.skip:focus { top: 12px; }

/* Crossword tiles: the wordmark and the dividers. */
.tiles { display: inline-flex; gap: 3px; vertical-align: middle; --t: 24px; }
.tile { width: var(--t); height: var(--t); display: grid; place-items: center; background: var(--sheet); color: var(--ink); font: 700 calc(var(--t) * .58)/1 var(--display); border-radius: 3px; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); position: relative; }
.tile.pen { background: var(--pencil); color: var(--pencil-ink); }
.tile i { position: absolute; top: 2px; inset-inline-start: 3px; font: 500 calc(var(--t) * .3)/1 var(--mono); font-style: normal; opacity: .65; }

/* Header */
.top { background: var(--desk); border-bottom: 1px solid var(--line-desk); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.wordmark { text-decoration: none; display: inline-flex; }
.nav { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; font-size: 15px; font-weight: 500; }
.nav a { color: var(--on-desk-muted); text-decoration: none; padding: 6px 0; }
.nav a:hover { color: var(--on-desk); text-decoration: underline; }

/* Hero */
.hero { position: relative; background:
    linear-gradient(var(--line-desk) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--line-desk) 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(900px 520px at 78% 38%, #24336e 0%, transparent 70%), var(--desk);
  background-blend-mode: normal; color: var(--on-desk); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 21, 49, .35), rgba(14, 21, 49, .85) 96%); pointer-events: none; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 76px 0 96px; }
.eyebrow { font: 500 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--pencil); margin-bottom: 22px; }
.hero h1 { font-size: clamp(36px, 5.2vw, 68px); letter-spacing: -.025em; color: #fff; }
.hero h1 mark { background: linear-gradient(transparent 62%, rgba(255, 201, 51, .9) 62% 92%, transparent 92%); color: inherit; padding: 0 .06em; }
.lede { font-size: 19px; color: var(--on-desk-muted); margin-top: 24px; max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn { display: inline-block; padding: 14px 22px; border-radius: 8px; font-weight: 700; text-decoration: none; background: var(--pencil); color: var(--pencil-ink); box-shadow: 0 4px 0 #c79500; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 #c79500; }
.btn-quiet { background: transparent; color: var(--on-desk); box-shadow: inset 0 0 0 2px var(--line-desk); }
.btn-quiet:hover { box-shadow: inset 0 0 0 2px var(--on-desk-muted); }
.one-liner { margin-top: 26px; font: 15px/1.5 var(--mono); color: var(--on-desk-muted); overflow-wrap: anywhere; }
.one-liner code { color: var(--on-desk); background: rgba(255, 255, 255, .08); padding: 4px 8px; border-radius: 5px; }

.fan { position: relative; width: 100%; aspect-ratio: 1 / .96; }
.fan a { position: absolute; width: 54%; display: block; border-radius: 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 30px 60px rgba(0, 0, 0, .5); transition: transform .25s; }
.fan img { border-radius: 3px; }
.fan .f1 { left: 0; top: 7%; transform: rotate(-6deg); }
.fan .f2 { right: 0; top: 0; transform: rotate(5.5deg); }
.fan .f3 { left: 23%; top: 15%; z-index: 2; transform: rotate(-1.2deg); }
.fan a:hover { transform: rotate(0) translateY(-8px); z-index: 3; }

/* Sections */
section.block { padding: 96px 0; }
.light { background: var(--mist); color: var(--ink); }
.dark { background: var(--desk); color: var(--on-desk); }
.paper { background: var(--sheet); color: var(--ink); }
.section-head { max-width: 760px; margin-bottom: 48px; }
.section-head .eyebrow { color: #2b45d6; }
.dark .section-head .eyebrow { color: var(--pencil); }
.section-lede { font-size: 19px; color: var(--muted); margin-top: 16px; }
.dark .section-lede { color: var(--on-desk-muted); }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px 28px; position: relative; box-shadow: 0 1px 0 var(--line), 0 18px 40px -26px rgba(14, 21, 49, .35); min-width: 0; }
.step-no { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 4px; background: var(--ink); color: #fff; font: 700 20px/1 var(--display); margin-bottom: 20px; }
.steps h3 { margin-bottom: 10px; }
.steps p { color: var(--muted); font-size: 16px; }
.ask { margin: 16px 0 0; padding: 14px 16px; border-inline-start: 4px solid var(--pencil); background: var(--mist); font-family: var(--display); font-size: 18px; line-height: 1.4; border-radius: 0 8px 8px 0; color: var(--ink); }
pre { margin: 16px 0 0; background: var(--desk); color: var(--on-desk); border-radius: 10px; padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 13.5px; }
pre .p { color: var(--pencil); user-select: none; }
pre .d { color: var(--on-desk-muted); }

/* Page 1 and page 2 */
.pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; }
.pair h3 { margin-bottom: 6px; }
.pair > p { color: var(--muted); margin-bottom: 22px; max-width: 32em; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.duo figure { margin: 0; }
.duo img { border-radius: 3px; box-shadow: 0 1px 2px rgba(14, 21, 49, .2), 0 22px 40px -18px rgba(14, 21, 49, .45); }
.duo figcaption, .themes figcaption { font: 500 12px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 14px; }

/* Themes */
.themes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; }
.themes figure { margin: 0; }
.themes a { display: block; border-radius: 3px; transition: transform .2s; }
.themes a:hover { transform: translateY(-6px) rotate(-.6deg); }
.themes img { border-radius: 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 24px 44px -12px rgba(0, 0, 0, .6); }
.themes figcaption { color: var(--on-desk-muted); text-transform: none; letter-spacing: 0; font: 400 14px/1.45 var(--text); }
.themes figcaption b { display: block; font: 700 17px/1.2 var(--display); color: #fff; margin-bottom: 4px; letter-spacing: 0; }

/* Alphabets */
.alpha { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.alpha .duo { max-width: 560px; }
.alpha ul { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.alpha li { padding-inline-start: 26px; position: relative; color: var(--muted); }
.alpha li::before { content: ""; position: absolute; inset-inline-start: 0; top: .55em; width: 12px; height: 12px; background: var(--pencil); border-radius: 2px; }
.alpha li b { color: var(--ink); }

/* Install */
.install { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.install > div { background: var(--desk-2); border: 1px solid var(--line-desk); border-radius: 14px; padding: 26px; min-width: 0; }
.install h3 { color: #fff; font-size: 18px; }
.install pre { background: #0a1027; margin-top: 14px; }
.note { margin-top: 24px; color: var(--on-desk-muted); }

/* Examples */
.examples { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.examples li { display: flex; align-items: baseline; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.examples a { font: 700 19px/1.2 var(--display); text-decoration: none; }
.examples a:hover { text-decoration: underline; }
.examples span { color: var(--muted); font-size: 14px; margin-inline-start: auto; text-align: end; }

/* Footer */
.foot { background: var(--desk); color: var(--on-desk-muted); padding: 48px 0; border-top: 1px solid var(--line-desk); font-size: 15px; }
.foot-row { display: grid; gap: 14px; }
.foot a { color: var(--on-desk); }
.foot p { max-width: 60em; }

/* 404 */
.lost { background: var(--desk); color: var(--on-desk); padding: 120px 0 140px; min-height: 60vh; }
.lost h1 { font-size: clamp(36px, 6vw, 72px); color: #fff; margin-top: 8px; }
.lost .lede { margin-top: 18px; }

@media (max-width: 1100px) {
  .themes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; padding: 56px 0 64px; }
  .steps, .install { grid-template-columns: 1fr; }
  .pairs, .alpha { grid-template-columns: 1fr; gap: 44px; }
  section.block { padding: 72px 0; }
  .examples { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav li:not(:last-child) { display: none; }
  .tiles { --t: 19px; gap: 2px; }
  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .duo { gap: 12px; }
  .examples li { flex-wrap: wrap; gap: 4px 14px; }
  .examples span { margin-inline-start: 0; text-align: start; width: 100%; }
  .lede { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
