/* Perinnekasvit: design tokens, typography, reset, layout, print basics. */
:root {
  /* brand palette */
  --green: #1b4332;
  --green-deep: #14261d;
  --green-mid: #2d6a4f;
  --mint: #e3efe7;
  --cream: #f5efe0;
  --page: #f7f5ef;
  --white: #ffffff;
  --gold: #d4a017;

  /* semantic tokens (light) */
  --bg: var(--page);
  --surface: var(--white);
  --surface-2: var(--cream);
  --surface-3: var(--mint);
  --text: #1f2a24;
  --text-muted: #48574e;
  --heading: var(--green-deep);
  --link: var(--green);
  --link-hover: var(--green-mid);
  --accent: var(--green-mid);
  --accent-contrast: #ffffff;
  --border: #d8d2bf;
  --border-strong: #b7ae93;
  --focus: #0a58ca;
  --bar-track: #dfe8e0;
  --bar-fill: var(--green-mid);
  --shadow-sm: 0 1px 2px rgba(20, 38, 29, .08), 0 1px 3px rgba(20, 38, 29, .06);
  --shadow: 0 2px 6px rgba(20, 38, 29, .08), 0 8px 24px rgba(20, 38, 29, .08);
  --header-bg: var(--green-deep);
  --header-text: #f3efe2;
  --footer-bg: var(--green-deep);
  --footer-text: #d9e3db;
  --chart-1: #2d6a4f; --chart-2: #8a6a12; --chart-3: #5b8aa6; --chart-4: #b4573c; --chart-5: #7a5c8f;

  /* type + layout */
  --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --fs-base: 1.0625rem; /* 17px */
  --radius: 8px;
  --gutter: 1rem;
  --maxw: 72rem;
  --tap: 2.75rem; /* 44px */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a14;
    --surface: #17261d;
    --surface-2: #1d3226;
    --surface-3: #21392b;
    --text: #e4ebe6;
    --text-muted: #aebcb2;
    --heading: #f3efe2;
    --link: #9fd8b6;
    --link-hover: #c4ecd3;
    --accent: #74c69d;
    --accent-contrast: #0d1a13;
    --border: #2d4637;
    --border-strong: #46634f;
    --focus: #ffd75e;
    --bar-track: #263f30;
    --bar-fill: #74c69d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --header-bg: #0a130e;
    --footer-bg: #0a130e;
    --chart-1: #74c69d; --chart-2: #e0b94c; --chart-3: #8ec1dd; --chart-4: #e5917a; --chart-5: #b9a0cf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1a14;
    --surface: #17261d;
    --surface-2: #1d3226;
    --surface-3: #21392b;
    --text: #e4ebe6;
    --text-muted: #aebcb2;
    --heading: #f3efe2;
    --link: #9fd8b6;
    --link-hover: #c4ecd3;
    --accent: #74c69d;
    --accent-contrast: #0d1a13;
    --border: #2d4637;
    --border-strong: #46634f;
    --focus: #ffd75e;
    --bar-track: #263f30;
    --bar-fill: #74c69d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --header-bg: #0a130e;
    --footer-bg: #0a130e;
    --chart-1: #74c69d; --chart-2: #e0b94c; --chart-3: #8ec1dd; --chart-4: #e5917a; --chart-5: #b9a0cf;
    color-scheme: dark;
  }

@media (min-width: 56rem) {
  :root { --fs-base: 1.125rem; --gutter: 1.5rem; } /* 18px */
}

/* reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
html.lb-open { overflow: hidden; }
main { flex: 1 0 auto; position: relative; display: block; }
main:focus { outline: none; }
img, svg, video { max-width: 100%; height: auto; }
svg { vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
p, ul, ol, dl, figure, blockquote { margin-block: 0 1em; }
ul, ol { padding-left: 1.25em; }

/* typography */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); margin-top: 1.6em; }
h3 { font-size: 1.3rem; margin-top: 1.4em; }
h4 { font-size: 1.1rem; }
h1:focus { outline: none; }
.lead { font-size: 1.15em; color: var(--text-muted); max-width: 42rem; }
.muted { color: var(--text-muted); }
small, .small { font-size: .875rem; }
em, i, .latin { font-style: italic; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--link-hover); text-decoration-thickness: .14em; }

/* focus rings: always visible for keyboard users */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.site-header :focus-visible, .site-footer :focus-visible, .lb :focus-visible { outline-color: #ffd75e; }

/* layout */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.view { padding-block: 2rem 4rem; }
.view--loading { position: absolute; inset-inline: 0; top: 0; visibility: hidden; pointer-events: none; }
.view-skel { padding-block: 2.5rem; }
.stack > * + * { margin-top: var(--stack, 1rem); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--gap, .5rem); align-items: center; }
.grid { display: grid; gap: var(--gap, 1rem); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 16rem)), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.page-head { margin-bottom: 1.5rem; }
.page-head p { margin-bottom: 0; }
.section { margin-top: 2.5rem; }

/* motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* print */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --text-muted: #333; --heading: #000; --link: #000; --border: #999; --shadow: none; --shadow-sm: none; }
  body { font-size: 11pt; background: #fff; color: #000; display: block; }
  .site-header, .site-footer, .skip-link, .no-print, .toolbar, .chip, .lb, .btn, #live { display: none !important; }
  .site-footer { display: block !important; border-top: 1px solid #999; margin-top: 1rem; background: none; color: #000; }
  .site-footer__grid > :not(:first-child) { display: none; }
  .container { max-width: none; padding-inline: 0; }
  .view { padding-block: 0; }
  a { text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  tr, li, figure { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  @page { margin: 15mm; }
}
