/* MycoEco — minimal, mobile-first, accessible, low-bandwidth */

:root {
  --bg: #f7f5ef;
  --bg-soft: #efece2;
  --ink: #1c2418;
  --ink-soft: #4a5345;
  --rule: #d6d2c2;
  --accent: #355c3a;       /* deep moss green */
  --accent-soft: #5a8a5e;
  --accent-ink: #ffffff;
  --warn-bg: #fff4d6;
  --warn-ink: #6a4b00;
  --warn-rule: #d9b865;
  --danger-bg: #fde4e0;
  --danger-ink: #7a1f12;
  --danger-rule: #c97464;
  --safe-bg: #e6efe2;
  --safe-ink: #1f3a22;
  --max: 64rem;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover, a:focus { color: #1f3a22; }

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", "Noto Serif", serif;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 1.6em; }
h3 { font-size: 1.2rem; margin-top: 1.4em; }

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

ul, ol { padding-left: 1.25rem; }
li + li { margin-top: 0.25em; }

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

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-soft);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.95em;
}

/* Layout */
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 1.25rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}
.brand-mark {
  width: 28px; height: 28px;
  display: inline-block;
}

.skip-link {
  position: absolute; left: -9999px; top: auto;
  background: var(--accent); color: #fff; padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}
.skip-link:focus { left: 1rem; top: 1rem; z-index: 1000; }

/* Nav */
.site-nav {
  margin-left: auto;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.25rem 0.75rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--radius);
  font-size: 0.98rem;
}
.site-nav a:hover, .site-nav a:focus { background: #e6e3d4; color: var(--ink); }
.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Sitewide safety strip */
.safety-strip {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--danger-bg);
  color: var(--danger-ink);
  border-bottom: 2px solid var(--danger-rule);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: center;
  padding: 0.6rem 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.safety-strip a {
  color: var(--danger-ink);
  text-decoration: underline;
}
.safety-strip a:hover, .safety-strip a:focus { color: #4a1308; }

/* Hero */
.hero {
  padding: 2.25rem 0 1.25rem;
}
.hero h1 {
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  margin-bottom: 0.4em;
}
.hero p.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 44rem;
}

/* Sections */
.section { padding: 1.25rem 0 2rem; }
.section + .section { border-top: 1px solid var(--rule); }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  align-items: stretch;
}
/* Auto-fit grid: cards expand to fill the row instead of staying narrow
   and wrapping titles/buttons. Browsers pick the largest count of columns
   where every card is at least the minmax floor wide. */
@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card h3 { margin-top: 0.2em; }
.card p { margin: 0 0 0.75em; }
/* Anchor the final paragraph (usually the action link/button) to the bottom
   so all cards in a row line up nicely regardless of body length. */
.card > p:last-child { margin-top: auto; margin-bottom: 0; }
.card .btn { align-self: flex-start; }

/* Steps */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.steps > li {
  counter-increment: step;
  position: relative;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 0.85rem 3.6rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  border-radius: 999px;
  width: 2.2rem; height: 2.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}
.steps > li > strong { font-weight: 700; }
.steps > li > p:first-child { margin-top: 0; }
.steps > li > p:last-child { margin-bottom: 0; }

/* Boxes */
.box {
  border: 1px solid var(--rule);
  border-left: 5px solid var(--accent);
  background: #fff;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}
.box.warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-color: var(--warn-rule);
  border-left-color: #b88a1a;
}
.box.danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border-color: var(--danger-rule);
  border-left-color: #a83d2c;
}
.box.safe {
  background: var(--safe-bg);
  color: var(--safe-ink);
  border-color: #b5c8ad;
  border-left-color: var(--accent);
}
.box h3 { margin-top: 0; }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
.btn:hover, .btn:focus { background: #284a2e; color: #fff; }
.btn.secondary {
  background: transparent; color: var(--accent);
}
.btn.secondary:hover { background: #e6efe2; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }

/* Tables */
table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  background: #fff; border: 1px solid var(--rule);
}
th, td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; }

/* Diagrams (CSS layered trench) */
.trench {
  display: grid;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
  background: #fff;
}
.trench .layer {
  padding: 0.8rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
}
.trench .layer:last-child { border-bottom: 0; }
.trench .layer .note { font-weight: 400; color: var(--ink-soft); font-size: 0.95rem; }
.layer-leaves { background: #f1ead2; color: #5b4a17; }
.layer-myco   { background: #d9c8a4; color: #4d3d18; }
.layer-sand   { background: #e9dfb6; color: #5b4d18; }
.layer-gravel { background: #c9c4b3; color: #3a3527; }

/* Flow diagram (horizontal arrows) */
.flow {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch;
  margin: 1rem 0;
}
.flow .node {
  background: #fff; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.6rem 0.85rem; flex: 1 1 8rem; min-width: 7rem;
  text-align: center; font-weight: 600; font-size: 0.95rem;
  box-shadow: var(--shadow);
}
.flow .arrow {
  align-self: center; color: var(--accent-soft); font-weight: 700;
  padding: 0 0.1rem;
}

/* Checklists */
.checklist { list-style: none; padding: 0; margin: 0.5rem 0 1.25rem; }
.checklist li {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--rule);
}
.checklist li::before {
  content: "";
  display: inline-block;
  width: 1.1rem; height: 1.1rem;
  border: 2px solid var(--ink-soft);
  border-radius: 3px;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* Footer */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.site-footer .safety-line {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid var(--warn-rule);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
}
.site-footer p { margin: 0.35rem 0; }

/* Utility */
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.no-print { /* default */ }

/* Print */
@media print {
  :root { --bg: #fff; --bg-soft: #fff; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .site-header, .site-nav, .site-footer .nav-row, .no-print, .skip-link { display: none !important; }
  .safety-strip { border-bottom: 1px solid #000; background: #fff; color: #000; }
  .container { max-width: 100%; padding: 0; }
  a { color: #000; text-decoration: underline; }
  .card, .box, .steps > li, .flow .node {
    box-shadow: none;
    border: 1px solid #555;
    background: #fff !important;
    color: #000 !important;
    page-break-inside: avoid;
  }
  h1, h2, h3 { page-break-after: avoid; }
  .checklist li { page-break-inside: avoid; }
  .site-footer { background: #fff; border-top: 1px solid #000; }
  .site-footer .safety-line { border: 1px solid #000; background: #fff; color: #000; }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
