/* ==========================================================================
   Tamarack Systems — site stylesheet
   Plain CSS, no build step, no JavaScript, no external resources.
   Design brief and token rationale: /DESIGN.md (repo root).
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Brand palette (fixed) */
  --green-900: #10231a;   /* spruce near-black */
  --green-700: #1d3b2a;   /* brand green */
  --green-600: #2a5a3d;
  --gold-700:  #7a5912;   /* gold as text on light */
  --gold-500:  #c38f27;   /* tamarack gold */
  --gold-400:  #d6a53f;
  --gold-200:  #eddcb4;
  --gold-100:  #f5ecd6;

  /* Semantic, light theme */
  --bg:        #f4f1e8;
  --surface:   #fbfaf6;   /* header, cards */
  --surface-2: #efebdf;
  --ink:       #1b201c;
  --ink-2:     #3b433d;
  --muted:     #5a635c;
  --line:      #d6d1c4;
  --line-2:    #c4bda9;
  --accent:    var(--gold-500);     /* rules, markers (non-text) */
  --accent-text: var(--gold-700);
  --link:      #235236;
  --link-hover: var(--green-900);
  --focus:     #2a5a3d;
  --heading:   var(--green-900);
  --selection: var(--gold-200);
  --btn-bg: var(--gold-500); --btn-bg-hover: var(--gold-400); --btn-fg: var(--green-900);

  /* On-dark set: hero, footer */
  --on-dark:       #f3f0e6;
  --on-dark-2:     #cfd8d0;
  --on-dark-muted: #a9b7ac;
  --on-dark-gold:  #dfb256;
  --on-dark-line:  rgba(243, 240, 230, .18);

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Roboto, "Noto Sans", Ubuntu, Cantarell, Arial, sans-serif;
  --font-serif: "Iowan Old Style", Charter, "Bitstream Charter", "Source Serif 4", "Source Serif Pro", Georgia, "Noto Serif", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cascadia Mono", "Liberation Mono", "DejaVu Sans Mono", monospace;

  --fs-0: .8125rem; /* 13 */
  --fs-1: .9375rem; /* 15 */
  --fs-2: 1.0625rem; /* 17 */
  --fs-3: 1.25rem; /* 20 */
  --fs-4: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  --fs-5: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
  --fs-6: clamp(2.25rem, 1.5rem + 3.5vw, 3.5rem);
  --lh-tight: 1.15;
  --lh-body: 1.6;
  --track-caps: .12em;

  /* Space, 4px base */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem; --s-7: 3rem; --s-8: 4rem; --s-9: 6rem;

  /* Shape */
  --r-1: 3px;
  --r-2: 6px;          /* largest radius on the site */
  --hair: 1px solid var(--line);
  --shadow-1: 0 1px 2px rgba(16, 35, 26, .06), 0 1px 0 rgba(16, 35, 26, .04);

  /* Layout */
  --max: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --measure: 66ch;

  --motif: url(/assets/motif.svg);
  --dur: 160ms;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-2);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
::selection { background: var(--selection); color: var(--green-900); }
img, svg { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  transition: color var(--dur), text-decoration-color var(--dur);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
hr { border: 0; border-top: var(--hair); margin: var(--s-6) 0; }
strong { font-weight: 650; }
address { font-style: normal; }
[id] { scroll-margin-top: 5rem; }

/* 3. Type ------------------------------------------------------------------ */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.012em;
  color: var(--heading);
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-5); }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-3); font-weight: 600; letter-spacing: -.005em; }
h4 { font-size: var(--fs-2); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
small, .small { font-size: var(--fs-1); }
code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }

/* Signature: short gold rule above section headings (opt out with .no-rule) */
main h2:not(.no-rule)::before {
  content: "";
  display: block;
  width: 2rem; height: 2px;
  background: var(--accent);
  margin-bottom: .8rem;
}

/* Eyebrow / kicker: mono small caps label; gold text on light, gold-400 on dark */
.kicker, .eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 var(--s-4);
}
.lead { font-size: var(--fs-3); line-height: 1.5; color: var(--ink-2); }
.prose > * { max-width: var(--measure); }
.prose h2 { margin-top: var(--s-7); }
.prose h2:first-of-type { margin-top: var(--s-6); }
.prose li { margin-bottom: .4em; }

/* 4. Layout ---------------------------------------------------------------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.two-col { display: grid; gap: var(--s-7) var(--s-8); grid-template-columns: 1fr 1fr; align-items: start; }
.two-col > * { min-width: 0; }
/* Editorial split: heading (or invitation) in a 5/12 column, matter in the 7/12 column */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-6) var(--s-8); align-items: start; }
.split > * { min-width: 0; }
.split > h2 { margin-bottom: 0; }
.split .text { padding-top: calc(2px + .8rem); } /* first line meets the h2, below its gold rule */
.split .text > * { max-width: var(--measure); }
.split > div .btn { margin-top: var(--s-4); }

/* 5. Header and nav -------------------------------------------------------- */
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 20;
  padding: .7rem 1rem; border-radius: var(--r-1);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: var(--fs-1); text-decoration: none;
}
.skip-link:focus { top: var(--s-4); outline-color: var(--heading); }
.site-header {
  background: var(--surface);
  border-bottom: var(--hair);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4) var(--s-6); flex-wrap: wrap;
  min-height: 72px; padding-top: var(--s-3); padding-bottom: var(--s-3);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  text-decoration: none; color: var(--heading);
  font-family: var(--font-serif); font-weight: 600; font-size: 1.25rem; letter-spacing: -.01em;
  line-height: 1;
}
.brand:hover { color: var(--heading); }
.brand svg, .brand img { width: 38px; height: 38px; flex: none; border-radius: 7px; }
.nav { display: flex; gap: var(--s-1) var(--s-6); flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  text-decoration: none; color: var(--ink-2);
  font-size: var(--fs-1); font-weight: 500; letter-spacing: .01em;
  padding: .625rem 0; border-bottom: 2px solid transparent; /* 46px tall: touch target */
  transition: color var(--dur), border-color var(--dur);
}
.nav a:hover { color: var(--heading); border-bottom-color: var(--line-2); }
.nav a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--accent); }

/* 6. Hero ------------------------------------------------------------------ */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  color: var(--on-dark);
  background: var(--green-900) linear-gradient(165deg, var(--green-900) 0%, var(--green-700) 100%);
  padding: var(--s-9) 0 var(--s-8);
  border-bottom: 2px solid var(--gold-500);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--motif) right center / auto 160% no-repeat;
  pointer-events: none;
}
.hero .kicker { color: var(--on-dark-gold); }
.hero .kicker::before { content: ""; display: inline-block; vertical-align: middle; width: 1.5rem; height: 1px; margin: 0 var(--s-3) .15em 0; background: var(--on-dark-gold); }
.hero h1 { color: var(--on-dark); font-size: var(--fs-6); max-width: 16ch; margin-bottom: var(--s-5); }
.hero .lead, .hero p.lead { color: var(--on-dark-2); max-width: 58ch; margin-bottom: var(--s-6); }
.hero a:not(.btn) { color: var(--on-dark-gold); }

/* 7. Sections -------------------------------------------------------------- */
section { padding: var(--s-8) 0; }
section.alt { background: var(--surface); border-top: var(--hair); border-bottom: var(--hair); }
section.alt + section.alt { border-top: 0; }
main > section .eyebrow { margin-bottom: var(--s-5); }
/* Statement: one serif pull line on paper, set between hairlines at h1 size */
.statement { border-top: var(--hair); }
.statement h2 { font-size: var(--fs-5); max-width: 40ch; margin: 0; }

/* 8. Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--font-sans); font-size: var(--fs-1); font-weight: 600; letter-spacing: .01em;
  line-height: 1.2;
  padding: .8rem 1.3rem;
  border-radius: var(--r-1);
  border: 1.5px solid transparent;
  text-decoration: none;
  margin: var(--s-2) var(--s-2) 0 0;
  cursor: pointer;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur), transform var(--dur);
}
.btn, .btn:hover { color: var(--btn-fg); }
.btn { background: var(--btn-bg); border-color: var(--btn-bg); }
.btn:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--line-2); }
.btn.ghost:hover { color: var(--heading); border-color: var(--heading); background: transparent; }
/* Ghost on dark panels (hero, footer) */
.hero .btn.ghost, .site-footer .btn.ghost { color: var(--on-dark); border-color: var(--on-dark-line); }
.hero .btn.ghost:hover, .site-footer .btn.ghost:hover { color: var(--on-dark-gold); border-color: var(--on-dark-gold); }
.hero :focus-visible, .site-footer :focus-visible { outline-color: var(--on-dark-gold); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.btn-row .btn { margin: 0; }

/* 9. Definition list ------------------------------------------------------ */
dl.contact { display: grid; grid-template-columns: max-content 1fr; gap: 0 var(--s-6); margin: 0; }
dl.contact dt, dl.contact dd { padding: var(--s-3) 0; border-top: 1px solid var(--line); }
dl.contact dt {
  font-family: var(--font-mono); font-size: var(--fs-0); font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding-top: calc(var(--s-3) + .2em);
}
dl.contact dd { margin: 0; }
dl.contact dd:last-of-type, dl.contact dt:last-of-type { border-bottom: 1px solid var(--line); }
ul.plain { padding-left: 1.1em; margin: 0; }
ul.plain li { margin-bottom: .55em; padding-left: .2em; }
ul.plain li::marker { color: var(--accent); }

/* 10. Spec strip: row of label/value facts in mono (under the hero) -------- */
.spec-strip {
  display: grid; grid-template-columns: 1.45fr 1.25fr 1fr 1fr; /* weighted so every value sets in two lines */
  list-style: none; margin: 0; padding: 0;
  border-top: var(--hair); border-bottom: var(--hair);
  font-family: var(--font-mono);
}
.spec-strip li {
  padding: var(--s-4) var(--s-5);
  border-left: var(--hair);
  min-width: 0;
}
.spec-strip li:first-child { padding-left: 0; border-left: 0; }
.spec-strip .k { display: block; font-size: var(--fs-0); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
.spec-strip .v { display: block; font-size: var(--fs-1); color: var(--ink); line-height: 1.4; }
.hero .spec-strip { border-color: var(--on-dark-line); margin-top: var(--s-7); }
.hero .spec-strip li { border-color: var(--on-dark-line); }
.hero .spec-strip .k { color: var(--on-dark-muted); }
.hero .spec-strip .v { color: var(--on-dark); }

/* 11. Utilities ------------------------------------------------------------ */
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.placeholder { font-family: var(--font-mono); font-size: var(--fs-1); color: var(--muted); }
.rule { border: 0; border-top: 2px solid var(--accent); width: 2rem; margin: 0 0 var(--s-4); }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note {
  border-left: 3px solid var(--accent);
  background: var(--gold-100);
  color: var(--green-900);
  padding: var(--s-4) var(--s-5);
  border-radius: 0 var(--r-1) var(--r-1) 0;
  max-width: var(--measure);
}
.note p { margin: 0; }

/* 12. Footer --------------------------------------------------------------- */
.site-footer {
  background: var(--green-900);
  color: var(--on-dark-2);
  border-top: 2px solid var(--gold-500);
  padding: var(--s-7) 0 var(--s-6);
  font-size: var(--fs-1);
}
.site-footer .wrap { display: grid; gap: var(--s-6) var(--s-8); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.site-footer strong { color: var(--on-dark); font-family: var(--font-serif); font-size: var(--fs-3); font-weight: 600; letter-spacing: -.01em; }
.site-footer a { color: var(--on-dark); text-decoration-color: var(--on-dark-line); }
.site-footer a:hover { color: var(--on-dark-gold); text-decoration-color: currentColor; }
.site-footer p { margin: 0 0 var(--s-3); line-height: 1.55; }
.site-footer .legal { color: var(--on-dark-muted); font-size: var(--fs-0); max-width: 70ch; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--on-dark-line); }
.site-footer div:last-child p { line-height: 2; }

/* 13. Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-strip li:nth-child(odd) { border-left: 0; padding-left: 0; }
  .spec-strip li:nth-child(n+3) { border-top: var(--hair); }
}
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; gap: var(--s-7); }
  .split { grid-template-columns: 1fr; gap: var(--s-5); }
  .split .text { padding-top: 0; }
  .hero { padding: var(--s-8) 0 var(--s-7); }
  .hero::before { background-size: auto 120%; }
  section { padding: var(--s-7) 0; }
}
@media (max-width: 640px) {
  .site-footer .wrap { grid-template-columns: 1fr; }
  dl.contact { grid-template-columns: 1fr; }
  dl.contact dt { padding-bottom: 0; }
  dl.contact dd { border-top: 0; padding-top: var(--s-1); }
  dl.contact dt:last-of-type { border-bottom: 0; }
  .spec-strip { grid-template-columns: 1fr; }
  .spec-strip li { padding: var(--s-3) 0; border-left: 0; border-top: var(--hair); }
  .spec-strip li:first-child { border-top: 0; }
  .hero .spec-strip li { border-color: var(--on-dark-line); }
}
@media (max-width: 480px) {
  .site-header .wrap { min-height: 60px; }
  .brand { font-size: 1.1rem; }
  .brand svg, .brand img { width: 32px; height: 32px; border-radius: 6px; }
  .site-header .wrap { gap: 0 var(--s-4); padding-top: var(--s-2); padding-bottom: 0; }
  .nav { width: 100%; justify-content: space-between; gap: 0 var(--s-3); }
  .btn { display: block; text-align: center; margin-right: 0; }
  .btn-row .btn { flex: 1 1 100%; }
  .hero h1 { max-width: none; }
}

/* 14. Dark theme ----------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1912;
    --surface:   #15231a;
    --surface-2: #1b2d22;
    --ink:       #e8e5da;
    --ink-2:     #c5cdc4;
    --muted:     #9faba1;
    --line:      #2a3b30;
    --line-2:    #3b5042;
    --accent:    #d9ab4a;
    --accent-text: #d9ab4a;
    --link:      #e3bf6c;
    --link-hover: #f3f0e6;
    --focus:     #d9ab4a;
    --heading:   #f3f0e6;
    --selection: #3b5042;
    --gold-100:  #1b2d22;      /* note fill: green tile */
    --gold-200:  #3b5042;
    --shadow-1:  none;
    --on-dark-line: rgba(232, 229, 218, .16);
    --btn-bg: #d9ab4a; --btn-bg-hover: #e3bf6c; --btn-fg: #0e1912;
  }
  .note { background: var(--surface-2); color: var(--ink); }
  .hero { background: #0a140d linear-gradient(165deg, #0a140d 0%, var(--green-700) 100%); }
  .site-header { background: color-mix(in srgb, var(--bg) 92%, black); }
  .site-footer { background: #0a140d; }
  section.alt { background: var(--surface); }
  .btn.ghost { background: transparent; color: var(--ink); }
  .btn.ghost:hover { color: var(--accent); border-color: var(--accent); background: transparent; }
  ::selection { color: var(--ink); }
}

/* 15. Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 16. Print ---------------------------------------------------------------- */
@media print {
  .skip-link, .nav, .site-footer nav, .hero::before, .btn { display: none; }
  .site-header { position: static; }
  body, .hero, .site-footer, section.alt, .note { background: #fff !important; color: #000 !important; box-shadow: none; }
  body * { color: #000 !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  .hero { border: var(--hair); }
  .statement, section.alt { border-top: 1px solid #000; }
}
