/* ============================================================
   SylvanSpark Engineering — Design System (dark)
   Palette: bg / panel / text / pine / ember
   Type: Archivo (display) · IBM Plex Sans (body) · IBM Plex Mono (labels)
   ============================================================ */

:root {
  --bg: #121813;          /* green-black base */
  --bg-deep: #0D120E;     /* darker band (Dawson, footer) */
  --panel: #1A231D;       /* cards */
  --panel-2: #202B23;     /* raised elements */
  --line: #2C382F;

  --text: #E7ECE4;
  --muted: #A8B4A8;
  --faint: #7D8A7E;

  --pine: #7DBB8A;        /* lightened for dark bg */
  --pine-deep: #2F6B3A;
  --ember: #F08A2A;       /* brand orange, lifted for contrast */
  --ember-deep: #E8760C;

  --font-display: "Archivo", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --maxw: 1120px;
  --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--pine); text-decoration-color: #4A5A4D; text-underline-offset: 3px; }
a:hover { color: var(--ember); }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Type scale ---------- */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.015em; color: #F2F5F0; }
h1 { font-size: clamp(2.4rem, 5.4vw, 4.1rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; }
h3 { font-size: 1.18rem; font-weight: 700; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pine);
  display: block;
  margin-bottom: 14px;
}
.eyebrow::before { content: "// "; color: var(--ember); }

.lede { font-size: 1.16rem; color: var(--muted); max-width: 46em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 18, 14, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.02rem;
  text-decoration: none; color: #F2F5F0;
  display: flex; align-items: center; gap: 10px;
}
.brand:hover { color: #F2F5F0; }
.brand .spark { color: var(--ember); }
.brand .eng { color: var(--pine); font-weight: 600; }
.brand-mark { width: 30px; height: 30px; flex: none; }

.nav { display: flex; gap: 24px; align-items: center; }
.nav a {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none; color: var(--muted);
}
.nav a:hover { color: var(--ember); }
.nav .cta {
  background: var(--ember-deep); color: #fff; padding: 9px 16px; border-radius: var(--radius);
  font-weight: 600;
}
.nav .cta:hover { background: var(--ember); color: #fff; }
@media (max-width: 820px) { .nav a:not(.cta) { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 84px 0 0; position: relative; overflow: hidden; }
.hero h1 { max-width: 15em; }
.hero h1 .hw { color: var(--pine); }
.hero h1 .sw { color: var(--ember); }
.hero .lede { margin-top: 22px; }
.hero-ctas { margin-top: 34px; display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block; font-family: var(--font-display); font-weight: 700;
  font-size: 0.95rem; padding: 14px 24px; border-radius: var(--radius);
  text-decoration: none; border: 2px solid transparent;
}
.btn-primary { background: var(--ember-deep); color: #fff; }
.btn-primary:hover { background: var(--ember); color: #fff; }
.btn-ghost { border-color: var(--pine); color: var(--pine); background: transparent; }
.btn-ghost:hover { background: var(--pine); color: var(--bg-deep); }

.hero-meta {
  margin-top: 30px; font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--faint); display: flex; gap: 22px; flex-wrap: wrap;
}
.hero-meta span::before { content: "▸ "; color: var(--ember); }

/* Root-trace SVG under hero */
.hero-traces { margin-top: 40px; width: 100%; }
.hero-traces svg { width: 100%; height: auto; }

/* ---------- Sections ---------- */
section { padding: 84px 0; }
section.alt { background: #161E18; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 44px; max-width: 46em; }

/* ---------- Domains grid ---------- */
.domain-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
@media (max-width: 980px) { .domain-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .domain-grid { grid-template-columns: 1fr; } }

.domain {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px 24px; position: relative;
}
.domain::before {
  content: ""; position: absolute; top: 0; left: 22px; width: 44px; height: 3px;
  background: var(--ember-deep);
}
.domain h3 { margin-bottom: 10px; }
.domain p { font-size: 0.94rem; color: var(--muted); }
.domain .tags {
  margin-top: 14px; font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--pine); line-height: 1.9;
}

/* ---------- Testimonials ---------- */
.quote-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px; max-width: 980px;
}
.quote {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; position: relative;
}
.quote::before {
  content: "\201C"; font-family: var(--font-display); font-weight: 800;
  font-size: 3rem; line-height: 1; color: var(--ember-deep);
  position: absolute; top: 14px; left: 22px; opacity: .55;
}
.quote p { color: var(--muted); font-size: 1rem; margin: 26px 0 18px; }
.quote .attr {
  font-family: var(--font-mono); font-size: .74rem; color: var(--pine);
  letter-spacing: .05em;
}
.quote .attr::before { content: "— "; color: var(--ember); }

/* ---------- Case studies (spec sheets) ---------- */
.case {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 28px;
  display: grid; grid-template-columns: 220px 1fr;
}
@media (max-width: 760px) { .case { grid-template-columns: 1fr; } }

.case-tab {
  background: var(--bg-deep); color: var(--muted); padding: 26px 22px;
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 2.1;
  border-right: 1px solid var(--line);
}
@media (max-width: 760px) { .case-tab { border-right: none; border-bottom: 1px solid var(--line); } }
.case-tab .sysid { color: var(--ember); font-size: 1rem; font-weight: 600; display: block; margin-bottom: 8px; }
.case-tab b { color: var(--pine); font-weight: 600; }
.case-body { padding: 30px 32px; }
.case-body h3 { font-size: 1.35rem; margin-bottom: 10px; }
.case-body p { color: var(--muted); max-width: 56em; }
.case-body .case-link { display: inline-block; margin-top: 16px; font-family: var(--font-mono); font-size: 0.85rem; }
.case-stack {
  margin-top: 16px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--faint);
}
.case-stack b { color: var(--pine); font-weight: 600; }

/* ---------- Dawson band ---------- */
.dawson { background: var(--bg-deep); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dawson-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
@media (max-width: 860px) { .dawson-grid { grid-template-columns: 1fr; } }
.dawson ul { list-style: none; margin-top: 22px; }
.dawson li { padding-left: 26px; position: relative; margin-bottom: 12px; color: var(--muted); font-size: 0.98rem; }
.dawson li::before { content: "◆"; position: absolute; left: 0; color: var(--ember); font-size: 0.7rem; top: 6px; }
.dawson .btn-primary { margin-top: 28px; }
.dawson-panel {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--faint); line-height: 2;
  background: var(--panel);
}
.dawson-panel .ok { color: var(--pine); }
.dawson-panel .em { color: var(--ember); }

/* ---------- Projects grid ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 980px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .project-grid { grid-template-columns: 1fr; } }
.project {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 22px;
}
.project h3 { font-size: 1.05rem; margin-bottom: 8px; }
.project p { font-size: 0.9rem; color: var(--muted); }
.project .ptag {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--ember);
  letter-spacing: 0.1em; text-transform: uppercase; display: block; margin-bottom: 10px;
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 340px 1fr; gap: 56px; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; max-width: 480px; } }
.about-photo {
  width: 90%; aspect-ratio: 4 / 5; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    linear-gradient(160deg, var(--panel) 0%, var(--panel-2) 100%);
  border-bottom: 3px solid var(--ember-deep);
}
.about-card {
  margin-top: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px;
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 2.2; color: var(--muted);
}
.about-card b { color: var(--pine); }

/* ---------- Brand logo chip (dark logo needs light backing) ---------- */
.brand-chip {
  background: #F4F3EC; border-radius: 8px; padding: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
}
.brand-chip img { width: 26px; height: auto; }

/* ---------- In the field (expo + CAD) ---------- */
.field-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 36px; }
@media (max-width: 760px) { .field-gallery { grid-template-columns: 1fr; } }
.field-gallery figure, .cad-strip figure { margin: 0; }
.field-gallery img, .cad-strip img {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  display: block;
}
figcaption {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint);
  margin-top: 10px; letter-spacing: 0.04em;
}
figcaption::before { content: "▸ "; color: var(--ember); }
.cad-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
@media (max-width: 760px) { .cad-strip { grid-template-columns: 1fr; } }
.field-sub { margin-top: 56px; }
.field-sub h3 { margin-bottom: 6px; }
.field-sub > p { color: var(--muted); font-size: 0.95rem; max-width: 46em; }

/* ---------- Project card thumbnails ---------- */
.project { overflow: hidden; }
.project-thumb {
  width: calc(100% + 44px); margin: -24px -22px 18px;
  height: 190px; object-fit: cover; object-position: center top;
  border-bottom: 1px solid var(--line); display: block;
}

/* ---------- Dawson screenshot ---------- */
.dawson-shot {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  display: block;
}

/* ---------- Blog ---------- */
.post-list { display: grid; gap: 20px; max-width: 760px; }
.post-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; text-decoration: none; display: block;
}
.post-card:hover { border-color: var(--ember-deep); }
.post-card h3 { margin: 6px 0 8px; }
.post-card p { color: var(--muted); font-size: 0.95rem; }
.post-card .pdate {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint);
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------- Contact ---------- */
.contact { text-align: left; }
.mail-chip {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  color: #F2F5F0; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--ember-deep);
  border-radius: var(--radius); padding: 14px 20px;
}
.mail-chip:hover { border-color: var(--ember); color: var(--ember); }
.mail-chip::before { content: "▸"; color: var(--ember); }
.contact-meta { margin-top: 26px; font-family: var(--font-mono); font-size: 0.85rem; color: var(--faint); line-height: 2.4; }
.contact-meta a { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 34px 0; font-family: var(--font-mono);
  font-size: 0.76rem; color: var(--faint); background: var(--bg-deep);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--faint); }

/* ---------- Article pages (case studies + blog posts) ---------- */
.article { padding: 72px 0 90px; }
.article .wrap { max-width: 820px; }
.article h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: 18px; }
.article .specbar {
  margin: 30px 0 40px; padding: 20px 24px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 2.1; color: var(--muted);
}
.article .specbar b { color: var(--pine); }
.article h2 { margin: 44px 0 14px; font-size: 1.45rem; }
.article p { margin-bottom: 16px; color: var(--muted); }
.article ul { margin: 0 0 16px 22px; color: var(--muted); }
.article li { margin-bottom: 8px; }
.article strong { color: var(--text); }
.article .backlink { font-family: var(--font-mono); font-size: 0.82rem; }
.article code {
  font-family: var(--font-mono); font-size: 0.85em; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--pine);
}
.article pre {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; overflow-x: auto; margin-bottom: 16px;
}
.article pre code { background: none; border: none; padding: 0; color: var(--muted); }
.article .cta-band {
  margin-top: 54px; padding: 30px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.article .cta-band h3 { margin-bottom: 8px; }
.article .cta-band p { color: var(--muted); margin-bottom: 18px; }

/* ---------- Intro video (About) ---------- */
.about-video { margin-top: 26px; display: none; }
.about-video.ready { display: block; }
.about-video video {
  width: 100%; max-width: 640px; border: 1px solid var(--line);
  border-radius: var(--radius); display: block; background: var(--bg-deep);
}
.about-video figcaption { margin-top: 8px; }
