/* SQL for Normies. The Always On GTM colours, with its own personality:
   spreadsheet gridlines, an Excel-style formula bar, hard ink edges with
   offset shadows, and a grotesque display face. Square corners. Phone first. */
:root {
  --bg: #f2f4f8;
  --paper: #ffffff;
  --ink: #20295a;
  --ink-2: #454c6e;
  --muted: #6b7190;
  --line: #dfe3ee;
  --grid: rgba(32, 41, 90, 0.07);
  --edge: #20295a;
  --accent: #2451e6;
  --accent-ink: #ffffff;
  --accent-soft: #dfe8ff;
  --cell: #f7f8fc;
  --code-bg: #f5f6fa;
  --right: #1a7f4b;
  --wrong: #c93a3f;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1027; --paper: #141a3d; --ink: #eef0ff; --ink-2: #c4c8e4; --muted: #9298bd;
    --line: #262e5e; --grid: rgba(160, 175, 255, 0.07); --edge: #6b9bff; --accent: #6b9bff; --accent-ink: #0c1027;
    --accent-soft: #1e2d66; --cell: #10153a; --code-bg: #10153a; --right: #5fd49a; --wrong: #ff8a8e;
  }
}

* { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-2); font-family: var(--sans); font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand, .btn, .card .name { font-family: var(--display); color: var(--ink); }
strong { color: var(--ink); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
code, pre, textarea.sql { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
code { background: var(--accent-soft); color: var(--ink); padding: 1px 5px; font-size: 0.86em; }
pre { background: var(--code-bg); border: 1.5px solid var(--line); padding: 12px 14px; overflow-x: auto; font-size: 14px; line-height: 1.55; }
pre code { background: none; padding: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.lesson, .prose-page { max-width: 800px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Header */
.top { background: var(--paper); border-bottom: 1.5px solid var(--edge); }
.top .bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; min-height: 60px; padding: 8px 0; }
.brand { text-decoration: none; font-weight: 800; letter-spacing: -0.03em; font-size: 21px; display: inline-flex; align-items: center; gap: 10px; }
.brand em { font-style: normal; color: var(--accent); }
.brand .mark { width: 28px; height: 28px; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); font-weight: 600; font-size: 17px; border: 1.5px solid var(--edge); box-shadow: 2px 2px 0 var(--edge); }
.top nav { display: flex; gap: 4px; overflow-x: auto; margin-right: -8px; }
.top nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap; padding: 6px 8px; border: 1.5px solid transparent; }
.top nav a:hover { border-color: var(--edge); }
.top nav a[aria-current="page"] { background: var(--accent-soft); border-color: var(--edge); }
@media (max-width: 639px) { .top nav { width: 100%; margin: 0 -8px; } .top nav a { font-size: 14px; } }

/* Spreadsheet gridlines behind heroes */
.sheet-bg { background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 32px 32px; background-position: -1px -1px; }
.hero { padding: 36px 0 28px; border-bottom: 1.5px solid var(--line); }
.hero h1 { max-width: 760px; }
h1 { font-size: clamp(34px, 7vw, 64px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; margin: 6px 0 16px; }
h1 .mark-line { color: var(--accent); }
.lesson h1, .prose-page h1 { font-size: clamp(30px, 6vw, 46px); }
h2 { font-size: clamp(24px, 4vw, 30px); letter-spacing: -0.025em; font-weight: 750; margin: 44px 0 6px; line-height: 1.15; }
h3 { font-weight: 700; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 620px; margin: 0 0 18px; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); margin: 0; }
.section-lede { color: var(--muted); margin: 0 0 18px; max-width: 640px; }

/* Home hero: copy plus the Excel-to-SQL translator */
.hero-home { padding: 40px 0 44px; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
.hero-grid > * { min-width: 0; }
.sheet-scroll { overflow-x: auto; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 48px; } }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 14px; }
.fineprint { font-size: 14px; color: var(--muted); margin: 0; }

.translator { background: var(--paper); border: 1.5px solid var(--edge); box-shadow: 6px 6px 0 var(--edge); }
.translator .tbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1.5px solid var(--edge); font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--cell); }
.translator .tbar b { color: var(--ink); font-weight: 600; }
.fx { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 14px; }
.fx .fx-label { font-style: italic; font-weight: 600; color: var(--muted); padding: 8px 10px; border-right: 1px solid var(--line); background: var(--cell); }
.fx code { min-width: 0; background: none; padding: 8px 10px; color: var(--ink); white-space: nowrap; overflow-x: auto; font-size: 14px; }
.mini-sheet { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.mini-sheet th, .mini-sheet td { border: 1px solid var(--line); padding: 3px 8px; text-align: left; white-space: nowrap; }
.mini-sheet th { background: var(--cell); color: var(--muted); font-weight: 400; text-align: center; font-family: var(--mono); }
.mini-sheet td.hit { background: var(--accent-soft); color: var(--ink); }
.becomes { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); border-top: 1.5px solid var(--edge); border-bottom: 1.5px solid var(--edge); background: var(--paper); }
.becomes::before { content: ""; height: 1.5px; flex: 0 0 18px; background: var(--edge); }
.becomes b { color: var(--accent); font-weight: 600; }
.translator pre { margin: 0; border: 0; background: var(--ink); font-size: 14px; min-height: 112px; }
.translator pre code { color: #eef0ff; }
@media (prefers-color-scheme: dark) { .translator pre { background: #070a1c; } }
.translator pre .kw { color: #9cb7ff; }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; flex-wrap: wrap; font-size: 14px; }
.tfoot .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }

/* Buttons: hard edge, offset shadow, press down on click */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; border: 1.5px solid var(--edge); background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: 3px 3px 0 var(--edge); transition: transform .08s ease, box-shadow .08s ease; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.7; cursor: progress; transform: none; box-shadow: 3px 3px 0 var(--edge); }

/* Cards read like translations */
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }
.card a { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; background: var(--paper); border: 1.5px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); color: var(--ink); text-decoration: none; height: 100%; transition: transform .1s ease, box-shadow .1s ease; }
.card a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--edge); }
.card .swap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.card .from { color: var(--muted); }
.card .arrow { color: var(--muted); }
.card .to { color: var(--accent); font-weight: 600; background: var(--accent-soft); padding: 0 5px; }
.card .num { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }
.card .name { font-weight: 700; font-size: 19px; line-height: 1.25; letter-spacing: -0.015em; }

.manifesto { margin: 56px 0 0; padding: 22px 22px 24px; background: var(--paper); border: 1.5px solid var(--edge); border-left: 8px solid var(--accent); max-width: 800px; }
.manifesto p { margin: 0 0 10px; font-size: 18px; color: var(--ink); }
.manifesto p:last-child { margin: 0; color: var(--muted); font-size: 15px; }

/* Lesson pages */
.lesson { padding-top: 20px; }
.crumb { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.crumb a { color: var(--muted); }
.excel-bar { background: var(--paper); border: 1.5px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); margin: 4px 0 18px; }
.excel-bar .tbar { padding: 4px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--cell); }
.excel-bar .fx { border-bottom: 0; }
.excel-bar .fx code { white-space: normal; }
.prose ul { padding-left: 20px; }
.prose li { margin: 4px 0; }
.syntax-h { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--muted); margin: 24px 0 6px; letter-spacing: 0; }
pre.syntax { margin-top: 0; background: var(--paper); }

/* Runner and exercises */
.runner, .exercise { background: var(--paper); border: 1.5px solid var(--edge); padding: 14px; margin: 24px 0; }
.exercise { box-shadow: 6px 6px 0 var(--accent); }
.runner-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); margin-bottom: 8px; flex-wrap: wrap; }
.runner-head .small { font-family: var(--mono); font-weight: 400; font-size: 12px; }
.exercise h2 { margin: 0 0 6px; font-size: 22px; }
.exercise h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.01em; }
.exercise h3 a { color: var(--ink); text-decoration: none; }
.exercise h3 a:hover { text-decoration: underline; }
.task { margin: 0 0 10px; color: var(--ink); }
textarea.sql { display: block; width: 100%; font-size: 16px; line-height: 1.55; padding: 10px 12px; border: 1.5px solid var(--line); background: var(--code-bg); color: var(--ink); resize: vertical; tab-size: 2; white-space: pre; overflow-x: auto; }
textarea.sql:focus { outline: none; border-color: var(--accent); background: var(--paper); }
.actions { display: flex; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.actions .btn { min-height: 44px; font-size: 16px; padding: 8px 16px; }
.actions .btn.primary { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn.primary { flex: 0 0 auto; } }
.hint { font-size: 15px; color: var(--ink); background: var(--accent-soft); padding: 8px 12px; border-left: 3px solid var(--accent); }
.verdict p { margin: 10px 0 0; font-weight: 500; }
.right { color: var(--right); }
.wrong, .error { color: var(--wrong); }
.error { font-size: 15px; }

/* Result tables, styled like a sheet */
.output { margin-top: 12px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1.5px solid var(--edge); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: 14px; color: var(--ink); }
th, td { text-align: left; padding: 6px 10px; border: 1px solid var(--line); white-space: nowrap; }
th { background: var(--cell); font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--ink-2); }
td .null, .null { color: var(--muted); font-style: italic; }
.rowcount { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 6px 0 0; }
table.cheat td { white-space: normal; vertical-align: top; }
table.cheat td:nth-child(2) { min-width: 220px; }

.tables { background: var(--paper); border: 1.5px solid var(--edge); padding: 12px 14px; margin: 24px 0; }
.tables summary { cursor: pointer; font-weight: 600; color: var(--ink); min-height: 32px; }
.tables ul { padding-left: 20px; margin: 8px 0; }
.table-doc { margin-bottom: 32px; }
.table-doc h2 { margin-bottom: 4px; }
.dialects ul { padding-left: 20px; }
.practice-group h2 { margin-top: 48px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 32px 0 8px; }
.pager a { display: flex; flex-direction: column; background: var(--paper); border: 1.5px solid var(--edge); box-shadow: 3px 3px 0 var(--edge); padding: 12px 14px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.3; }
.pager a .small { font-family: var(--mono); font-weight: 400; font-size: 12px; }
.pager a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge); }
.pager .next { text-align: right; }

.foot { background: var(--ink); color: #c4c8e4; margin-top: 64px; padding: 28px 0 44px; font-size: 15px; }
.foot strong { color: #fff; }
.foot a { color: #fff; }
.foot p { margin: 4px 0; }
@media (prefers-color-scheme: dark) { .foot { background: #070a1c; } }

/* Diagram images: shown on the page so Google Images and Pinterest can find them */
.diagram { margin: 24px 0; }
.diagram img { width: 100%; height: auto; display: block; border: 1.5px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); background: var(--paper); }
.diagram figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.card-section h2 { margin-bottom: 0; }
.diagram-grid { display: grid; gap: 20px; }
@media (min-width: 900px) { .diagram-grid { grid-template-columns: 1fr 1fr 1fr; align-items: start; } }
.diagram-grid .diagram { margin: 0; }
