/* ===== Matte retro palette ===== */

:root {
  --bg: #f4efe6;
  --text: #2d2a26;
  --muted: #5f5b55;

  --primary: #c06c5b;
  --secondary: #355c7d;
  --accent: #6c8b6b;
  --highlight: #c79a3b;

  --border: #ded8cf;
}

[data-theme="dark"] {
  --bg: #1f1e1c;
  --text: #e6e1d9;
  --muted: #a59f96;

  --primary: #e08b79;
  --secondary: #6f8faa;
  --accent: #8da989;
  --highlight: #d7b468;

  --border: #3a3834;
}


/* ===== Typography ===== */

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.65;

  /* MOBILE FIRST */
  padding: 20px 16px 28px;
  padding-bottom: 90px;

  max-width: 100%;
  margin: 0 auto;

  background: var(--bg);
  color: var(--text);

  transition: background 0.25s ease, color 0.25s ease;
}

/* Desktop enhancement */
@media (min-width: 700px) {
  body {
    max-width: 860px;
    padding: 48px 32px 56px;
  }
}


/* ===== Headings ===== */

h1,
h2,
h3 {
  font-weight: 300;
  letter-spacing: 0.02em;
  margin-top: 2rem;
}

/* Mobile sizes first */
h1 {
  font-size: 1.7rem;
  letter-spacing: 0.03em;
  color: var(--primary);
}

h2 {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  color: var(--secondary);
}

h3 {
  font-size: 1rem;
  font-weight: 400;
  color: var(--accent);
}

/* Restore original desktop sizing */
@media (min-width: 700px) {
  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.05rem;
  }
}


section,
h2 {
  margin-top: 3rem;
}

p,
li {
  font-size: 0.98rem;
}

li {
  margin-bottom: 0.35rem;
}


/* ===== Responsive media fixes (important for MD embeds) ===== */

img {
  max-width: 100%;
  height: auto;
}

pre,
code {
  max-width: 100%;
  overflow-x: auto;
}


/* ===== Links ===== */

a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  border-bottom: 1px solid var(--primary);
  color: var(--highlight);
  text-decoration: underline;
}

a:focus,
button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

blockquote {
  color: var(--secondary);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}


/* ===== Subtle separators ===== */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
  opacity: 0.5;
}

::selection {
  background: var(--highlight);
  color: white;
}


/* ===== Toggle buttons ===== */

.controls {
  position: fixed;
  bottom: 12px;
  right: 16px;

  display: flex;
  gap: 10px;
  align-items: center;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  border-radius: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 70%, transparent);

  z-index: 10;
  bottom: calc(12px + env(safe-area-inset-bottom));
  padding: 2px;
}

.toggle {
  width: 38px;
  height: 38px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);

  background: var(--bg);
  color: var(--text);

  cursor: pointer;
  margin-left: 6px;

  font-weight: 300;
  transition: all 0.15s ease;
}

.toggle:hover {
  background: var(--secondary);
  color: white;
}


/* ===== Print optimization ===== */

@media print {
  body {
    padding: 8px 10px;
    line-height: 1.45;
  }

  section,
  h2 {
    margin-top: 1.2rem;
  }

  ul,
  ol {
    margin: 0.2rem 0 0.4rem;
  }

  li {
    margin-bottom: 0.15rem;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .controls {
    display: none !important;
  }

  hr {
    margin: 1rem 0;
  }
}