/* =============================================================
   Vibe Coding for Agroecology — zine-style system
   Whole Earth Catalog meets a small-press academic pamphlet.
   No frameworks. No dark mode. No gradients. Earth tones only.
   ============================================================= */

:root {
  /* Earth-tone palette */
  --color-terracotta: #b54e2e;
  --color-ochre:      #c9963a;
  --color-green:      #3d4a2c;
  --color-green-dark: #2a3320;
  --color-cream:      #f4ede0;
  --color-paper:      #faf6ec;
  --color-ink:        #1c1a17;
  --color-fade:       #6b5d4d;
  --color-warn:       #a8341f;

  /* Type */
  --font-display: 'Bitter', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Work Sans', 'Helvetica Neue', sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --margin:    clamp(1rem, 4vw, 3rem);
  --rule:      1.5px solid var(--color-ink);
  --rule-thin: 1px dotted var(--color-fade);
  --rule-thick: 3px double var(--color-ink);
  --maxw:      70ch;
  --maxw-wide: 95ch;
}

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

/* Base */
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--color-paper);
  color: var(--color-ink);
  line-height: 1.65;
  padding: var(--margin) var(--margin) 4rem;
  max-width: var(--maxw);
  margin: 0 auto;
}
body.wide { max-width: var(--maxw-wide); }

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-green);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
  margin-bottom: 0.8rem;
}
h1 .subhead {
  display: block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--color-fade);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.5rem;
}
h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: var(--rule);
}
h3 {
  font-size: 1.25rem;
  margin: 1.6rem 0 0.6rem;
  color: var(--color-green-dark);
}
h4 {
  font-size: 1.05rem;
  margin: 1rem 0 0.4rem;
  color: var(--color-green-dark);
}

/* Body text */
p { margin-bottom: 1rem; }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--color-green-dark); }
.muted { color: var(--color-fade); }
small { font-size: 0.85rem; }

/* Links */
a {
  color: var(--color-terracotta);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover, a:focus { color: var(--color-warn); }
a:focus-visible {
  outline: 2px solid var(--color-ochre);
  outline-offset: 2px;
}

/* Lists */
ul, ol { margin: 0 0 1.2rem 1.4rem; }
li { margin-bottom: 0.35rem; }
li::marker { color: var(--color-fade); }

/* Rules */
hr {
  border: none;
  border-top: var(--rule);
  margin: 2.5rem 0;
}
hr.thick { border-top: var(--rule-thick); }
hr.fancy {
  border: none;
  text-align: center;
  margin: 2.5rem 0;
  color: var(--color-fade);
}
hr.fancy::before {
  content: "❦   ✦   ❦";
  letter-spacing: 0.5em;
  font-size: 1rem;
}

/* Header / nav */
header {
  border-bottom: var(--rule);
  padding-bottom: 1.2rem;
  margin-bottom: 2.5rem;
}
.masthead {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-fade);
  margin-bottom: 0.4rem;
}
.masthead .issue {
  color: var(--color-terracotta);
  font-weight: 700;
}
nav ul {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
}
nav a { text-decoration: none; font-weight: 600; }
nav a[aria-current="page"] { color: var(--color-ink); border-bottom: 2px solid var(--color-terracotta); }
nav a:hover, nav a:focus { text-decoration: underline; }

/* Pull quote / claim */
.claim {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.4;
  border-left: 4px solid var(--color-terracotta);
  padding: 0.6rem 0 0.6rem 1.2rem;
  margin: 1.8rem 0;
  color: var(--color-green-dark);
  font-style: italic;
}
.claim strong { color: var(--color-terracotta); font-style: normal; }

/* Hero image (banner at top of index.html) */
.hero-image {
  margin: 0 0 1.8rem 0;
  border: var(--rule);
  background: var(--color-cream);
  padding: 0;
}
.hero-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Asymmetric grid for cards */
.grid-asym {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}
.card {
  background: var(--color-cream);
  border: var(--rule);
  padding: 1.1rem 1.2rem 1rem;
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 1px dashed var(--color-fade);
  pointer-events: none;
}
.card h3 { margin-top: 0.2rem; }
.card .meta { color: var(--color-fade); font-size: 0.88rem; margin-bottom: 0.6rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: var(--rule-thin);
  vertical-align: top;
}
th {
  font-family: var(--font-display);
  background: var(--color-cream);
  border-bottom: var(--rule);
  font-weight: 700;
}
tbody tr:hover { background: rgba(197, 150, 58, 0.08); }

/* Forms */
label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0.4rem 0 0.3rem;
  color: var(--color-green-dark);
}
.hint { font-size: 0.85rem; color: var(--color-fade); margin: 0.1rem 0 0.6rem; font-style: italic; }

textarea, input[type="text"], input[type="number"], select {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--color-cream);
  color: var(--color-ink);
  border: var(--rule);
  padding: 0.6rem 0.7rem;
  width: 100%;
  border-radius: 0;
}
textarea { min-height: 280px; resize: vertical; line-height: 1.45; }
input[type="text"], input[type="number"] { max-width: 18rem; }
select { max-width: 18rem; }

button, .btn {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  background: var(--color-terracotta);
  color: var(--color-paper);
  border: var(--rule);
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  letter-spacing: 0.02em;
  border-radius: 0;
}
button:hover, .btn:hover { background: var(--color-warn); }
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--color-ochre);
  outline-offset: 2px;
}
button.ghost, .btn.ghost {
  background: var(--color-cream);
  color: var(--color-ink);
}
button.ghost:hover { background: var(--color-ochre); color: var(--color-paper); }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0 1.2rem; }

/* Outputs */
.output {
  border: var(--rule);
  padding: 1.1rem 1.2rem 1rem;
  margin: 1.5rem 0;
  background: var(--color-paper);
}
.output h3 {
  margin: 0 0 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: var(--rule-thin);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.output h3 .actions { font-size: 0.85rem; font-weight: 400; }
.output h3 .actions a { text-decoration: none; }

/* DIY flag */
.diy-yes { color: var(--color-green); font-weight: 600; }
.diy-no  { color: var(--color-warn); font-weight: 600; }
.diy-maybe { color: var(--color-ochre); font-weight: 600; }

/* Machine header */
.machine-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.2rem;
  margin-bottom: 0.5rem;
  border-bottom: var(--rule-thin);
  padding-bottom: 0.4rem;
}
.machine-header .id {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-fade);
}
.machine-header h4 { margin: 0; color: var(--color-green); }

/* Print-friendly card (laminated shop card) */
.shop-card {
  background: white;
  color: black;
  border: 2px solid black;
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.35;
  margin: 1rem 0;
}
.shop-card h5 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.3rem;
  border-bottom: 1.5px solid black;
  padding-bottom: 0.2rem;
}
.shop-card dl { display: grid; grid-template-columns: 1fr 2fr; gap: 0.15rem 0.5rem; }
.shop-card dt { font-weight: 700; }
.shop-card .specs-block { margin-top: 0.5rem; border-top: 1px dashed black; padding-top: 0.4rem; }

/* Process page annotations */
.annotation {
  border-left: 3px solid var(--color-ochre);
  padding: 0.4rem 0 0.4rem 0.9rem;
  margin: 0.8rem 0 1rem;
  color: var(--color-fade);
  font-size: 0.95rem;
  background: rgba(201, 150, 58, 0.07);
}
.annotation strong { color: var(--color-green-dark); }
.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.diff > div {
  border: var(--rule);
  padding: 0.7rem 0.8rem;
  font-size: 0.92rem;
}
.diff .before { background: #f6e6e1; }
.diff .after  { background: #e6efe1; }
.diff h5 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.diff .before h5 { color: var(--color-warn); }
.diff .after h5  { color: var(--color-green); }

@media (max-width: 700px) {
  .diff { grid-template-columns: 1fr; }
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: var(--rule-thick);
  font-size: 0.88rem;
  color: var(--color-fade);
  line-height: 1.5;
}
footer p { margin-bottom: 0.4rem; }
footer a { color: var(--color-green); }

/* Utility */
.no-print {}
.print-only { display: none; }

/* Print styles for laminated shop cards */
@media print {
  body { background: white; color: black; padding: 0.5cm; max-width: 100%; font-size: 11pt; }
  header, nav, footer, .no-print, .toolbar, .intake, .case-intro, .case-claims { display: none !important; }
  .output, .shop-card { border: 1.5px solid black; page-break-inside: avoid; background: white; color: black; }
  .shop-card { page-break-after: always; }
  h1, h2, h3, h4 { color: black; }
}

/* Mobile tweaks */
@media (max-width: 600px) {
  html { font-size: 17px; }
  nav ul { gap: 0.5rem 0.8rem; font-size: 0.9rem; }
  .grid-asym { grid-template-columns: 1fr; }
  .machine-header { font-size: 0.95rem; }
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-green);
  color: var(--color-paper);
  padding: 0.5rem 1rem;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 0; }
