/* Fonts are hosted with the site, so visitors' browsers never contact Google. */
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --surface: #11151b;
  --surface-2: #171c23;
  --line: #262d36;
  --text: #e6edf3;
  --muted: #9aa5b1;
  --accent: #7ee787;
  --string: #a5d6ff;
  --amber: #e3b341;
  --red: #ff9492;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --header-height: 60px;
}

/* The language switch: only text in the active language is shown. */
html[lang="da"] [lang="en"],
html[lang="en"] [lang="da"] { display: none; }

html:not(.js) .lang-toggle,
html:not(.js) .sql-run { display: none; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 600; }
p { margin: 0 0 1em; }
pre, code { font-family: var(--mono); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(1080px, 100%); margin-inline: auto; padding-inline: 24px; }
.narrow > * { max-width: 720px; }
.accent { color: var(--accent); }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  padding: 8px 14px; background: var(--accent); color: var(--bg); border-radius: 6px;
}
.skip-link:focus { top: 12px; }

/* Marks text still to be written. Search for "TODO" to find them all. */
.todo {
  color: var(--amber);
  border: 1px dashed var(--amber);
  border-radius: 4px;
  padding: 1px 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 12, 16, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: var(--header-height); }
.logo { font: 500 16px var(--mono); color: var(--text); text-decoration: none; }
.site-nav { display: flex; gap: 20px; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: 15px; text-decoration: none; padding: 6px 0; }
.site-nav a:hover { color: var(--text); }

.lang-toggle { display: flex; align-items: center; gap: 2px; font: 400 14px var(--mono); color: var(--line); }
.lang-toggle button {
  min-width: 40px; min-height: 40px; padding: 0 6px;
  background: none; border: 0; border-radius: 6px;
  color: var(--muted); font: inherit; cursor: pointer;
}
.lang-toggle button:hover { color: var(--text); }
.lang-toggle button[aria-pressed="true"] { color: var(--accent); font-weight: 500; }

/* Hero */
.hero {
  padding-block: 88px 96px;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: center top;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 56px; align-items: center; }
h1 { font-size: clamp(44px, 7vw, 72px); letter-spacing: -.02em; margin-bottom: 20px; }
.lede { font-size: clamp(18px, 2vw, 21px); line-height: 1.55; color: var(--text); margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font: 500 15px var(--mono); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #07140a; }
.btn-primary:hover { background: #98efa0; border-color: #98efa0; }
.btn:disabled { opacity: .6; cursor: progress; }

/* SQL window */
.sql-window {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  font: 400 14px/1.6 var(--mono);
}
.sql-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.sql-title { color: var(--muted); font-size: 13px; }
.sql-run {
  margin-left: auto; min-height: 32px; padding: 0 10px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--accent); font: 400 13px var(--mono); cursor: pointer;
}
.sql-run:hover { border-color: var(--accent); }

.sql-code { margin: 0; padding: 16px 18px; overflow-x: auto; }
.line { display: block; white-space: pre; min-height: 1.6em; }
.k { color: var(--accent); }
.s { color: var(--string); }
.c { color: var(--muted); }

.sql-results { padding: 0 18px 14px; border-top: 1px solid var(--line); }
.sql-results table { width: 100%; border-collapse: collapse; margin-top: 8px; table-layout: fixed; }
.sql-results th, .sql-results td { padding: 7px 10px 7px 0; text-align: left; vertical-align: top; font-weight: 400; }
.sql-results thead th { color: var(--muted); border-bottom: 1px solid var(--line); }
.sql-results thead th:first-child, .sql-results tbody th { width: 36%; }
.sql-results tbody th { color: var(--string); }
.sql-results tbody tr + tr > * { border-top: 1px solid rgba(38, 45, 54, .55); }
.sql-results .todo { font-size: 13px; }
.sql-status { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.cursor { display: inline-block; width: 8px; height: 1em; margin-left: 8px; vertical-align: text-bottom; background: var(--accent); animation: blink 1.1s steps(2, jump-none) infinite; }

/* The query "types" itself line by line, then the results appear. */
.play .line { animation: type .55s steps(28) both; animation-delay: calc(var(--i) * .5s + .2s); }
.play .sql-results { animation: appear .35s ease-out 2.5s both; }

@keyframes type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes blink { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .play .line, .play .sql-results, .cursor { animation: none; }
  .sql-run { display: none; }
}

/* Sections */
.section { padding-block: 88px; border-top: 1px solid var(--line); }
.section-alt { background: #0d1014; }
.section-label { margin-bottom: 8px; font: 400 14px var(--mono); color: var(--accent); }
h2 { font-size: clamp(30px, 4vw, 40px); letter-spacing: -.01em; margin-bottom: 24px; }
.section-intro { max-width: 640px; color: var(--muted); margin-bottom: 32px; }

/* Lab notebook */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 18px; }
.lab-card { display: flex; flex-direction: column; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.lab-card h3 { font-size: 20px; margin-bottom: 10px; }
.lab-card p { margin: 0; color: var(--muted); font-size: 16px; }
.lab-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.lab-id { font: 400 13px var(--mono); color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border: 1px solid; border-radius: 999px; font: 400 12px/1.6 var(--mono); white-space: nowrap; }
.badge-progress { color: var(--accent); border-color: rgba(126, 231, 135, .45); background: rgba(126, 231, 135, .09); }
.badge-planned { color: var(--amber); border-color: rgba(227, 179, 65, .45); background: rgba(227, 179, 65, .09); }

/* Mystery teaser */
.case-file {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 40px; align-items: center;
  padding: 40px;
  background: var(--surface);
  border: 1px dashed var(--muted);
  border-radius: 12px;
}
.case-file h2 { margin-bottom: 16px; }
.case-note { margin: 0; color: var(--muted); font-size: 15px; }
.case-code { margin: 0; padding: 20px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; line-height: 1.6; overflow-x: auto; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 56px; align-items: start; }
.contact-links { list-style: none; margin: 0; padding: 0; }
.contact-links li { border-bottom: 1px solid var(--line); }
.contact-links li:first-child { border-top: 1px solid var(--line); }
.contact-links a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 14px 0; text-decoration: none; }
.contact-links a:hover { text-decoration: underline; }
.contact-key { width: 72px; flex: none; font: 400 14px var(--mono); color: var(--muted); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font: 400 14px var(--mono); color: var(--muted); }
/* 16px text stops iPhones from zooming in when a field is tapped. */
input, textarea {
  width: 100%; padding: 11px 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font: 400 16px/1.5 var(--sans);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status p { margin: 14px 0 0; font-size: 15px; color: var(--muted); }
.form-status .ok { color: var(--accent); }
.form-status .bad { color: var(--red); }
.form-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

/* Footer */
.site-footer { padding-block: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }

/* Tablets and smaller: one column */
@media (max-width: 860px) {
  .hero { padding-block: 56px 64px; }
  .hero-grid, .case-file, .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .case-file { padding: 28px; }
  .section { padding-block: 64px; }
}

/* Phones: the menu gets its own row and the header scrolls away to save space */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  html { scroll-padding-top: 12px; }
  .site-header { position: static; }
  .header-inner { flex-wrap: wrap; gap: 0 16px; padding-block: 6px; }
  .lang-toggle { margin-left: auto; }
  .lang-toggle button { min-width: 44px; min-height: 44px; }
  .site-nav { order: 3; width: 100%; margin: 0; justify-content: space-between; gap: 10px; }
  .site-nav a { font-size: 14px; padding: 10px 0; }
  .hero { padding-block: 40px 48px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .sql-window { font-size: 13px; }
  .sql-code { padding: 14px; }
  .sql-results { padding: 0 14px 12px; }
  .case-file { padding: 22px 18px; }
  .contact-form .btn { width: 100%; }
}
