/* Fernmargin — windowsill journal. Sage on parchment, editorial specimen layout. System fonts only. */

:root {
  --paper: #f4efe3;
  --paper-2: #ebe4d2;
  --ink: #262b23;
  --ink-2: #4a5044;
  --sage: #52634b;
  --sage-2: #6e8064;
  --sage-pale: #dde3d2;
  --rule: #c9c4b3;
  --ochre: #8c4f20;
  --focus: #8c4f20;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 66ch;
  --gap: clamp(72px, 10vw, 128px);
  --wrap: 1120px;
  --pad: clamp(20px, 4vw, 40px);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  font-feature-settings: "onum", "pnum";
}

body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(110, 128, 100, 0.10), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(140, 79, 32, 0.07), transparent 50%);
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }

a { color: var(--sage); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ochre); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
[id] { scroll-margin-top: 84px; }

.skip {
  position: absolute; left: var(--pad); top: -100px; z-index: 20;
  padding: 8px 12px; background: var(--ink); color: var(--paper);
}
.skip:focus { top: 8px; }

/* Masthead ----------------------------------------------------------------- */

.masthead {
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}

.masthead__row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 64px; flex-wrap: wrap;
}

.brand {
  font: 600 1.15rem/1 var(--serif); letter-spacing: 0.01em; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 10px;
}
.brand__mark {
  width: 14px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--sage);
  transform: rotate(-30deg); display: inline-block;
}

.nav { display: flex; gap: clamp(16px, 2.5vw, 32px); }
.nav a {
  font: 500 0.8125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; padding: 10px 0; border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a:focus-visible { color: var(--ink); border-bottom-color: var(--ochre); }

.nav-toggle {
  display: none; align-items: center; gap: 10px;
  font: 500 0.8125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  background: none; border: 1px solid var(--rule); color: var(--ink); padding: 10px 14px; cursor: pointer;
}
.nav-toggle__bar {
  width: 16px; height: 2px; background: currentColor; position: relative; display: block;
}
.nav-toggle__bar::before, .nav-toggle__bar::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: currentColor;
}
.nav-toggle__bar::before { top: -5px; }
.nav-toggle__bar::after { top: 5px; }

/* Type ---------------------------------------------------------------------- */

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; line-height: 1.08; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.2vw, 4.75rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); margin-bottom: 0.4em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: var(--measure); }

.kicker, .running {
  font: 500 0.75rem/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
  margin: 0 0 1.25rem;
}
.running { display: flex; align-items: center; gap: 12px; }
.running::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.deck, .lede { font-size: 1.2rem; line-height: 1.5; color: var(--ink-2); max-width: 56ch; }
.lede { margin-bottom: 2.25rem; }
.small { font: 400 0.875rem/1.5 var(--sans); color: var(--ink-2); }

/* Hero ---------------------------------------------------------------------- */

.hero {
  display: grid; grid-template-columns: 7fr 5fr; gap: clamp(32px, 6vw, 96px); align-items: center;
  padding-block: clamp(40px, 6vw, 72px) var(--gap);
  border-bottom: 1px solid var(--rule);
}
.hero__text h1 { margin-bottom: 0.5em; }

.contents { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--rule); max-width: 34rem; }
.contents li { border-bottom: 1px solid var(--rule); }
.contents a {
  display: flex; align-items: baseline; gap: 16px; padding: 12px 0; color: var(--ink); text-decoration: none;
  font-size: 1.05rem;
}
.contents a span { font: 500 0.75rem/1 var(--mono); color: var(--ochre); min-width: 2ch; }
.contents a:hover, .contents a:focus-visible { color: var(--ochre); padding-left: 6px; }

.plate {
  margin: 0; padding: clamp(16px, 2vw, 28px);
  background: var(--paper-2); border: 1px solid var(--rule); position: relative;
  box-shadow: inset 0 0 0 6px var(--paper-2), inset 0 0 0 7px var(--rule);
}
.plate__art { display: block; width: 100%; height: auto; max-height: 440px; }
.plate .stem path { fill: none; stroke: var(--sage); stroke-width: 2.2; stroke-linecap: round; }
.plate .leaf use { fill: var(--sage-pale); stroke: var(--sage); stroke-width: 1.4; stroke-linejoin: round; }
.plate .leaf use[href="#rib"] { fill: none; stroke: var(--sage-2); stroke-width: 1; }
.plate .bud circle { fill: var(--ochre); opacity: 0.85; }
.plate__label {
  margin-top: 16px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--rule);
  display: grid; gap: 4px; font: 400 0.8125rem/1.45 var(--sans); color: var(--ink-2);
}
.plate__label em { font-family: var(--serif); font-size: 1rem; color: var(--ink); }
.plate__no { font: 500 0.7rem/1 var(--mono); letter-spacing: 0.1em; color: var(--ochre); }

/* Sections ------------------------------------------------------------------ */

.section { padding-block: var(--gap); border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }

/* Selector ------------------------------------------------------------------ */

.selector { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 40px; align-items: start; }
.seg { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg--wide, .check, .small, .result { grid-column: 1 / -1; }
.seg legend {
  font: 500 0.75rem/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
  padding: 0; margin-bottom: 10px; width: 100%;
}
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--rule); background: var(--paper);
  font: 500 0.9rem/1 var(--sans); color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.seg input:checked + span { background: var(--sage); border-color: var(--sage); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.seg label:hover span { border-color: var(--sage-2); color: var(--ink); }
.seg input:checked:hover + span { color: var(--paper); }

.check { display: flex; align-items: center; gap: 10px; font: 400 0.95rem/1.4 var(--sans); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--sage); }

.result { display: block; background: var(--paper-2); border: 1px solid var(--rule); padding: 8px 24px; }
.result dl { margin: 0; }
.result dl > div { display: grid; grid-template-columns: 6rem 1fr; gap: 16px; padding: 14px 0; }
.result dl > div + div { border-top: 1px solid var(--rule); }
.result dt {
  font: 500 0.75rem/1.6 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
}
.result dd { margin: 0; }
.result strong { color: var(--ochre); font-weight: 600; }

/* Guides (disclosure sheets) ----------------------------------------------- */

.sheet { border-top: 1px solid var(--ink); }
.sheet:last-of-type { border-bottom: 1px solid var(--ink); }
.sheet summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 3.5rem 1fr auto 1.5rem;
  align-items: baseline; gap: 16px; padding: 20px 0;
}
.sheet summary::-webkit-details-marker { display: none; }
.sheet summary::after {
  content: "+"; font: 400 1.6rem/1 var(--sans); color: var(--ochre); text-align: right;
  transition: transform 0.2s;
}
.sheet[open] summary::after { content: "−"; }
.sheet summary:hover .sheet__title { color: var(--ochre); }
.sheet__no { font: 500 0.95rem/1 var(--mono); color: var(--ochre); letter-spacing: 0.06em; }
.sheet__title { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 500; line-height: 1.2; }
.sheet__meta { font: 400 0.8rem/1.4 var(--sans); color: var(--ink-2); letter-spacing: 0.04em; }
.sheet__body { padding: 4px 0 24px 3.5rem; max-width: calc(var(--measure) + 3.5rem); }
.sheet__body p:last-child { margin-bottom: 0; }
.sheet__body strong { font-weight: 600; font-style: italic; }

/* Calendar ------------------------------------------------------------------ */

.seasons { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 1px solid var(--rule); }
.season { padding: 4px 24px 8px; border-right: 1px solid var(--rule); }
.season h3 { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.season h3 span {
  font: 500 0.75rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ochre);
}
.season ul { margin: 0; padding: 0; list-style: none; font-size: 0.98rem; }
.season li { padding: 8px 0; border-top: 1px solid var(--rule); line-height: 1.45; }

/* Herb index ---------------------------------------------------------------- */

.specimens { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.specimens th, .specimens td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; }
.specimens thead th {
  font: 500 0.72rem/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
  border-bottom: 1px solid var(--ink);
}
.specimens tbody tr { border-bottom: 1px solid var(--rule); }
.specimens tbody th { font-weight: 600; }
.specimens tbody th em { display: block; font-weight: 400; color: var(--ink-2); font-size: 0.9rem; }
.specimens td:first-child { font: 500 0.8rem/1.6 var(--mono); color: var(--ochre); }

/* Colophon ------------------------------------------------------------------ */

.colophon { border-top: 3px solid var(--ink); background: var(--paper-2); padding-block: 56px 32px; }
.colophon__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; font-size: 0.95rem; }
.colophon__links { list-style: none; margin: 0; padding: 0; }
.colophon__links li { border-bottom: 1px solid var(--rule); }
.colophon__links a { display: block; padding: 8px 0; text-decoration: none; color: var(--ink); }
.colophon__links a:hover { color: var(--ochre); }
.colophon__foot {
  margin: 40px auto 0; padding-top: 16px; border-top: 1px solid var(--rule);
  font: 400 0.8rem/1.5 var(--sans); color: var(--ink-2); max-width: var(--wrap);
}

/* Responsive ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .plate { max-width: 420px; }
  .seasons { grid-template-columns: 1fr 1fr; border-left: 0; }
  .season { border-right: 0; padding: 4px 0 16px; }
  .season:nth-child(odd) { padding-right: 24px; }
  .season:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--rule); }
  .colophon__grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; flex-direction: column; gap: 0; width: 100%; padding-bottom: 8px;
    border-top: 1px solid var(--rule);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .nav a:last-child { border-bottom: 0; }

  .plate__art { max-height: 300px; }
  .selector { grid-template-columns: 1fr; gap: 24px; }
  .result { padding-inline: 16px; }
  .result dl > div { grid-template-columns: 1fr; gap: 4px; }

  .sheet summary { grid-template-columns: 2.5rem 1fr 1.5rem; }
  .sheet__meta { grid-column: 2; grid-row: 2; }
  .sheet summary::after { grid-column: 3; grid-row: 1; }
  .sheet__body { padding-left: 0; }

  .specimens thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .specimens tbody tr { display: block; position: relative; padding: 12px 0 16px; }
  .specimens tbody th, .specimens td { display: block; padding: 4px 0; }
  .specimens tbody th { font-size: 1.15rem; padding-bottom: 8px; }
  .specimens tbody th em { display: inline; font-size: 0.95rem; margin-left: 6px; }
  .specimens td:first-child { position: absolute; top: 14px; right: 0; }
  .specimens td[data-l]:not(:first-child)::before {
    content: attr(data-l); display: inline-block; min-width: 6.5em;
    font: 500 0.7rem/1.6 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage);
  }
}

@media (max-width: 420px) {
  .seasons { grid-template-columns: 1fr; }
  .season:nth-child(odd), .season:nth-child(even) { padding-inline: 0; border-left: 0; }
  .seg span { padding: 9px 13px; }
}

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

@media print {
  .masthead, .nav-toggle, .skip { display: none; }
  .sheet { break-inside: avoid; }
}
