/* =========================================================================
   Labhole — Custom Theme Stylesheet (Dark Mode)
   =========================================================================
   A minimal, single-panel dark design for a science-ethics advocacy site.

   Color Palette (Dark Mode)
   ─────────────────────────
   Very dark brown: #211103  — page background
   Parchment      : #FBF7F4  — body text (muted to #E8E0DA for comfort)
   Muted green    : #557E73  — accents (borders, hr, blockquotes)
   Light green    : #659389  — headings (brightened for AA contrast)
   Toffee brown   : #C4793E  — links (lightened from #8F5A30 for contrast)
   Very dark green: #1D1A05  — secondary dark (code blocks)
   ========================================================================= */

/* ── Self-Hosted Montserrat Font ──────────────────────────────────────── */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/montserrat-300.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/montserrat-400.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/montserrat-600.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/montserrat-700.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/montserrat-400-italic.woff2") format("woff2");
}

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  --color-bg:           #211103;
  --color-text:         #E8E0DA;
  --color-heading:      #659389;
  --color-accent:       #557E73;
  --color-link:         #C4793E;
  --color-link-hover:   #E8E0DA;
  --color-code-bg:      #2C1E10;
  --color-pre-bg:       #1D1A05;
  --color-pre-text:     #E8E0DA;
  --color-strong:       #FBF7F4;

  --font-body: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;

  --max-width: 860px;
  --spacing: 1.5rem;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;              /* 16px baseline */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1.125rem;          /* 18px for comfortable reading */
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ────────────────────────────────────────────────────────── */
.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem var(--spacing) 0;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-btn {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  background-color: #4A6E63;
  color: var(--color-strong);
}

.nav-btn[aria-current="page"] {
  background-color: var(--color-accent);
  color: var(--color-strong);
}

/* ── Main Content Area ─────────────────────────────────────────────────── */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--spacing) 3rem;
}

/* ── Typography — Headings ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2rem;   }
h2 { font-size: 1.65rem; border-bottom: 2px solid var(--color-accent); padding-bottom: 0.3rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem;    }
h6 { font-size: 0.9rem;  }

/* ── Typography — Body ─────────────────────────────────────────────────── */
p {
  margin-bottom: 1.25rem;
}

strong {
  color: var(--color-strong);
}

em {
  font-style: italic;
}

/* ── Links ─────────────────────────────────────────────────────────────── */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-link-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* ── Lists ─────────────────────────────────────────────────────────────── */
ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

li {
  margin-bottom: 0.35rem;
}

li > ul,
li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

/* ── Blockquotes ───────────────────────────────────────────────────────── */
blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 1.5rem 0;
  padding: 0.25rem 1.25rem;
  background-color: rgba(85, 126, 115, 0.1);   /* subtle green tint */
  color: var(--color-text);
  font-style: italic;
}

blockquote p:first-child {
  margin-top: 0.25rem;
}

blockquote :first-child {
  margin-top: 0.25rem;
}

blockquote p:last-child {
  margin-bottom: 0.25rem;
}

/* ── Code ──────────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--color-code-bg);
  color: var(--color-text);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  margin: 1.5rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  background-color: var(--color-pre-bg);
  color: var(--color-pre-text);
  border-radius: 6px;
  line-height: 1.5;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.88em;
}

/* ── Horizontal Rules ──────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 2px solid var(--color-accent);
  margin: 2rem 0;
}

/* ── Images ────────────────────────────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid rgba(85, 126, 115, 0.3);
}

th {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-heading);
  border-bottom-width: 2px;
  border-bottom-color: var(--color-accent);
}

/* ── Skip Navigation Link ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-pre-bg);
  color: var(--color-text);
  padding: 0.5rem 1rem;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ── Responsive — Small Screens ────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-nav {
    padding: 1.5rem 1rem 0;
  }

  .site-main {
    padding: 2rem 1rem;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }

  body {
    font-size: 1rem;
  }

  pre {
    padding: 0.9rem;
    font-size: 0.85rem;
  }
}
