/* Dive Kit Open: the divekit.app editorial "paper & ink" system, hand-ported
   from divekit-web (src/styles/global.css) so both sites read as one. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/InterVariable-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/SourceSerif4Variable-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Regular-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Medium-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --paper-raised: #ffffff;
  --paper-tint: #f3f1ec;
  --ink: #181a1c;
  --ink-secondary: #494d52;
  --ink-muted: #75797f;
  --rule: rgb(24 26 28 / 0.14);
  --rule-strong: rgb(24 26 28 / 0.45);
  --accent: #0369a1;
  --accent-strong: #075985;
  --accent-wash: rgb(3 105 161 / 0.06);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Night reading: warm charcoal, not blue-black */
.dark {
  color-scheme: dark;
  --paper: #14161a;
  --paper-raised: #1a1d22;
  --paper-tint: #20242b;
  --ink: #e7e4dd;
  --ink-secondary: #b4b1aa;
  --ink-muted: #84827c;
  --rule: rgb(231 228 221 / 0.14);
  --rule-strong: rgb(231 228 221 / 0.45);
  --accent: #38bdf8;
  --accent-strong: #7dd3fc;
  --accent-wash: rgb(56 189 248 / 0.08);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  background: var(--paper);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

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

::selection {
  background: var(--accent-wash);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-strong);
}
p a,
li a,
td a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
}

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .wrap {
    padding: 0 1.5rem;
  }
}
@media (min-width: 1024px) {
  .wrap {
    padding: 0 2rem;
  }
}

/* ===== Editorial primitives ===== */
.display {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.015em;
  line-height: 1.08;
  font-optical-sizing: auto;
  color: var(--ink);
  margin: 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
}
.eyebrow .num {
  color: var(--accent);
}

.lead {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink-secondary);
  max-width: 52ch;
}

.muted {
  color: var(--ink-secondary);
}

.figure-caption {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-muted);
}
.figure-caption b {
  font-weight: 400;
  color: var(--ink-secondary);
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.8125rem;
}
:not(pre) > code {
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  color: var(--ink-secondary);
}
pre {
  margin: 0;
  padding: 1rem 1.125rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.65;
  color: var(--ink);
}
pre .c {
  color: var(--ink-muted);
}
pre .k {
  color: var(--accent);
}

/* Buttons: square-ish, flat, one accent */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--paper);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--paper);
}
.btn.ghost {
  background: var(--paper-raised);
  border-color: var(--rule-strong);
  color: var(--ink);
}
.btn.ghost:hover {
  background: var(--paper-tint);
  color: var(--ink);
}
.btn svg {
  width: 1rem;
  height: 1rem;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: var(--paper);
  transition: border-color 0.3s;
}
.site-header.scrolled {
  border-bottom-color: var(--rule);
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover {
  color: var(--ink);
}
.brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}
.brand-name {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
}
.logo-dark {
  display: none;
}
.dark .logo-light {
  display: none;
}
.dark .logo-dark {
  display: inline;
}

.nav {
  display: none;
  gap: 1.75rem;
  font-size: 0.875rem;
}
.nav a {
  color: var(--ink-secondary);
  transition: color 0.2s;
}
.nav a:hover {
  color: var(--ink);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-actions .btn {
  display: none;
}
@media (min-width: 900px) {
  .nav {
    display: flex;
  }
  .header-actions .btn {
    display: inline-flex;
    padding: 0.5rem 1rem;
  }
}

/* Theme switch: compact pill, sliding thumb */
.theme-switch {
  position: relative;
  width: 56px;
  height: 28px;
  flex: none;
  border-radius: 9999px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s;
}
.theme-switch:hover {
  border-color: var(--rule-strong);
}
.theme-switch .thumb {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: var(--ink);
  transition: transform 0.25s ease;
}
.dark .theme-switch .thumb {
  transform: translateX(26px);
}
.theme-switch svg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.theme-switch .sun {
  left: 7px;
  color: var(--paper);
}
.theme-switch .moon {
  right: 7px;
  color: var(--ink-muted);
}
.dark .theme-switch .sun {
  color: var(--ink-muted);
}
.dark .theme-switch .moon {
  color: var(--paper);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 4rem 0 2.5rem;
  margin-top: 2rem;
}
.footer-grid {
  display: grid;
  gap: 3rem;
  grid-template-columns: 1fr;
}
/* Phones: brand across the top, Open data on the left, Dive Kit above Community on the right. */
@media (max-width: 767px) {
  .site-footer {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: 1.5rem;
  }
  .footer-grid > :first-child {
    grid-column: 1 / -1;
  }
  .footer-grid > :nth-child(2) {
    grid-column: 1;
    grid-row: 2 / span 2;
  }
  .footer-grid > :nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }
  .footer-grid > :nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }
}
@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
  }
}
.footer-grid p {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin: 0.75rem 0 0;
  max-width: 32ch;
}
.footer-grid .brand img {
  width: 1.75rem;
  height: 1.75rem;
}
.footer-grid ul {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.footer-grid ul a {
  font-size: 0.875rem;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-grid ul a:hover {
  color: var(--ink-secondary);
}
.footer-bottom {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.footer-bottom a {
  color: var(--ink-secondary);
  text-decoration: none;
}
