/* ─── Self-hosted fonts ────────────────────────────────────────── */

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/dm-mono-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/newsreader.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/newsreader-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Design tokens ────────────────────────────────────────────── */

:root {
  --bg:     #faf9f6;
  --text:   #1a1c1b;
  --muted:  #5b6b64;
  --accent: #047857;
  --border: #e4e6e3;
  --card:   #ffffff;

  --mono:  'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #0e1311;
    --text:   #e6efe9;
    --muted:  #9fc2b4;
    --accent: #34d399;
    --border: #1c2a25;
    --card:   #121817;
  }
}

[data-theme="light"] {
  --bg:     #faf9f6;
  --text:   #1a1c1b;
  --muted:  #5b6b64;
  --accent: #047857;
  --border: #e4e6e3;
  --card:   #ffffff;
}

[data-theme="dark"] {
  --bg:     #0e1311;
  --text:   #e6efe9;
  --muted:  #9fc2b4;
  --accent: #34d399;
  --border: #1c2a25;
  --card:   #121817;
}

/* ─── Top nav ───────────────────────────────────────────────────── */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topnav-inner {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.topnav-brand {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  margin-right: auto;
}

.topnav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topnav-links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.12s ease;
}

.topnav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* 3-state theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.theme-toggle button {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
  border: none;
  border-left: 1px solid var(--border);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
  letter-spacing: 0.02em;
}

.theme-toggle button:first-child {
  border-left: none;
}

.theme-toggle button:hover {
  color: var(--text);
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

[data-theme="light"] .theme-toggle button[aria-pressed="true"] {
  color: #fff;
}

[data-theme="dark"] .theme-toggle button[aria-pressed="true"] {
  color: #0e1311;
}

/* Hamburger button — hidden on wide screens, shown ≤640px */
.nav-toggle {
  display: none;
  width: 38px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* On wide screens the menu is an inline row (links + toggle) */
.topnav-menu { display: flex; align-items: center; gap: 1.25rem; }

@media (max-width: 640px) {
  .topnav-inner { position: relative; }
  .nav-toggle { display: inline-flex; }
  .topnav-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  }
  .topnav-menu.open { display: flex; }

  /* Stack the nav links vertically in the dropdown, right-aligned under the
     hamburger (the theme toggle stays a horizontal segment) */
  .topnav-menu .topnav-links {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.85rem;
  }

  /* Apps list: stack name over a wrapping description so it can't overflow.
     Uses .apps … (specificity 0,2,0) to win over the base .app-link/.app-desc
     rules, which are defined later in the file. */
  .apps .app-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .apps .app-desc {
    text-align: left;
    white-space: normal;
  }
}

/* ─── Reset + base ─────────────────────────────────────────────── */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  color-scheme: light dark;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: none;
}

/* Readable text selection in both themes (accent bg + bg-colored text are
   always high-contrast opposites). */
::selection { background: var(--accent); color: var(--bg); }
::-moz-selection { background: var(--accent); color: var(--bg); }

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

/* ─── Hero ─────────────────────────────────────────────────────── */

.hero {
  margin-bottom: 4rem;
}

/* Logo mark: keep small and restrained — D3 is type-led */
.hero-mark {
  display: block;
  margin: 0 0 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  opacity: 0.85;
}

.hero-kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 2.2rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.hero h1 .wordmark-accent {
  color: var(--accent);
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--muted);
  margin: 0;
}

/* tagline-punch is kept in markup for copy-parity but hidden — the
   italic tagline carries the same intent in D3. */
.tagline-punch {
  display: none;
}

/* ─── Intro / manifesto ─────────────────────────────────────────── */

.intro {
  max-width: 36rem;
  margin-bottom: 4rem;
}

.intro p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  color: var(--text);
}

.intro p:last-child {
  margin-bottom: 0;
}

/* Green emphasis for key phrases — use sparingly. */
.highlight {
  color: var(--accent);
  font-style: normal;
}

/* ─── Section headings — mono label style ─────────────────────── */

section h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* The "# " prefix is rendered via ::before so it appears naturally
   without appearing in copy-paste or screen readers. */
section h2::before {
  content: '# ';
  color: var(--accent);
  opacity: 0.7;
}

/* ─── Promise (NEAT values) ─────────────────────────────────────── */

.promise {
  margin-bottom: 4rem;
}

.promise dl {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.principle {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.principle:first-of-type {
  border-top: 1px solid var(--border);
}

.principle dt {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.principle .letter {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  min-width: 1rem;
}

.principle dd {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--muted);
  margin-left: 1.75rem;
}

/* ─── Apps list ─────────────────────────────────────────────────── */

.apps {
  margin-bottom: 4rem;
}

.apps ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-link {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;   /* top-align name + desc so a wrapped desc doesn't float the label */
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color 0.12s ease;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.apps ul li:first-child .app-link {
  border-top: 1px solid var(--border);
}

a.app-link:hover {
  color: var(--accent);
  text-decoration: none;
}

a.app-link:hover .app-icon {
  color: var(--accent);
}

.app-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.app-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: var(--accent);
}

.app-soon {
  opacity: 0.45;
  cursor: default;
}

.app-desc {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
  min-width: 0;   /* allow the desc to shrink + wrap instead of overflowing the row */
}

/* ─── Footer ────────────────────────────────────────────────────── */

footer {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

footer p {
  margin-bottom: 0.4rem;
}

footer p:last-child {
  margin-bottom: 0;
}

.footer-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  margin-right: 0.3em;
  flex-shrink: 0;
}

/* Home footer: three centered, thematically-grouped lines
   (promise+privacy / open-source facts / maker+support) */
.footer-line {
  text-align: center;
  margin: 0.35rem 0;
}
.footer-line a {
  color: var(--text);
  text-decoration: none;
}
.footer-line a:hover { color: var(--accent); }
.footer-em { color: var(--accent); } /* the "No tracking, ever" promise */

svg#ko-fi {
  margin-left: 0.2em;
}

/* ─── Privacy page (/privacy/) ──────────────────────────────────── */

.privacy {
  max-width: 36rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

.privacy-back {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.privacy-back:hover { color: var(--accent); text-decoration: none; }

.privacy h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--muted);
  margin: 1.75rem 0 0;
}

.privacy-hero {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin: 0.25rem 0 1.5rem;
}

.privacy p { line-height: 1.65; margin-bottom: 1rem; }
.privacy-caveat { font-style: italic; color: var(--muted); }
.privacy-note { font-size: 0.875rem; color: var(--muted); }

.privacy footer {
  margin-top: 2.5rem;
}
