/* =====================================================================
   STYLE TOGGLE
   ---------------------------------------------------------------------
   The site supports two visual modes, switchable via _data/site.json:
     "style": "plain"  -> headings are plain text with a small monotone
                          Cheysson chip; nothing is boxed.
     "style": "boxed"  -> h1 and h2 sit in a per-section neutral container;
                          intro and lists are also lightly framed.
   In both modes the nav chips are color-previews of their destination.
   ===================================================================== */

/* --------- per-section palettes (apply in BOTH modes) --------- */
:root {
  --bg: #dddbd0;
  --text: #0f7d3d;
  --accent: #0f7d3d;
  --muted: color-mix(in srgb, var(--text) 60%, var(--bg));
  --rule: color-mix(in srgb, var(--text) 35%, var(--bg));
  --column: 38rem;
  --neutral: #f0e9d8;
  --neutral-text: #1a1a1a;
  --neutral-border: #2a2a2a;
  --mark-color: var(--accent);
}

body.section-home     { --bg: #dddbd0; --text: #0f7d3d; --accent: #0f7d3d; --neutral: #f0e9d8; --neutral-text: #1a2a1a; --neutral-border: #1a2a1a; }
body.section-musings  { --bg: #e7eada; --text: #0d6747; --accent: #0d6747; --neutral: #f3efde; --neutral-text: #0d3a28; --neutral-border: #0d6747; --mark-color: #4a2e6b; }
body.section-flying   { --bg: #d0dde1; --text: #3570b3; --accent: #3570b3; --neutral: #e6eef2; --neutral-text: #1a2a40; --neutral-border: #2a3a50; }
body.section-travels  { --bg: #eeaa3d; --text: #0e047d; --accent: #0e047d; --neutral: #f9d088; --neutral-text: #0e047d; --neutral-border: #0e047d; }
body.section-lab      { --bg: #2a2a2a; --text: #d4d4d4; --accent: #e8e8e8; --neutral: #404040; --neutral-text: #ededed; --neutral-border: #6a6a6a; }
body.section-reading  { --bg: #c8d4dc; --text: #2d4a5e; --accent: #2d4a5e; --neutral: #dee7ec; --neutral-text: #1a2a3a; --neutral-border: #2a3a4a; }
body.section-now      { --bg: #2f73c0; --text: #d9dee5; --accent: #d9dee5; --neutral: #4587c8; --neutral-text: #f0f4f8; --neutral-border: #1f5a9e; }
body.section-colophon { --bg: #d8d0c2; --text: #5a4a36; --accent: #5a4a36; --neutral: #e8e0d0; --neutral-text: #2a1a10; --neutral-border: #5a4a36; }
body.section-404      { --bg: #a21a10; --text: #f5a85b; --accent: #f5a85b; --neutral: #6e1208; --neutral-text: #f5a85b; --neutral-border: #f5a85b; }

/* --------- type, base layout (apply in BOTH modes) --------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

nav, main, footer { max-width: var(--column); margin: 0 auto; padding: 0 1.25rem; }

/* --------- nav: chip+label in one anchor, color-previews per destination --------- */
nav {
  padding-top: 1.6rem;
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--text);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.25rem;
}
nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  padding: 0.05rem 0;
  white-space: nowrap;
}
nav .nav-link:hover { text-decoration-style: solid; }
nav .nav-link[aria-current="page"] {
  font-weight: 700;
  text-decoration-style: solid;
  text-decoration-thickness: 2px;
}
nav .nav-chip {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
}

/* destination palettes — used only on hover/focus and for the "you are here" chip.
   default chip state is monotone in the page's accent (see rule below). */
.nav-link-home     { --chip-bg: #dddbd0; --chip-fg: #0f7d3d; }
.nav-link-musings  { --chip-bg: #e7eada; --chip-fg: #4a2e6b; }
.nav-link-flying   { --chip-bg: #d0dde1; --chip-fg: #3570b3; }
.nav-link-travels  { --chip-bg: #eeaa3d; --chip-fg: #0e047d; }
.nav-link-lab      { --chip-bg: #2a2a2a; --chip-fg: #d4d4d4; }
.nav-link-reading  { --chip-bg: #c8d4dc; --chip-fg: #2d4a5e; }
.nav-link-now      { --chip-bg: #2f73c0; --chip-fg: #d9dee5; }
.nav-link-colophon { --chip-bg: #d8d0c2; --chip-fg: #5a4a36; }

nav .nav-chip {
  background: transparent;
  color: var(--accent);
}
nav .nav-link[aria-current="page"] .nav-chip,
nav .nav-link:hover .nav-chip,
nav .nav-link:focus-visible .nav-chip {
  background: var(--chip-bg);
  color: var(--chip-fg);
}

main { padding-bottom: 2rem; }

p { margin: 0 0 0.8rem; }
a { color: var(--accent); text-underline-offset: 3px; }

ul, ol { margin: 0 0 0.85rem; padding-left: 1.4rem; }
li { margin-bottom: 0.2rem; }

.intro {
  font-size: 1.05rem;
  margin: 0.4rem 0 1rem;
}

.meta {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* horizontal rule — Win98 groove */
hr {
  border: 0;
  height: 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 60%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--bg) 80%, var(--text));
  margin: 1.4rem 0;
}

/* sidenote / blockquote (real boxes for genuinely supplementary content) */
aside, .sidenote, blockquote {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0.9rem 0;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--text);
  background: transparent;
}
@media (min-width: 60rem) {
  .sidenote {
    float: right;
    clear: right;
    width: 13rem;
    margin-right: -14.5rem;
    margin-top: 0.2rem;
  }
}

/* post lists */
.post-list { list-style: none; padding: 0; }
.post-list li {
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.post-list li:last-child { border-bottom: 0; }
.post-list .date {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sections { list-style: none; padding: 0; }
.sections li {
  border-bottom: 1px dotted var(--rule);
  padding: 0.4rem 0;
}
.sections li:last-child { border-bottom: 0; }

/* photos */
.photo-block { width: 100%; aspect-ratio: 3 / 2; margin: 0; border: 1px solid var(--text); }
figure { margin: 1.4rem 0; border: 1px solid var(--text); padding: 0.5rem; }
figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; padding-top: 0.3rem; border-top: 1px dotted var(--rule); }

/* lab pieces (controls / diagrams) */
.lab-controls { display: flex; align-items: center; gap: 0.7rem; margin: 0.8rem 0; padding: 0.5rem 0.7rem; border: 1px solid var(--text); font-size: 0.9rem; }
.lab-controls input[type=range] { flex: 1; accent-color: var(--accent); }
svg.breath { display: block; margin: 1rem auto; }
.dichotomy { display: block; margin: 1rem auto; max-width: 100%; height: auto; border: 1px solid var(--text); }
.dichotomy-readout { font-style: italic; padding: 0.6rem 0; margin: 0.6rem 0; min-height: 3.5em; border-top: 1px dotted var(--rule); border-bottom: 1px dotted var(--rule); }
.routines-diagram { display: block; margin: 1rem auto; border: 1px solid var(--text); padding: 0.4rem; }
.routines-readout { color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; font-variant-numeric: tabular-nums; }
.obs-chart { border: 1px solid var(--text); padding: 0.5rem; margin: 1rem 0; min-height: 200px; }
.obs-chart svg { display: block; max-width: 100%; height: auto; }

/* footer */
footer {
  border-top: 1px solid var(--text);
  padding-top: 0.8rem;
  padding-bottom: 1.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2.5rem;
}
footer a { color: var(--muted); }

/* selection */
::selection { background: var(--accent); color: var(--bg); }

/* nothing rounds */
.pattern-mark, .nav-chip, .nav-dot, h1, h2, figure, .photo-block,
.lab-controls, .dichotomy, .routines-diagram, .obs-chart, aside, .sidenote, blockquote {
  border-radius: 0;
}

/* =====================================================================
   PLAIN MODE (default) — early-iteration aesthetic.
   Headings are plain text with a small monotone Cheysson chip.
   No frames. Patterns sit on the page color, in the section accent.
   ===================================================================== */

body.style-plain h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.4rem 0 0.7rem;
}
body.style-plain h1 .pattern-mark {
  color: var(--mark-color);
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  align-self: center;
}

body.style-plain h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
  line-height: 1.25;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
body.style-plain h2 .submark {
  color: var(--mark-color);
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  align-self: center;
}

body.style-plain h3 {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  margin: 1.2rem 0 0.35rem;
}
body.style-plain h4 { font-size: 0.95rem; font-weight: 700; font-style: italic; margin: 1rem 0 0.3rem; }
body.style-plain h5 { font-size: 0.85rem; font-weight: 700; margin: 0.9rem 0 0.25rem; }
body.style-plain h5::before { content: "› "; }
body.style-plain h6 { font-size: 0.85rem; font-weight: 400; font-style: italic; margin: 0.8rem 0 0.25rem; }
body.style-plain h6::before { content: "›› "; }

/* =====================================================================
   BOXED MODE — Win98-style title bars. h1, h2 sit in a per-section
   neutral container with a hard border. Intro + list blocks also
   lightly framed so the boxed headings feel native.
   ===================================================================== */

body.style-boxed h1 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--neutral);
  color: var(--neutral-text);
  border: 1px solid var(--neutral-border);
  padding: 0.45rem 0.7rem;
  margin: 0 0 0.7rem;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
body.style-boxed h1 .pattern-mark {
  color: var(--mark-color);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

body.style-boxed h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--neutral);
  color: var(--neutral-text);
  border: 1px solid var(--neutral-border);
  padding: 0.28rem 0.6rem;
  margin: 1.5rem 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}
body.style-boxed h2 .submark {
  color: var(--mark-color);
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

body.style-boxed h3 {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  margin: 1.2rem 0 0.35rem;
  display: inline-block;
  border: 1px solid var(--text);
  padding: 0.15rem 0.5rem;
  background: transparent;
}
body.style-boxed h4 { font-size: 0.95rem; font-weight: 700; font-style: italic; margin: 1rem 0 0.3rem; }
body.style-boxed h5 { font-size: 0.85rem; font-weight: 700; margin: 0.9rem 0 0.25rem; }
body.style-boxed h5::before { content: "› "; }
body.style-boxed h6 { font-size: 0.85rem; font-weight: 400; font-style: italic; margin: 0.8rem 0 0.25rem; }
body.style-boxed h6::before { content: "›› "; }

/* in boxed mode, the lead paragraph sits in a thin frame so it matches the heading boxes */
body.style-boxed .intro {
  border: 1px solid var(--text);
  padding: 0.6rem 0.85rem;
  background: transparent;
  margin: 0.4rem 0 1rem;
}

/* and post lists / sections lists become bordered frames */
body.style-boxed .post-list,
body.style-boxed .sections {
  border: 1px solid var(--text);
  padding: 0.5rem 0.85rem;
  background: transparent;
  margin: 0.4rem 0 1rem;
}
body.style-boxed .post-list li,
body.style-boxed .sections li {
  border-bottom: 1px dotted var(--rule);
}
body.style-boxed .post-list li:last-child,
body.style-boxed .sections li:last-child { border-bottom: 0; }
