/* ==========================================================================
   FERNWOOD HERBARIUM — shared design system
   Paper stock, ink serif, moss & ochre. Used by every page on the site.
   ========================================================================== */

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

:root {
  /* Stock */
  --paper:      #f6f2e8;
  --paper-2:    #efe9da;
  --paper-3:    #e5ddc9;
  --sheet:      #fbf9f3;

  /* Ink */
  --ink:        #191c17;
  --ink-2:      #3b4136;
  --ink-3:      #6b7161;
  --ink-4:      #9a9c8c;

  /* Accents */
  --moss:       #46603f;
  --moss-2:     #6f8a5e;
  --moss-deep:  #22301e;
  --ochre:      #a9762a;
  --rust:       #8c4a2f;

  --rule:       rgba(25, 28, 23, 0.14);
  --rule-soft:  rgba(25, 28, 23, 0.07);

  --measure:    68ch;
  --gutter:     40px;
  --max:        1240px;

  --ease:       cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Spectral', Georgia, 'Times New Roman', serif;
  font-weight: 300;
  font-size: 17px;
  line-height: 1.62;
  overflow-x: hidden;
  /* Paper tooth: two faint speckle gradients over the flat stock. */
  background-image:
    radial-gradient(circle at 20% 12%, rgba(169, 118, 42, 0.05) 0%, transparent 42%),
    radial-gradient(circle at 82% 68%, rgba(70, 96, 63, 0.05) 0%, transparent 46%);
  background-attachment: fixed;
}

::selection { background: var(--moss); color: var(--sheet); }

img { max-width: 100%; display: block; }

/* Author-level display rules (a.sheet, .nav) would otherwise beat the UA
   default for [hidden], so the filter and menu toggles need this. */
[hidden] { display: none !important; }

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

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
}

.display {
  font-size: clamp(44px, 7.4vw, 104px);
  line-height: 0.96;
  letter-spacing: -0.03em;
}
.h2 { font-size: clamp(30px, 4.2vw, 52px); }
.h3 { font-size: clamp(22px, 2.4vw, 30px); }

em, .italic { font-style: italic; }
.latin { font-style: italic; font-family: 'Fraunces', Georgia, serif; }

.label {
  font-family: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mono {
  font-family: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.lede {
  font-size: clamp(19px, 1.8vw, 23px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 54ch;
}
.prose { max-width: var(--measure); color: var(--ink-2); }
.prose p + p { margin-top: 1.1em; }

a { color: inherit; }

/* --- Layout -------------------------------------------------------------- */

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section { position: relative; }

.section {
  padding: clamp(64px, 9vw, 128px) 0;
  border-top: 1px solid var(--rule);
}
.section--flush { border-top: 0; }

.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: clamp(36px, 5vw, 64px);
}
@media (min-width: 900px) {
  .section-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
    align-items: end;
    gap: 48px;
  }
}
.section-head .lede { margin-bottom: 4px; }

.rule { height: 1px; background: var(--rule); border: 0; }

/* --- Ledger bar (very top strip) ----------------------------------------- */

.ledger {
  background: var(--moss-deep);
  color: rgba(246, 242, 232, 0.72);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ledger .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 32px;
  white-space: nowrap;
  overflow: hidden;
}
.ledger span + span { color: rgba(246, 242, 232, 0.45); }
@media (max-width: 720px) { .ledger .hide-sm { display: none; } }

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

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 242, 232, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 74px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}
.wordmark svg { width: 26px; height: 26px; flex-shrink: 0; }
.wordmark-text {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}
.wordmark-text small {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  margin-top: 4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 30px;
  list-style: none;
}
.nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  padding: 6px 0;
  position: relative;
  transition: color 0.2s var(--ease);
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--moss);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav a:hover { color: var(--moss); }
.nav a:hover::after,
.nav a[aria-current='page']::after { transform: scaleX(1); }
.nav a[aria-current='page'] { color: var(--ink); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  width: 40px; height: 36px;
  cursor: pointer;
  padding: 10px 9px;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span { display: block; height: 1px; background: var(--ink); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .masthead .nav {
    position: absolute;
    top: 74px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 20px;
  }
  .masthead .nav[hidden] { display: none; }
  .masthead .nav a { padding: 13px 0; font-size: 13px; }
  .masthead .btn { display: none; }
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--sheet);
  cursor: pointer;
  transition: background 0.22s var(--ease), color 0.22s var(--ease),
              border-color 0.22s var(--ease), transform 0.22s var(--ease);
}
.btn:hover { background: var(--moss); border-color: var(--moss); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: transparent; border-color: var(--ink); color: var(--moss); transform: translateY(-1px); }

.btn--light { background: var(--sheet); color: var(--moss-deep); border-color: var(--sheet); }
.btn--light:hover { background: transparent; color: var(--sheet); border-color: var(--sheet); }

.btn--wide { width: 100%; justify-content: center; }

.btn .arrow { transition: transform 0.22s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.textlink {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  transition: border-color 0.22s var(--ease), color 0.22s var(--ease);
}
.textlink:hover { border-color: var(--moss); color: var(--moss); }

/* --- Specimen sheet (the recurring card) --------------------------------- */

.sheet {
  position: relative;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 20px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.sheet::before,
.sheet::after {
  /* gummed paper tape at the top corners */
  content: '';
  position: absolute;
  top: -7px;
  width: 46px;
  height: 15px;
  background: rgba(169, 118, 42, 0.16);
  border: 1px solid rgba(169, 118, 42, 0.22);
}
.sheet::before { left: 14px; transform: rotate(-2.5deg); }
.sheet::after { right: 14px; transform: rotate(2deg); }

a.sheet { text-decoration: none; display: block; }
a.sheet:hover,
.sheet--hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -22px rgba(25, 28, 23, 0.4);
}

.sheet-plate {
  aspect-ratio: 5 / 7;
  background: linear-gradient(175deg, #fdfcf7 0%, #f3efe2 100%);
  border: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sheet-plate svg { width: 100%; height: 100%; }

.sheet-label {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sheet-label h3 { font-size: 19px; font-style: italic; }
.sheet-meta { margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-3);
}
.tag--moss { color: var(--moss); border-color: rgba(70, 96, 63, 0.3); background: rgba(70, 96, 63, 0.06); }
.tag--ochre { color: var(--ochre); border-color: rgba(169, 118, 42, 0.3); background: rgba(169, 118, 42, 0.07); }

/* --- Grids --------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.grid--2 { grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid--2 { grid-template-columns: 1fr 1fr; gap: 48px; } }

/* --- Ledger stats -------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  padding: 26px 22px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat b {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat .label { margin-top: 10px; display: block; }

/* --- Dark band ----------------------------------------------------------- */

.band {
  background: var(--moss-deep);
  color: var(--paper);
  padding: clamp(64px, 9vw, 120px) 0;
}
.band .label { color: rgba(246, 242, 232, 0.52); }
.band .lede { color: rgba(246, 242, 232, 0.76); }
.band .rule { background: rgba(246, 242, 232, 0.16); }

/* --- Numbered method list ------------------------------------------------ */

.steps { display: grid; gap: 0; }
.step {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.step:last-child { border-bottom: 1px solid var(--rule); }
.step-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ochre);
  padding-top: 6px;
}
.step h3 { font-size: 24px; margin-bottom: 8px; }
.step p { color: var(--ink-2); max-width: 62ch; }
@media (min-width: 900px) {
  .step { grid-template-columns: 64px minmax(0, 300px) minmax(0, 1fr); gap: 32px; align-items: baseline; }
  .step h3 { margin-bottom: 0; }
}

/* --- Timeline (expeditions) ---------------------------------------------- */

.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--rule);
}
.entry { position: relative; padding: 0 0 clamp(40px, 6vw, 72px); }
.entry:last-child { padding-bottom: 0; }
.entry::before {
  content: '';
  position: absolute;
  left: -32px; top: 9px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--moss);
}
.entry-year {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ochre);
}
.entry h3 { font-size: clamp(24px, 3vw, 34px); margin: 10px 0 12px; }
@media (min-width: 960px) {
  .timeline { padding-left: 0; }
  .timeline::before { left: 172px; }
  .entry { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 56px; }
  .entry::before { left: 168px; }
  .entry-side { padding-top: 2px; }
}

/* --- Journal list -------------------------------------------------------- */

.dispatch {
  display: grid;
  gap: 10px;
  padding: 30px 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  transition: background 0.22s var(--ease);
}
.dispatch:last-of-type { border-bottom: 1px solid var(--rule); }
.dispatch:hover { background: rgba(70, 96, 63, 0.04); }
.dispatch h3 { font-size: clamp(22px, 2.6vw, 30px); transition: color 0.2s var(--ease); }
.dispatch:hover h3 { color: var(--moss); }
.dispatch p { color: var(--ink-2); max-width: 66ch; }
@media (min-width: 900px) {
  .dispatch {
    grid-template-columns: 140px minmax(0, 1fr) 110px;
    gap: 40px;
    align-items: baseline;
    padding-left: 8px; padding-right: 8px;
  }
  .dispatch .dispatch-body { display: grid; gap: 10px; }
  .dispatch .dispatch-read { text-align: right; }
}

.dropcap::first-letter {
  float: left;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 72px;
  line-height: 0.78;
  padding: 6px 12px 0 0;
  color: var(--moss);
}

/* --- Filter chips -------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 9px 15px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--sheet);
}

/* --- Forms --------------------------------------------------------------- */

.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field input,
.field select {
  font-family: 'Spectral', Georgia, serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 13px 14px;
  width: 100%;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(70, 96, 63, 0.12);
}
.field input[aria-invalid='true'] { border-color: var(--rust); }
.field .error {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--rust);
  min-height: 1px;
}
.field-row { display: grid; gap: 0 18px; }
@media (min-width: 620px) { .field-row { grid-template-columns: 1fr 1fr; } }

.check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-bottom: 22px;
}
.check input { margin-top: 3px; accent-color: var(--moss); width: 15px; height: 15px; flex-shrink: 0; }

.form-note {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-3);
}

.form-status {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(70, 96, 63, 0.3);
  background: rgba(70, 96, 63, 0.07);
  border-radius: 2px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--moss);
}
.form-status[hidden] { display: none; }

/* --- Auth split layout --------------------------------------------------- */

.auth {
  display: grid;
  min-height: calc(100vh - 106px);
  grid-template-columns: 1fr;
}
@media (min-width: 980px) { .auth { grid-template-columns: 1fr 0.9fr; } }

.auth-form {
  padding: clamp(44px, 6vw, 84px) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-form > div { width: 100%; max-width: 440px; }

.auth-aside {
  background: var(--moss-deep);
  color: var(--paper);
  padding: clamp(44px, 6vw, 84px) var(--gutter);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
@media (min-width: 980px) { .auth-aside { display: flex; } }
.auth-aside .label { color: rgba(246, 242, 232, 0.5); }
.auth-aside blockquote {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.18;
  font-style: italic;
  letter-spacing: -0.02em;
}
.auth-aside figure svg { width: 100%; max-width: 260px; opacity: 0.9; }

/* --- Footer -------------------------------------------------------------- */

.footer {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  padding: clamp(52px, 7vw, 88px) 0 28px;
}
.footer-cols {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer-cols { grid-template-columns: 1.6fr repeat(3, 1fr); gap: 48px; } }
.footer h4 { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 16px; font-weight: 500; }
.footer ul { list-style: none; display: grid; gap: 10px; }
.footer ul a { text-decoration: none; font-size: 15px; color: var(--ink-2); transition: color 0.2s var(--ease); }
.footer ul a:hover { color: var(--moss); }
.footer-base {
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  justify-content: space-between;
  align-items: center;
}

/* --- Reveal on scroll ---------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Utilities ----------------------------------------------------------- */

.stack { display: grid; gap: 18px; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.mt-l { margin-top: clamp(32px, 4vw, 56px); }
.mt-m { margin-top: 24px; }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--sheet); padding: 10px 16px; z-index: 200;
}
.skip:focus { left: 12px; top: 12px; }
