/* The Driveway Garden Planting Calendar — mobile-first styles. */

:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #efe9dc;
  --ink: #1f2a22;
  --ink-2: #4c5a4f;
  --ink-3: #6f7a70;
  --line: #e0d8c7;
  --brand: #2f5d3a;
  --brand-ink: #f4efe3;
  --accent: #c96f3b;
  --focus: #2d6cdf;

  --cat-vegetable: #4f8a3c;
  --cat-edible_seed: #8a7a2e;
  --cat-herb: #2e8a74;
  --cat-flower: #b2527a;
  --cat-fruit: #8a4a9c;

  --tone-new-bg: #e2f0d6;   --tone-new-ink: #2f5d1f;
  --tone-closing-bg: #f8e1cf; --tone-closing-ink: #8a3e12;
  --tone-open-bg: #e9eee6;  --tone-open-ink: #3e4d41;
  --tone-prepare-bg: #e4ebf5; --tone-prepare-ink: #2c4a6e;

  --radius: 14px;
  --shadow: 0 1px 2px rgb(31 42 34 / 0.06), 0 2px 8px rgb(31 42 34 / 0.05);
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131a15;
    --surface: #1b241e;
    --surface-2: #232e27;
    --ink: #e9ece4;
    --ink-2: #bcc5ba;
    --ink-3: #8f9a8f;
    --line: #2e3a31;
    --brand: #8fc27a;
    --brand-ink: #10180f;
    --accent: #e08a55;
    --focus: #7fb0ff;
    --cat-vegetable: #8fc27a;
    --cat-edible_seed: #d1bf6a;
    --cat-herb: #6cc9b0;
    --cat-flower: #e48cb0;
    --cat-fruit: #c59ad4;
    --tone-new-bg: #24381d;   --tone-new-ink: #bfe3a6;
    --tone-closing-bg: #45291a; --tone-closing-ink: #f6c19c;
    --tone-open-bg: #26302a;  --tone-open-ink: #c6d0c4;
    --tone-prepare-bg: #1e2c3d; --tone-prepare-ink: #b5cdf0;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
h1:focus { outline: none; }
p { margin: 0 0 0.6em; }
code { font-size: 0.85em; overflow-wrap: anywhere; }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.test-banner {
  position: sticky; top: 0; z-index: 5;
  background: repeating-linear-gradient(135deg, #ffd84d 0 14px, #ffcf26 14px 28px);
  color: #2b2100; font-weight: 700; font-size: 0.85rem; text-align: center;
  padding: 8px 16px; letter-spacing: 0.01em;
}

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; max-width: 720px; margin: 0 auto; }
.brand-mark { border-radius: 9px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 0.8rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.brand-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }

.tabs { display: flex; gap: 4px; max-width: 720px; margin: 10px auto 0; }
.tabs a {
  flex: 1; text-align: center; text-decoration: none; padding: 12px 8px 10px;
  font-weight: 600; color: var(--ink-3); border-bottom: 3px solid transparent; min-height: 44px;
}
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- layout ---------- */
.main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.loading { color: var(--ink-3); padding: 40px 0; text-align: center; }

.period { margin: 4px 0 14px; }
.period-nav { display: flex; align-items: center; gap: 8px; }
.period-label { flex: 1; text-align: center; min-width: 0; }
.period-label h1 { font-size: clamp(1.45rem, 6vw, 2rem); }
.eyebrow { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0 0 4px; }
.lede { color: var(--ink-2); text-align: center; font-size: 1.05rem; margin: 8px 0 0; }
.today-link { display: block; text-align: center; margin-top: 6px; color: var(--brand); font-weight: 600; padding: 8px; }

.nav-btn {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 1.6rem;
  line-height: 1; color: var(--brand); box-shadow: var(--shadow);
}

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; justify-content: center; }
.chip {
  font: inherit; font-size: 0.86rem; font-weight: 600; min-height: 40px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- sections + cards ---------- */
.rec-section { margin: 0 0 26px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.section-head h2 { font-size: 1.35rem; }
.count {
  font-size: 0.8rem; font-weight: 700; color: var(--ink-3); background: var(--surface-2);
  border-radius: 999px; padding: 1px 9px;
}
.section-blurb, .empty { color: var(--ink-3); font-size: 0.95rem; margin: 0 0 10px; }
.empty { padding: 14px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.cards, .rows, .year-grid, .crop-index, .timeline, .plan-list { list-style: none; margin: 0; padding: 0; }
.cards { display: grid; gap: 10px; }

.card {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-height: 64px;
}
.card::before, .row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cat, var(--brand));
}
.card:active { transform: scale(0.995); }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-title { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; }
.card-variant {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); border-radius: 6px; padding: 1px 7px; vertical-align: 2px; white-space: nowrap;
}
.card-action { font-weight: 600; color: var(--ink); }
.card-timing {
  align-self: flex-start; font-size: 0.85rem; font-weight: 600; border-radius: 6px; padding: 2px 8px; margin: 2px 0 0;
}
.card-note { font-size: 0.92rem; color: var(--ink-2); }
.chevron { flex: none; font-size: 1.6rem; color: var(--ink-3); }

.tone-new { background: var(--tone-new-bg); color: var(--tone-new-ink); }
.tone-closing { background: var(--tone-closing-bg); color: var(--tone-closing-ink); }
.tone-open { background: var(--tone-open-bg); color: var(--tone-open-ink); }
.tone-prepare { background: var(--tone-prepare-bg); color: var(--tone-prepare-ink); }

.cat-vegetable { --cat: var(--cat-vegetable); }
.cat-edible_seed { --cat: var(--cat-edible_seed); }
.cat-herb { --cat: var(--cat-herb); }
.cat-flower { --cat: var(--cat-flower); }
.cat-fruit { --cat: var(--cat-fruit); }

/* month rows */
.rows { display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 18px;
  position: relative; overflow: hidden; min-height: 56px;
}
.row-title { font-weight: 700; }
.row-meta { grid-column: 1; color: var(--ink-2); font-size: 0.93rem; }
.row-dates { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; text-align: right; }

/* year */
.year-grid { display: grid; gap: 10px; margin-bottom: 28px; }
.month-tile {
  display: flex; flex-direction: column; gap: 4px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.month-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.month-year { font-family: var(--font-body); font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }
.month-line { font-size: 0.93rem; color: var(--ink-2); }
.month-line strong { color: var(--ink); }
.crop-index { display: flex; flex-wrap: wrap; gap: 8px; }
.crop-index a {
  display: inline-block; text-decoration: none; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; min-height: 40px;
}

/* ---------- crop detail ---------- */
.back { display: inline-block; text-decoration: none; color: var(--brand); font-weight: 600; padding: 8px 0; min-height: 44px; }
.crop-head { margin: 4px 0 16px; padding-left: 14px; border-left: 5px solid var(--cat, var(--brand)); }
.crop-head h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
.crop-head .lede { text-align: left; }
.detail-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 12px;
}
.detail-block h2 { font-size: 1.15rem; margin-bottom: 8px; }
.detail-block h3 { font-family: var(--font-body); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 12px 0 4px; }
.detail-block > :last-child { margin-bottom: 0; }
.now { border-color: var(--brand); }
.now-item + .now-item { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.now-action { font-weight: 700; font-size: 1.08rem; margin-bottom: 4px; }
.now-window { font-size: 0.93rem; color: var(--ink-2); margin-top: 6px; }
.hint { color: var(--brand); font-weight: 600; font-size: 0.95rem; }
.muted { color: var(--ink-3); }
/*
 * A Driveway Garden note is Ty's own approved wording, kept verbatim in the
 * data. `pre-line` keeps the paragraph breaks he wrote while still wrapping
 * normally at 320 px; a single-paragraph note looks exactly as it did before.
 */
.dg-note blockquote {
  margin: 0; font-family: var(--font-display); font-size: 1.08rem; font-style: italic; color: var(--ink);
  border-left: 3px solid var(--accent); padding-left: 12px; white-space: pre-line;
}
.dg-content { background: var(--surface-2); border-style: dashed; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }

/*
 * One seasonal planting plan on a crop page: the indoor sowing and the
 * transplanting that follows it, read as one block. A crop with a single plan
 * looks exactly as it did before; extra plans are separated, not boxed, so the
 * list still reflows cleanly at 320 px.
 */
.plan + .plan { margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--line); }

/* ---------- gate ---------- */
.gate {
  text-align: center; background: var(--surface); border: 2px solid var(--brand); border-radius: 18px;
  padding: 22px 18px; margin: 8px 0 20px; display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.gate h2 { font-size: 1.4rem; }
.gate p { color: var(--ink-2); margin: 0; }
.gate-lede { font-size: 1.02rem; }

/* What subscribing opens up. Left-aligned so it reads as a list, not a slogan. */
.gate-unlocks {
  list-style: none; margin: 2px auto 4px; padding: 0; display: flex; flex-direction: column; gap: 6px;
  /* Items read left-aligned, but the block itself stays centred in the panel. */
  width: fit-content; max-width: 100%; text-align: left; color: var(--ink-2); font-size: 0.95rem;
}
.gate-unlocks li { display: flex; gap: 8px; align-items: baseline; }
.gate-unlocks li::before { content: "✓"; color: var(--brand); font-weight: 700; flex: none; }

/*
 * Holds the disclosure and Substack's iframe. Substack honors ?transparent=true
 * but has no light-text option, so this surface stays light in dark mode too —
 * otherwise the form's own dark text would be unreadable. If Substack ever
 * ignores the parameter the embed just paints its own white card here instead.
 */
.gate-form {
  background: #fffdf8; border: 1px solid #e0d8c7; border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
/* Fixed inks, not theme tokens: this surface is light in both colour schemes. */
.gate .gate-form p { color: #4c5a4f; }
.gate .gate-form .gate-disclosure { font-size: 0.88rem; line-height: 1.45; text-align: left; }
.gate .gate-form .gate-disclosure strong { color: #1f2a22; }
.gate .gate-form .gate-alt a { color: #2f5d3a; }
/*
 * A cross-origin iframe cannot size itself, and Substack's form grows as its
 * title, tagline, and legal line wrap. These heights clear the tallest wrap at
 * each width; too short and the form scrolls inside its own frame.
 */
.gate-embed { width: 100%; height: 400px; border: 0; background: transparent; display: block; }
@media (min-width: 380px) { .gate-embed { height: 345px; } }
.gate-note { font-size: 0.9rem; font-style: italic; }
.gate-alt { font-size: 0.9rem; }
.gate-alt a { color: var(--brand); font-weight: 600; }
.btn {
  font: inherit; font-weight: 700; display: inline-flex; justify-content: center; align-items: center; text-decoration: none;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-secondary { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-quiet { background: transparent; color: var(--ink-2); }

/* ---------- gated teaser ---------- */
.teaser { margin: 0 0 18px; }
.teaser-lede { font-size: 1.25rem; text-align: center; margin: 0 0 12px; }
.stats { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px;
}
.stat-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; line-height: 1; color: var(--brand); }
.stat-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.teaser-sub { color: var(--ink-3); font-size: 0.92rem; font-weight: 600; margin: 0 0 8px; }
.teaser-more { color: var(--ink-2); font-weight: 600; text-align: center; margin: 10px 0 0; }
.teaser-months {
  list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px;
}
.teaser-months li {
  display: flex; flex-direction: column; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 2px;
}
.tm-name { font-size: 0.78rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.tm-num { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--brand); }
.teaser-months-caption { text-align: center; margin-bottom: 18px; }

/* ---------- content cards ---------- */
.dg-content.has-content { background: var(--surface); border-style: solid; }
.content-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.content-card {
  display: flex; gap: 12px; text-decoration: none; background: var(--surface-2); border-radius: 12px; padding: 12px;
}
.content-img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.content-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.content-kicker { font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.content-title { font-weight: 700; }
.content-meta, .content-context { font-size: 0.88rem; color: var(--ink-3); }
.target { display: block; font-weight: 600; color: var(--brand); }
.footnote { color: var(--ink-3); font-size: 0.85rem; margin: 4px 4px 0; }

/* ---------- misc ---------- */
.notice {
  background: var(--tone-prepare-bg); color: var(--tone-prepare-ink); border-radius: var(--radius);
  padding: 12px 16px; margin: 0 0 18px; font-weight: 600;
}
.how { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.how summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 48px; }
.how ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); }
.how li + li { margin-top: 6px; }

.data-error { background: #fff0ee; color: #5c1209; border: 2px solid #c0392b; border-radius: var(--radius); padding: 18px; }
.data-error h1 { font-size: 1.4rem; margin-bottom: 8px; }
.data-error ol, .data-error ul { padding-left: 20px; }

.site-footer {
  border-top: 1px solid var(--line); padding: 20px 16px 32px; color: var(--ink-3); font-size: 0.9rem; text-align: center;
}
.site-footer > * { max-width: 720px; margin-left: auto; margin-right: auto; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgb(0 0 0 / 0.2); z-index: 20;
}

/* ---------- wider screens ---------- */
@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate { padding: 28px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .card:active { transform: none; }
}
