/* ecosystem.css 1b063bb8ac: generated by freelancer-portfolio `npm run eco:sync`. Do not edit here. */
/*
 * Design tokens (stage 1 of docs/ui-ux-improvement-plan.md).
 * Ecosystem palette (docs/ecosystem-plan.md, docs/design-system.md): warm paper #ECE9E2 base, coral accent, indigo as secondary.
 * Shared with the portfolio site via `npm run eco:sync` (auto-synced by .github/workflows/eco-sync.yml).
 * Contrast (WCAG 2.x) is verified by scripts/check-contrast.mjs: run `npm run contrast`.
 * Legacy names (--paper, --card, --ink, --ink-2, --mute, --line, --line-strong, --accent-soft, --ok, --on-accent)
 * are kept as aliases of the semantic tokens so existing CSS keeps working.
 */
:root {
  /* Semantic colour tokens: light */
  --bg: #ECE9E2;
  --surface: #FBFAF6;
  --surface-sunk: #E2DFD7;
  --text: #16181D;
  --text-2: #444A55;
  --text-mute: #565C69;
  --border: #D3CFC4;
  --border-control: #6B717D;
  /* Accent is coral (stage 2). Light: the deep coral, safe as text/link/border on paper, white on top when filled.
     Bright coral fills with ink text come from --eco-coral / --eco-on-coral. Indigo is the secondary colour. */
  --accent: #9B4327;
  --accent-hover: #7F361E;
  --on-accent: #FFFFFF;
  --accent-soft: #F6DDD0;
  --accent-soft-text: #8A3A20;
  --secondary: #2748B8;
  --secondary-hover: #1E3A9A;
  --ok: #14693A;
  --ok-bg: #E3F4EA;
  --ok-text: #14693A;
  --warn: #8A5A00;
  --warn-bg: #FBF0D9;
  --warn-text: #7A4E00;
  --danger: #B42318;
  --danger-bg: #FCE8E6;
  --danger-text: #9E1C12;
  --info: #0B6A8A;
  --shadow-stuck: rgba(22, 24, 29, 0.08);
  /* Page background: soft warm-cool wash, corner glows, dot grid. Worst-case composites are the
     *-wash hex values below (checked by scripts/check-contrast.mjs). */
  --bg-mid: #F3F1EC;
  --bg-glow-cool: rgba(217, 119, 87, 0.12);
  --bg-glow-warm: rgba(245, 196, 81, 0.12);
  --bg-wash-cool: #E6D6CD;
  --bg-wash-warm: #EDE5D1;
  --deco-dot: #B9B7AE;
  --deco-circle: #F1D79A;
  --deco-ring: #A7B1D3;
  --plane-a: #8FA8FF;
  --plane-b: #7DC4E8;
  --plane-c: #7ED3A8;
  --plane-d: #F2C96B;
  /* Neo-brutalist cards (.card-brutal): bold outline and a hard, offset shadow. */
  --brutal-line: #16181D;
  --brutal-shadow-color: #16181D;
  --brutal-width: 2px;
  --brutal-offset: 6px;
  --brutal-offset-hover: 9px;
  --shadow-1: 0 1px 2px rgba(22, 24, 29, 0.06), 0 1px 1px rgba(22, 24, 29, 0.04);
  --shadow-2: 0 4px 12px rgba(22, 24, 29, 0.08), 0 1px 2px rgba(22, 24, 29, 0.06);
  /* Inkv component layer (docs/design-system.md, .eco-* in ecosystem.css). Coral is the primary action and the
     selected state; indigo (--secondary) is the secondary colour. */
  --eco-ink: #1A1814;
  --eco-line: #1A1814;
  --eco-coral: #D97757;
  --eco-coral-hover: #E08868;
  --eco-coral-deep: #9B4327;
  --eco-coral-soft: #F6DDD0;
  --eco-on-coral: #1A1814;
  --eco-squiggle: #C23A2B;
  --eco-cat-green: #4F7F34;
  --eco-cat-blue: #3F78B5;
  --eco-cat-yellow: #A87A12;
  --eco-cat-purple: #7C62B0;
  --eco-cat-grey: #7D776B;
  --eco-hand-sm: 11px 14px 10px 15px / 14px 10px 15px 11px;
  --eco-hand-md: 16px 21px 15px 23px / 21px 15px 23px 16px;
  --eco-hand-lg: 20px 26px 18px 28px / 26px 18px 28px 20px;
  --eco-hand-blob: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --eco-bw: 2px;
  --eco-shadow-x: 3px;
  --eco-shadow-y: 3px;
  --eco-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .2 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  --eco-grain-opacity: 0.55;
  /* Paper scrapbook layer (styles/paper.css): solid paper colours, checked by `npm run contrast`. */
  --pp-news: #EBE5D6;
  --pp-accent: #7A3119;
  --pp-sheet: #F5F0E1;
  --pp-sheet-ink: #1A1814;
  --pp-note: #E8C766;
  --pp-note-ink: #1A1814;
  --pp-photo: #FBFAF4;
  color-scheme: light;

  /* Legacy aliases (do not use in new code) */
  --paper: var(--bg);
  --card: var(--surface);
  --ink: var(--text);
  --ink-2: var(--text-2);
  --mute: var(--text-mute);
  --line: var(--border);
  --line-strong: var(--text);
  --gold: var(--warn);

  --display: 'Fraunces Variable', 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  --serif: 'Source Serif 4 Variable', 'Source Serif 4', 'Source Serif Fallback', Georgia, serif;
  --sans: 'Inter Variable', 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Type scale (px). Nothing below --text-xs. */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-xl: 28px;
  --text-2xl: 36px;
  --text-3xl: 48px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 56px;
  --gutter: 28px;
  --measure: 980px;
  --nav-offset: 60px;
}

/* Dark theme. Every text pair is >= 4.5:1, control borders >= 3:1 (see scripts/check-contrast.mjs). */
:root[data-theme="dark"] {
  --bg: #1A1814;
  --surface: #221F1A;
  --surface-sunk: #151310;
  --text: #ECEEF2;
  --text-2: #B9BFCA;
  --text-mute: #8E96A5;
  --border: #34312A;
  --border-control: #6B7280;
  --accent: #E58A6B;
  --accent-hover: #EEA088;
  --on-accent: #1A1814;
  --accent-soft: #3A2319;
  --accent-soft-text: #F0A488;
  --secondary: #8FA8FF;
  --secondary-hover: #AABBFF;
  --ok: #4CC38A;
  --ok-bg: #12261C;
  --ok-text: #4CC38A;
  --warn: #E3B341;
  --warn-bg: #2A2110;
  --warn-text: #E3B341;
  --danger: #FF8A80;
  --danger-bg: #2E1614;
  --danger-text: #FF8A80;
  --info: #5CC8E8;
  --shadow-stuck: rgba(0, 0, 0, 0.5);
  --bg-mid: #1D1B17;
  --bg-glow-cool: rgba(229, 138, 107, 0.10);
  --bg-glow-warm: rgba(227, 179, 65, 0.06);
  --bg-wash-cool: #2C2420;
  --bg-wash-warm: #262117;
  --deco-dot: #2E2B25;
  --deco-circle: #2B2616;
  --deco-ring: #27304F;
  --plane-a: #3A4A86;
  --plane-b: #2D5667;
  --plane-c: #2D6048;
  --plane-d: #6B5A2A;
  --brutal-line: #B9BFCA;
  --brutal-shadow-color: #E58A6B;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.5);
  --eco-ink: #1A1814;
  --eco-line: #D8D2C6;
  --eco-coral: #E58A6B;
  --eco-coral-hover: #EEA088;
  --eco-coral-deep: #F0A488;
  --eco-coral-soft: #3A2319;
  --eco-on-coral: #1A1814;
  --eco-squiggle: #FF7A68;
  --eco-cat-green: #7FB05F;
  --eco-cat-blue: #6FA3DB;
  --eco-cat-yellow: #E3B341;
  --eco-cat-purple: #A48ED6;
  --eco-cat-grey: #9A9488;
  --eco-grain-opacity: 0.25;
  --pp-news: #2B261D;
  --pp-accent: #F4B49B;
  --pp-sheet: #3A3428;
  --pp-sheet-ink: #F2ECDD;
  --pp-note: #C9A84A;
  --pp-note-ink: #1A1814;
  --pp-photo: #D9D3C2;
  color-scheme: dark;
}

@media (max-width: 719px) {
  :root {
    --nav-offset: 80px;
    --brutal-offset: 4px;
    --brutal-offset-hover: 6px;
  }
}

/*
 * Ecosystem shared layer (docs/ecosystem-plan.md): page background, decorative shapes, hard-shadow cards and the
 * site switcher. Needs the tokens from tokens.css. Copied to the portfolio site by `npm run eco:sync`:
 * edit it here, never in the copy.
 */

/* Page background: warm paper plus two soft corner glows and a faint lighter band; no images. */
body {
  background-color: var(--paper);
  /* Soft corner glows near the top plus a faint warm band; no images, no extra layers. */
  background-image:
    radial-gradient(circle at 0% 0%, var(--bg-glow-cool) 0, transparent 22%),
    radial-gradient(circle at 100% 0%, var(--bg-glow-warm) 0, transparent 18%),
    linear-gradient(180deg, var(--paper) 0%, var(--bg-mid) 52%, var(--paper) 100%);
  background-repeat: no-repeat;
  background-size: 100% 900px, 100% 900px, 100% 100%;
}

/*
 * Neo-brutalist card: bold outline + hard offset shadow. Add `card-brutal` to any card; tune it
 * with the --brutal-* tokens. Hover and keyboard focus (focus-within) lift the card and grow the
 * shadow; with prefers-reduced-motion the card stays put and only the shadow colour changes.
 */
.card-brutal {
  border: var(--brutal-width) solid var(--brutal-line);
  border-radius: var(--radius-md);
  box-shadow: var(--brutal-offset) var(--brutal-offset) 0 var(--brutal-shadow-color);
  background: var(--surface);
}

.card-brutal:hover,
.card-brutal:focus-within {
  --brutal-shadow-color: var(--accent);
  border-color: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .card-brutal {
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  }

  .card-brutal:hover,
  .card-brutal:focus-within {
    transform: translate(-3px, -3px);
    box-shadow: var(--brutal-offset-hover) var(--brutal-offset-hover) 0 var(--brutal-shadow-color);
  }
}

/* Home hero decoration (background only): dot grid, flat circles, slow paper planes. Full-bleed
   behind the content; purely decorative, so it never takes pointer events or focus. */
.cover-deco {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, var(--deco-dot) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
}

.deco-circle {
  position: absolute;
  top: -8%;
  right: -9%;
  width: min(46vw, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--deco-circle);
  opacity: 0.55;
}

.deco-ring {
  position: absolute;
  bottom: 4%;
  right: 12%;
  width: min(18vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: clamp(14px, 2vw, 26px) solid var(--deco-ring);
  opacity: 0.5;
}

.plane {
  position: absolute;
  width: 52px;
  height: 32px;
  background: linear-gradient(135deg, #fff 0%, var(--plane-color) 85%);
  clip-path: polygon(0 0, 100% 50%, 0 100%, 22% 50%);
  opacity: 0.95;
  filter: drop-shadow(0 2px 4px rgba(22, 24, 29, 0.18));
}

.plane::after {
  content: '';
  position: absolute;
  right: 100%;
  top: 40%;
  width: 70px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--plane-color));
  opacity: 0.4;
}

.plane-1 { --plane-color: var(--plane-a); top: 18%; left: 52%; transform: rotate(-12deg); }
.plane-2 { --plane-color: var(--plane-b); top: 62%; left: 6%; transform: rotate(8deg) scale(0.8); }
.plane-3 { --plane-color: var(--plane-c); top: 8%; left: 30%; transform: rotate(-24deg) scale(0.7); }
.plane-4 { --plane-color: var(--plane-d); top: 74%; left: 64%; transform: rotate(-6deg) scale(0.9); }

@media (max-width: 759px) {
  .plane {
    display: none;
  }

  .deco-circle {
    width: 70vw;
    top: -4%;
    right: -30%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .plane {
    animation: plane-drift 14s ease-in-out infinite alternate;
  }

  .plane-2 { animation-duration: 18s; animation-delay: -4s; }
  .plane-3 { animation-duration: 16s; animation-delay: -8s; }
  .plane-4 { animation-duration: 20s; animation-delay: -2s; }
}

@keyframes plane-drift {
  to { translate: 36px -18px; }
}

/* Site switcher: plain links to the sibling site, no script. */
.eco-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  font: 600 var(--text-xs) var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.eco-switcher a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-2);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.eco-switcher a:hover {
  color: var(--accent-hover);
}

.eco-switcher [aria-current] {
  color: var(--text);
  text-decoration: none;
}

/* ==========================================================================
 * Inkv component layer (.eco-*), docs/design-system.md.
 * Language: warm paper, ink outline drawn slightly off-square (asymmetric border-radius, no filters),
 * hard offset shadow, coral for the primary action and the selected state. Needs the --eco-* tokens.
 * Light and dark come from the tokens; nothing here hard-codes a colour.
 * ========================================================================== */

/* Paper grain: one small tiled SVG on the element, nothing on the page itself. */
.eco-paper {
  position: relative;
  background-color: var(--surface);
  isolation: isolate;
}

.eco-paper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--eco-grain);
  opacity: var(--eco-grain-opacity);
  pointer-events: none;
  z-index: -1;
}

/* Hand-drawn outline: pick a radius set; .eco-hand--alt tilts a neighbour so a row does not look stamped. */
.eco-hand { border-radius: var(--eco-hand-md); }
.eco-hand--sm { border-radius: var(--eco-hand-sm); }
.eco-hand--lg { border-radius: var(--eco-hand-lg); }
.eco-hand--blob { border-radius: var(--eco-hand-blob); }
.eco-hand--alt { transform: rotate(-0.35deg); }

:where(.eco-btn, .eco-chip, .eco-tile, .eco-toolbar__item, .eco-input, .eco-toggle, .eco-check, .eco-link):focus-visible {
  outline: 3px solid var(--eco-coral-deep);
  outline-offset: 3px;
}

/* ---- Button ---- */
.eco-btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  font: 700 var(--text-base) / 1 var(--sans);
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: var(--eco-bw) solid var(--eco-line);
  border-radius: var(--eco-hand-sm);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.eco-btn--primary { --btn-bg: var(--eco-coral); --btn-fg: var(--eco-on-coral); }
.eco-btn--secondary { --btn-bg: var(--surface); --btn-fg: var(--text); }
.eco-btn--danger { --btn-bg: var(--danger-bg); --btn-fg: var(--danger-text); }
.eco-btn--sm { min-height: 36px; padding: 0 var(--space-4); font-size: var(--text-sm); }
.eco-btn--lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--text-md); border-radius: var(--eco-hand-md); }
.eco-btn--icon { width: 44px; padding: 0; }
.eco-btn--icon.eco-btn--sm { width: 36px; }

.eco-btn--primary:hover { --btn-bg: var(--eco-coral-hover); }
.eco-btn--secondary:hover { --btn-bg: var(--eco-coral-soft); }

.eco-btn:active { transform: translateY(1px); }

/* Hover lift: only while motion is allowed (see the reduced-motion block below). */
@media (prefers-reduced-motion: no-preference) {
  .eco-btn:hover:not(:disabled, [aria-disabled='true']) { transform: translateY(-2px); }
  .eco-btn:active:not(:disabled, [aria-disabled='true']) { transform: translateY(1px); }
}

.eco-btn:disabled,
.eco-btn[aria-disabled='true'] {
  --btn-bg: var(--surface-sunk);
  --btn-fg: var(--text-mute);
  border-color: var(--border-control);
  cursor: not-allowed;
  transform: none;
}

/* Ghost: a plain underlined link, for asides such as "I know this, hide it". */
.eco-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-1);
  font: 600 var(--text-sm) var(--sans);
  color: var(--text-2);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.eco-link:hover { color: var(--eco-coral-deep); }

/* ---- Card / Panel ---- */
.eco-card {
  position: relative;
  padding: var(--space-4) var(--space-5);
  color: var(--text);
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
  border-radius: var(--eco-hand-md);
  box-shadow: var(--eco-shadow-x) var(--eco-shadow-y) 0 var(--eco-line);
}

.eco-card.is-selected,
.eco-card[aria-selected='true'] {
  background-color: var(--eco-coral-soft);
  border-color: var(--eco-coral-deep);
  box-shadow: var(--eco-shadow-x) var(--eco-shadow-y) 0 var(--eco-coral-deep);
}

.eco-panel__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.eco-panel__head .eco-chevron { margin-left: auto; }

/* ---- Chevron (collapse / close arrows), pure CSS ---- */
.eco-chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: solid currentColor;
  border-width: 0 2.5px 2.5px 0;
  border-radius: 1px;
  transform: rotate(45deg) translate(-2px, -2px);
}

.eco-chevron--up { transform: rotate(-135deg) translate(-2px, -2px); }
.eco-chevron--right { transform: rotate(-45deg); }

/* ---- Category tile: art + label + colour strip along the bottom ---- */
.eco-tile {
  --cat: var(--eco-cat-grey);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  min-width: 112px;
  padding: var(--space-3) var(--space-3) var(--space-5);
  font: 600 var(--text-sm) / 1.25 var(--sans);
  text-align: left;
  color: var(--text);
  background-color: var(--surface);
  border: 1.5px solid var(--eco-line);
  border-radius: var(--eco-hand-md);
  box-shadow: 2px 3px 0 var(--eco-line);
  cursor: pointer;
  overflow: hidden;
}

.eco-tile--green { --cat: var(--eco-cat-green); }
.eco-tile--blue { --cat: var(--eco-cat-blue); }
.eco-tile--yellow { --cat: var(--eco-cat-yellow); }
.eco-tile--purple { --cat: var(--eco-cat-purple); }
.eco-tile--grey { --cat: var(--eco-cat-grey); }

.eco-tile__art {
  display: grid;
  place-items: center;
  height: 64px;
  border-radius: var(--eco-hand-sm);
  /* Soft hatch of the category colour behind the art. */
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cat) 24%, transparent) 0 3px, transparent 3px 7px);
}

.eco-tile__art svg { width: 40px; height: 40px; }

.eco-tile::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--cat);
  border-top: 1.5px solid var(--eco-line);
}

.eco-tile:hover { background-color: var(--eco-coral-soft); }

.eco-tile[aria-pressed='true'],
.eco-tile.is-selected {
  background-color: var(--eco-coral-soft);
  border-color: var(--eco-coral-deep);
  box-shadow: 2px 3px 0 var(--eco-coral-deep);
}

.eco-tile[aria-pressed='true'] .eco-tile__label,
.eco-tile.is-selected .eco-tile__label { color: var(--eco-coral-deep); }

/* ---- Toolbar / tab item: icon over label, selected = thick ink outline ---- */
.eco-toolbar {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2);
  overflow-x: auto;
  scrollbar-width: thin;
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
  border-radius: var(--eco-hand-lg);
  box-shadow: var(--eco-shadow-x) var(--eco-shadow-y) 0 var(--eco-line);
}

.eco-toolbar__item {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  font: 600 var(--text-xs) / 1.2 var(--sans);
  color: var(--text-2);
  background: none;
  border: 3px solid transparent;
  border-radius: var(--eco-hand-sm);
  cursor: pointer;
}

.eco-toolbar__item svg { width: 24px; height: 24px; }
.eco-toolbar__item:hover { background-color: var(--surface-sunk); color: var(--text); }

.eco-toolbar__item[aria-selected='true'],
.eco-toolbar__item[aria-current='true'] {
  color: var(--text);
  border-color: var(--eco-line);
  background-color: var(--surface);
}

.eco-toolbar__sep { flex: 0 0 auto; align-self: stretch; margin: 0 var(--space-1); border-left: 1.5px dashed var(--border-control); }

/* ---- Chip / filter ---- */
.eco-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  font: 600 var(--text-sm) var(--sans);
  color: var(--text);
  background-color: var(--surface-sunk);
  border: 1.5px solid var(--eco-line);
  border-radius: var(--eco-hand-sm);
  cursor: pointer;
}

.eco-chip:hover { background-color: var(--eco-coral-soft); }

.eco-chip[aria-pressed='true'] {
  background-color: var(--eco-coral);
  color: var(--eco-on-coral);
}

/* ---- Number badge ---- */
.eco-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  font: 800 var(--text-sm) var(--sans);
  color: var(--eco-on-coral);
  background-color: var(--eco-coral);
  border-radius: 999px 960px 999px 980px;
}

.eco-badge--sm { min-width: 22px; height: 22px; font-size: var(--text-xs); }

/* ---- Progress dots / stepper: done = green, current = coral, todo = hollow ---- */
.eco-dots { display: inline-flex; gap: 5px; align-items: center; margin: 0; padding: 0; list-style: none; }

.eco-dot {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--eco-line);
  border-radius: 999px 900px 999px 940px;
  background: transparent;
}

.eco-dot.is-done { background: var(--eco-cat-green); }
.eco-dot.is-now { background: var(--eco-coral); width: 22px; }

/* ---- Squiggle heading: hand-drawn wavy underline, one mask, no filter ---- */
.eco-squiggle {
  position: relative;
  display: inline-block;
  margin: 0;
  padding-bottom: 8px;
  font: 700 var(--text-lg) / 1.1 var(--display);
  color: var(--text);
}

.eco-squiggle::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background-color: var(--eco-squiggle);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='6' viewBox='0 0 24 6'%3E%3Cpath d='M0 3 Q3 0 6 3 T12 3 T18 3 T24 3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 24px 6px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='6' viewBox='0 0 24 6'%3E%3Cpath d='M0 3 Q3 0 6 3 T12 3 T18 3 T24 3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 24px 6px;
}

/* ---- Input / search ---- */
.eco-input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4);
  font: 500 var(--text-base) var(--sans);
  color: var(--text);
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
  border-radius: var(--eco-hand-sm);
  box-shadow: inset 2px 2px 0 var(--shadow-stuck);
}

.eco-input::placeholder { color: var(--text-mute); }
.eco-input:focus-visible { border-color: var(--eco-coral-deep); outline-offset: 2px; }
.eco-input[aria-invalid='true'] { border-color: var(--danger); background-color: var(--danger-bg); }
.eco-input:disabled { background-color: var(--surface-sunk); color: var(--text-mute); border-color: var(--border-control); cursor: not-allowed; }

/* ---- Checkbox and toggle (native inputs, restyled) ---- */
.eco-check,
.eco-toggle {
  box-sizing: border-box;
  min-height: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
}

.eco-check { position: relative; width: 24px; height: 24px; border-radius: var(--eco-hand-sm); }
.eco-check:checked { background-color: var(--eco-coral); }

.eco-check:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 1px;
  width: 7px;
  height: 13px;
  border: solid var(--eco-on-coral);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.eco-toggle { position: relative; width: 48px; height: 28px; border-radius: 999px; }

.eco-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: var(--eco-line);
  border-radius: 50%;
}

.eco-toggle:checked { background-color: var(--eco-coral); }
.eco-toggle:checked::after { left: 23px; background-color: var(--eco-ink); }
.eco-check:disabled,
.eco-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Tooltip / popover: shown on hover or keyboard focus of the wrapper ---- */
.eco-tipwrap { position: relative; display: inline-flex; }

.eco-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 10;
  width: max-content;
  max-width: 240px;
  padding: var(--space-2) var(--space-3);
  font: 500 var(--text-sm) / 1.35 var(--sans);
  color: var(--text);
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
  border-radius: var(--eco-hand-sm);
  box-shadow: 3px 3px 0 var(--eco-line);
  transform: translateX(-50%);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.eco-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background-color: var(--surface);
  border: solid var(--eco-line);
  border-width: 0 var(--eco-bw) var(--eco-bw) 0;
  transform: translate(-50%, -6px) rotate(45deg);
}

.eco-tipwrap:hover .eco-tip,
.eco-tipwrap:focus-within .eco-tip,
.eco-tip.is-open { visibility: visible; opacity: 1; }

/* ---- Toast ---- */
.eco-toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 420px;
  padding: var(--space-3) var(--space-4);
  font: 600 var(--text-sm) / 1.35 var(--sans);
  color: var(--text);
  background-color: var(--surface);
  border: var(--eco-bw) solid var(--eco-line);
  border-left-width: 8px;
  border-radius: var(--eco-hand-sm);
  box-shadow: 4px 4px 0 var(--eco-line);
}

.eco-toast--ok { border-left-color: var(--eco-cat-green); }
.eco-toast--warn { border-left-color: var(--eco-cat-yellow); }
.eco-toast--danger { border-left-color: var(--danger); }

/* ---- Motion: only when the visitor has not asked for less ---- */
@media (prefers-reduced-motion: no-preference) {
  .eco-btn { transition: transform 0.12s, background-color 0.12s; }
  .eco-tile { transition: transform 0.12s, background-color 0.12s; }
  .eco-tile:hover { transform: translateY(-2px); }
  .eco-chevron { transition: transform 0.18s; }
  .eco-toggle::after { transition: left 0.15s; }
  .eco-tip { transition: opacity 0.12s, visibility 0.12s; }
  .eco-toast.is-entering { animation: eco-pop 0.25s cubic-bezier(0.3, 1.55, 0.5, 1); }
}

@keyframes eco-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
}

/*
 * Paper scrapbook layer (docs/design-system.md, "Scrapbook archive"): reusable parts, CSS + light SVG only, no raster images.
 * Ported from the toolbox (Inkv Bench) set so all three sites share one look; synced to B by `npm run eco:sync`.
 * Base stays paper #ECE9E2 + ink #1A1814 + coral; the sepia tone is only a light overlay.
 * This file is the ABOVE-THE-FOLD part (small, plain gradients so nothing becomes an LCP candidate); the rest is paper-deco.css, loaded lazily.
 * Every decoration is aria-hidden and ignores the pointer; text always sits on solid paper or the faint newsprint (see scripts/paper-contrast.test.mjs).
 */
:root {
  --pp-sepia: rgb(150 108 56 / 0.10);
  --pp-ink-faint: rgb(26 24 20 / 0.10);
  --pp-ink-line: rgb(26 24 20 / 0.13);
  --pp-tape: rgb(222 203 150 / 0.78);
  --pp-vignette: rgb(70 48 14 / 0.14);
  --pp-string: var(--eco-squiggle, #C23A2B);
  --pp-shadow: rgb(40 28 8 / 0.30);
}

:root[data-theme="dark"] {
  --pp-sepia: rgb(150 108 56 / 0.07);
  --pp-ink-faint: rgb(236 233 226 / 0.07);
  --pp-ink-line: rgb(236 233 226 / 0.13);
  --pp-tape: rgb(150 130 84 / 0.62);
  --pp-vignette: rgb(0 0 0 / 0.38);
  --pp-shadow: rgb(0 0 0 / 0.5);
}

/* ---- Board: rounded corners, light vignette, sepia overlay (gradients only) ---- */
.pp-board {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 58%, var(--pp-vignette) 100%),
    linear-gradient(var(--pp-sepia), var(--pp-sepia)),
    var(--pp-news);
}

/* ---- Old newsprint: faint text columns made of gradients (no image) ---- */
.pp-news {
  position: relative;
  isolation: isolate;
  background-color: var(--pp-news);
  /* Accent text on the faint lines needs a deeper tone (light) or a lighter tone (dark): checked in scripts/paper-contrast.test.mjs. */
  --accent: var(--pp-accent);
  --accent-hover: var(--pp-accent);
}

.pp-news::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* No mask-image here: a mask over a large area made the first frame paint slower (about +130 ms LCP measured). The gaps between
     columns are three strips in the backdrop colour laid over the text lines. */
  background:
    linear-gradient(90deg, transparent 0 30%, var(--pp-news) 30% 34%, transparent 34% 63%, var(--pp-news) 63% 67%, transparent 67% 96%, var(--pp-news) 96%),
    repeating-linear-gradient(0deg, var(--pp-ink-faint) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(0deg, var(--pp-ink-line) 0 9px, transparent 9px 150px);
}

/* ---- Red string stretched across (inline SVG in RedString) ---- */
.pp-string { display: block; width: 100%; height: 22px; overflow: visible; pointer-events: none; }
.pp-string path { fill: none; stroke: var(--pp-string); stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pp-string path + path { stroke: var(--pp-shadow); stroke-width: 3; transform: translateY(3px); opacity: 0.5; }

/* ---- Copper pin ---- */
.pp-pin {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #F4D3A4 0 14%, #C9863F 42%, #7A4520 100%);
  box-shadow: 2px 4px 3px var(--pp-shadow), inset -1px -1px 2px rgb(60 30 0 / 0.5);
  pointer-events: none;
}

/* ---- Semi-transparent washi tape with serrated ends ---- */
.pp-tape {
  position: absolute;
  z-index: 2;
  width: 92px;
  height: 26px;
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.18) 0 2px, transparent 2px 6px),
    var(--pp-tape);
  clip-path: polygon(0 0, 4% 12%, 0 25%, 4% 38%, 0 50%, 4% 62%, 0 75%, 4% 88%, 0 100%, 100% 100%, 96% 88%, 100% 75%, 96% 62%, 100% 50%, 96% 38%, 100% 25%, 96% 12%, 100% 0);
  transform: rotate(var(--r, -4deg));
  pointer-events: none;
}

/* ---- Rubber stamp: double border, tilted, slightly faded ---- */
.pp-rstamp {
  display: inline-grid;
  gap: 2px;
  padding: 6px 14px;
  font: 700 12px / 1.2 var(--mono, monospace);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--pp-sheet-ink);
  border: 3px double currentColor;
  border-radius: 6px;
  opacity: 0.55;
  transform: rotate(var(--r, -7deg));
  pointer-events: none;
}

@media print { .pp-pin, .pp-tape, .pp-string { display: none; } }
