/* Ergentics, LLC — site system.
   Dawn palette, Spectral display + IBM Plex Mono labels, hairline instrument radii.
   Light is the default; dark follows the OS and can be forced via [data-theme] (header toggle).
   Tokens mirror the design prototype's palette() maps exactly. */

/* ── Tokens ──────────────────────────────────────────────────────────── */

:root {
  --bg: #ECE7DB;
  --bg2: #F4EFE6;
  --ink: #211F1A;
  --ink2: #544F46;
  --ink3: #7A756B;
  --line: rgba(33,31,26,0.14);
  --teal: #2C5F6A;
  --teal-ink: #215058;
  --dawn: #B85F27;
  --card: #F4EFE6;
  --card-line: rgba(33,31,26,0.12);
  --chip: rgba(44,95,106,0.10);

  --serif: "Spectral", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --maxw: 1200px;
}

/* Dark tokens — shared block, applied when OS prefers dark (and not forced light)
   or when the theme is explicitly forced to dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1918;
    --bg2: #142524;
    --ink: #ECE7DB;
    --ink2: rgba(236,231,219,0.74);
    --ink3: rgba(236,231,219,0.52);
    --line: rgba(236,231,219,0.14);
    --teal: #84B2BA;
    --teal-ink: #8FBEC6;
    --dawn: #E79350;
    --card: #142524;
    --card-line: rgba(236,231,219,0.12);
    --chip: rgba(132,178,186,0.14);
  }
}
:root[data-theme="dark"] {
  --bg: #0E1918;
  --bg2: #142524;
  --ink: #ECE7DB;
  --ink2: rgba(236,231,219,0.74);
  --ink3: rgba(236,231,219,0.52);
  --line: rgba(236,231,219,0.14);
  --teal: #84B2BA;
  --teal-ink: #8FBEC6;
  --dawn: #E79350;
  --card: #142524;
  --card-line: rgba(236,231,219,0.12);
  --chip: rgba(132,178,186,0.14);
}

/* ── Base ────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background .4s ease, color .4s ease;
}

a { color: var(--teal-ink); text-decoration: none; }
a:hover { color: var(--dawn); }
::selection { background: rgba(184,95,39,0.22); }

:focus-visible { outline: 2px solid var(--dawn); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.narrow { max-width: 800px; }
.mid { max-width: 1000px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dawn);
  margin: 0 0 18px;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark {
  font-family: var(--mono);
  font-size: 21px;
  color: var(--teal);
  line-height: 1;
  transform: translateY(1px);
}
.brand-name {
  position: relative;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}
.brand-name::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 1.72ch;      /* the teal tick under "erg" */
  height: 2px;
  background: var(--teal);
  border-radius: 1px;
}
.nav {
  display: flex;
  gap: 24px;
  margin-left: 6px;
}
.nav-link {
  position: relative;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink3);
  padding: 6px 1px;
  transition: color .2s ease;
}
.nav-link:hover { color: var(--ink); }
.nav-link.current { color: var(--ink); }
.nav-link.current::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 1px;
  background: var(--teal);
}
.theme-toggle {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink3);
  background: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 13px;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink3); }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  border-radius: 2px;
  padding: 14px 22px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn-primary { background: #E79350; color: #1C1410; border-color: #E79350; }
.btn-primary:hover { filter: brightness(1.07); color: #1C1410; }
.btn-ghost { background: transparent; color: #EFE7D8; border-color: rgba(239,231,216,0.42); }
.btn-ghost:hover { border-color: rgba(239,231,216,0.8); background: rgba(239,231,216,0.06); color: #EFE7D8; }
.btn-teal { background: var(--teal); color: var(--bg2); border-color: var(--teal); }
.btn-teal:hover { filter: brightness(1.07); color: var(--bg2); }

/* ── Hero (always dark ground) ───────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  background: #0B1615;
  min-height: min(88vh, 740px);
  display: flex;
  align-items: center;
}
.hero-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-field path {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: ergDraw 2.6s cubic-bezier(.16,.85,.28,1) var(--delay) forwards;
}
.hero-glow { transform-box: fill-box; transform-origin: center; animation: ergHalo 1.5s ease-out 2.2s both; }
.hero-halo { transform-box: fill-box; transform-origin: center; animation: ergGlow 1.2s ease-out 2.55s both; }
.hero-dot  { transform-box: fill-box; transform-origin: center; animation: ergGlow 1.1s ease-out 2.7s both; }

@keyframes ergDraw { to { stroke-dashoffset: 0; } }
@keyframes ergGlow { from { opacity: 0; transform: scale(0.45); } to { opacity: 1; transform: scale(1); } }
@keyframes ergHalo { from { opacity: 0; transform: scale(0.7); }  to { opacity: 1; transform: scale(1); } }

.hero-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 80px 32px;
  width: 100%;
}
.hero-copy { max-width: 610px; }
.hero-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(242,178,112,0.92);
  margin-bottom: 24px;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: #F2ECDE;
  margin: 0 0 24px;
}
.hero-lede {
  font-family: var(--serif);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.62;
  color: rgba(240,232,217,0.74);
  margin: 0 0 36px;
  max-width: 30em;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* ── Sections ────────────────────────────────────────────────────────── */

.section { max-width: var(--maxw); margin: 0 auto; padding: 112px 32px 44px; }
.section-band {
  background: var(--bg2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 56px;
}
.section-band .section-band-inner { max-width: var(--maxw); margin: 0 auto; padding: 112px 32px; }

.h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 16px;
}
.section-lede {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink2);
  margin: 0 0 44px;
  max-width: 34em;
}

/* ── Product cards (home grid) ───────────────────────────────────────── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 20px;
}
.product-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 3px;
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--ink);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: 0 14px 34px rgba(20,15,10,0.12);
  color: var(--ink);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mark-box {
  width: 42px; height: 42px;
  border: 1px solid var(--teal);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 21px;
  color: var(--teal);
}
.card-name {
  font-family: var(--serif); font-weight: 600; font-size: 22px;
  letter-spacing: -0.01em; color: var(--ink);
}
.card-desc {
  font-family: var(--serif); font-size: 15.5px; line-height: 1.55;
  color: var(--ink2); margin: 0;
}

/* status chips */
.chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 4px 9px; border-radius: 2px;
  border: 1px solid; white-space: nowrap;
}
.chip-live { color: var(--teal); border-color: var(--teal); background: var(--chip); }
.chip-soon { color: var(--ink3); border-color: var(--line); background: transparent; }

/* ── How it works ────────────────────────────────────────────────────── */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 40px;
}
.step { display: flex; flex-direction: column; gap: 14px; }
.step-n { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; color: var(--teal); }
.step-rule { height: 1px; background: var(--line); }
.step-title {
  font-family: var(--serif); font-weight: 600; font-size: 22px;
  letter-spacing: -0.01em; color: var(--ink); margin: 6px 0 0;
}
.step-desc { font-family: var(--serif); font-size: 16.5px; line-height: 1.58; color: var(--ink2); margin: 0; }

/* ── CTA band ────────────────────────────────────────────────────────── */

.cta {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 60px 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.cta-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dawn); }
.cta-copy { max-width: 26em; }
.cta-copy .h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.14; margin: 0; }
.cta-copy .eyebrow { margin-bottom: 14px; }

/* ── Products page (rows) ────────────────────────────────────────────── */

.page-hero { max-width: 1000px; margin: 0 auto; padding: 96px 32px 34px; }
.page-hero.tight { max-width: 800px; }
.page-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(38px, 5vw, 60px); line-height: 1.04;
  letter-spacing: -0.02em; color: var(--ink); margin: 0 0 22px;
}
.page-lede {
  font-family: var(--serif); font-size: 20px; line-height: 1.6;
  color: var(--ink2); margin: 0; max-width: 34em;
}

.product-rows {
  max-width: 1000px; margin: 0 auto; padding: 24px 32px 96px;
  display: flex; flex-direction: column; gap: 20px;
}
.product-row {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: 3px; padding: 36px 34px;
  display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap;
}
.mark-box-lg {
  width: 74px; height: 74px; flex: none;
  border: 1px solid var(--teal); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 34px; color: var(--teal);
}
.product-row-body { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 14px; }
.product-row-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.product-row-head h2 {
  font-family: var(--serif); font-weight: 600; font-size: 28px;
  letter-spacing: -0.015em; color: var(--ink); margin: 0;
}
.product-row-body p {
  font-family: var(--serif); font-size: 17.5px; line-height: 1.6;
  color: var(--ink2); margin: 0; max-width: 44em;
}
.availability {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink3); margin-top: 4px;
}

/* ── Prose (About) ───────────────────────────────────────────────────── */

.prose { max-width: 800px; margin: 0 auto; padding: 96px 32px; }
.prose .page-title { margin-bottom: 34px; }
.prose p {
  font-family: var(--serif); font-size: 20px; line-height: 1.66;
  color: var(--ink2); margin: 0 0 24px;
}
.prose p.lead { color: var(--ink); }
.prose p:last-child { margin-bottom: 0; }

/* ── Contact ─────────────────────────────────────────────────────────── */

.contact-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.contact-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 20px; flex-wrap: wrap; padding: 22px 0; border-bottom: 1px solid var(--line);
}
.contact-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink3);
}
.contact-value { font-family: var(--serif); font-size: 21px; color: var(--teal-ink); }

/* ── Legal (Privacy / Terms) ─────────────────────────────────────────── */

.legal { max-width: 760px; margin: 0 auto; padding: 96px 32px; }
.legal .page-title { font-size: clamp(34px, 4.4vw, 50px); line-height: 1.06; margin: 0 0 14px; }
.legal-updated {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink3); margin: 0 0 40px;
}
.legal-body h2 {
  font-family: var(--serif); font-weight: 600; font-size: 23px;
  letter-spacing: -0.01em; color: var(--ink); margin: 40px 0 16px;
}
.legal-body p, .legal-body li {
  font-family: var(--serif); font-size: 17px; line-height: 1.66; color: var(--ink2);
}
.legal-body p { margin: 0 0 14px; }
.legal-body ul { margin: 0 0 14px; padding-left: 1.2em; }
.legal-body li { margin: 0 0 8px; }

/* ── Footer ──────────────────────────────────────────────────────────── */

.site-footer { background: var(--bg2); border-top: 1px solid var(--line); }
.footer-grid {
  max-width: var(--maxw); margin: 0 auto;
  padding: 64px 32px 32px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
}
.footer-brand { display: flex; flex-direction: column; gap: 14px; max-width: 22em; }
.footer-tag {
  font-family: var(--serif); font-style: italic; font-size: 16px;
  line-height: 1.5; color: var(--ink2); margin: 6px 0 0;
}
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 2px;
}
.footer-link { font-family: var(--serif); font-size: 16px; color: var(--ink2); transition: color .2s ease; }
.footer-link:hover { color: var(--ink); }
.footer-bottom {
  max-width: var(--maxw); margin: 0 auto;
  padding: 20px 32px 40px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.footer-bottom span {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--ink3);
}

/* ── Reduced motion — render the hero settled, no animation ───────────── */

@media (prefers-reduced-motion: reduce) {
  .hero-field path { stroke-dashoffset: 0; animation: none; }
  .hero-glow, .hero-halo, .hero-dot { animation: none; opacity: 1; transform: none; }
  html, body { transition: none; }
}

/* ── Small screens ───────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-inner { gap: 18px; }
  .nav { gap: 18px; }
  .section, .section-band .section-band-inner { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 520px) {
  .wrap, .section, .hero-inner, .footer-grid, .footer-bottom,
  .page-hero, .product-rows, .prose, .legal, .header-inner,
  .section-band .section-band-inner { padding-left: 20px; padding-right: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .cta { padding: 40px 28px; }
}
