/* ------------------------------------------------------------------
   IA Garden — custom layer on top of Pico CSS v2
   Layout: page-level grid. The left rail IS the sidebar band —
   a real grid track from the viewport edge, full page height.
------------------------------------------------------------------- */

:root {
  --font-display: "IBM Plex Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    monospace;

  /* Density: pin Pico's progressive root scaling to a compact base */
  --pico-font-size: 93.75%;
  --pico-spacing: 0.85rem;
  --pico-typography-spacing-vertical: 0.9rem;
  --pico-border-radius: 0.45rem;
}

/* Scheme tokens — light (selector mirrors Pico's own light block) */
:root:not([data-theme="dark"]) {
  --bg: #f4f5f2;
  --rail-bg: #ebede8;
  --line: #dee2d8;
  --now-bg: #e5ebdf;
  --now-line: #d2dccb;
  --dash: #c0cab6;
  --furrow: rgba(47, 107, 79, 0.05);
  --glow: rgba(74, 122, 90, 0.07);

  --pico-background-color: var(--bg);
  --pico-color: #2e332e;
  --pico-muted-color: #67725f;
  --pico-muted-border-color: var(--line);
  --pico-h1-color: #20251d;
  --pico-h2-color: #20251d;
  --pico-h3-color: #28302a;
  --pico-primary: #2f6b4f;
  --pico-primary-background: #2f6b4f;
  --pico-primary-border: #2f6b4f;
  --pico-primary-underline: rgba(47, 107, 79, 0.35);
  --pico-primary-hover: #245741;
  --pico-primary-hover-background: #245741;
  --pico-primary-hover-border: #245741;
  --pico-primary-hover-underline: #245741;
  --pico-primary-focus: rgba(47, 107, 79, 0.22);
  --pico-primary-inverse: #f5f8f4;
  --pico-text-selection-color: rgba(47, 107, 79, 0.16);
  --pico-card-background-color: #fbfcfa;
  --pico-card-border-color: var(--line);
  --pico-card-box-shadow: none;
}

@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111512;
    --rail-bg: #151a15;
    --line: #262c25;
    --now-bg: #172019;
    --now-line: #253126;
    --dash: #37422f;
    --furrow: rgba(138, 184, 148, 0.06);
    --glow: rgba(109, 158, 120, 0.07);

    --pico-background-color: var(--bg);
    --pico-color: #c9d1c6;
    --pico-muted-color: #87917f;
    --pico-muted-border-color: var(--line);
    --pico-h1-color: #e7ece3;
    --pico-h2-color: #e7ece3;
    --pico-h3-color: #d8dfd3;
    --pico-primary: #8ab894;
    --pico-primary-background: #3f7f58;
    --pico-primary-border: #3f7f58;
    --pico-primary-underline: rgba(138, 184, 148, 0.35);
    --pico-primary-hover: #a9d2b2;
    --pico-primary-hover-background: #4c9568;
    --pico-primary-hover-border: #4c9568;
    --pico-primary-hover-underline: #a9d2b2;
    --pico-primary-focus: rgba(138, 184, 148, 0.28);
    --pico-primary-inverse: #10150f;
    --pico-text-selection-color: rgba(138, 184, 148, 0.28);
    --pico-card-background-color: #191f1a;
    --pico-card-border-color: var(--line);
    --pico-card-box-shadow: none;
  }
}

/* Atmosphere -------------------------------------------------------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    55rem 26rem at 50% -12%,
    var(--glow),
    transparent 70%
  );
}

/* Base ---------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

section[id] {
  scroll-margin-top: 1.25rem;
}

/* Typography ------------------------------------------------------------ */

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.9rem;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pico-primary);
  margin-bottom: 0.35rem;
}

/* Layout — mobile first: rail is a top band, content flows below ------------ */

.rail {
  position: relative;
  background: var(--rail-bg);
  border-bottom: 1px solid var(--line);
  padding: 1.5rem 1.25rem 1.75rem;
}

.content {
  padding: 1.5rem 1.25rem 0;
}

/* Desktop: the rail becomes a full-height sidebar track.
   Track width = (viewport space outside the 62rem measure) + 16.5rem,
   so the band always meets the viewport's left edge. */
@media (min-width: 56rem) {
  .page {
    display: grid;
    grid-template-columns: minmax(16.5rem, calc(50vw - 14.5rem)) minmax(0, 1fr);
    min-height: 100vh;
  }

  .rail {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 0;
  }

  .rail-inner {
    position: sticky;
    top: 0;
    box-sizing: border-box;
    width: 15.25rem; /* 16.5rem track minus 1.25rem measure offset */
    margin-left: auto;
    padding: 1.75rem 1.5rem 2rem 0;
  }

  .content {
    box-sizing: border-box;
    max-width: 45.5rem;
    padding: 1.75rem 1.25rem 0 2.5rem;
  }
}

/* Rail contents ---------------------------------------------------------- */

.sprig {
  display: block;
  width: 1.4rem;
  height: auto;
  margin-bottom: 0.7rem;
}

.sprig-watermark {
  display: none;
}

@media (min-width: 56rem) {
  .sprig-watermark {
    display: block;
    position: absolute;
    bottom: 1.25rem;
    /* align with .rail-inner's left edge at any viewport width */
    left: max(1.25rem, calc(50vw - 29.75rem));
    width: 6.5rem;
    height: auto;
    pointer-events: none;
    color: var(--pico-primary);
    opacity: 0.09;
  }

  .sprig-watermark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.1;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

.site-title {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
}

.role {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--pico-muted-color);
  margin-bottom: 1.3rem;
}

.role strong {
  color: var(--pico-color);
  font-weight: 600;
}

.now {
  background: var(--now-bg);
  border: 1px solid var(--now-line);
  border-radius: var(--pico-border-radius);
  padding: 0.7rem 0.85rem;
  margin-bottom: 1.1rem;
}

.now-row {
  display: flex;
  gap: 0.7rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.5;
}

.now-row + .now-row {
  margin-top: 0.35rem;
}

.now-label {
  flex: 0 0 2.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pico-primary);
}

.now-value {
  color: var(--pico-color);
}

.rail-x {
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  margin: 0;
}

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

.main section {
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
}

.main section:first-child {
  border-top: 0;
  padding-top: 0;
}

/* Seedling placeholder ------------------------------------------------------- */

article.seedling {
  margin: 0;
  padding: 1.05rem 1.15rem;
  background: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--furrow) 0,
    var(--furrow) 1px,
    transparent 1px,
    transparent 9px
  );
  border: 1.5px dashed var(--dash);
  box-shadow: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--pico-primary);
  margin-bottom: 0.5rem;
}

.status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--pico-primary);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

.seedling-text {
  margin-bottom: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--pico-muted-color);
  max-width: 40rem;
}

/* Principles — hairline index list ---------------------------------------------- */

.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.principles li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.p-index {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--pico-primary);
  padding-top: 0.22rem;
}

.p-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--pico-muted-color);
}

.p-text strong {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--pico-h3-color);
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 2rem;
  padding-block: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--pico-muted-color);
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
