/* ==========================================================================
   Haptic Grove — stylesheet
   Palette: evergreen ink, warm off-white paper, grove green signal
   Type:    Bricolage Grotesque (display) / Instrument Sans (body) / IBM Plex Mono (labels)
   ========================================================================== */

/* --- Tokens: light is the base layer -------------------------------------- */
:root {
  --paper:      #EDEFE8;
  --paper-2:    #F7F8F3;
  --paper-3:    #E3E7DE;
  --ink:        #10231C;
  --ink-2:      #36473F;
  --muted:      #65756C;
  --line:       #CED6CB;
  --line-2:     #B8C3B5;
  --accent:     #1C5A3E;
  --accent-2:   #2F7D55;
  --signal:     #2F7D55;
  --glow:       rgba(28, 90, 62, 0.10);
  --on-accent:  #F7F8F3;

  /* The scale band commits to an evergreen ground in both themes. */
  --band-bg:    #10231C;
  --band-ink:   #F2F6F1;
  --band-ink-2: #AEC0B4;
  --band-ink-3: #C9D6CD;
  --band-accent:#6FCF97;

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body:    "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.3rem + 0.8vw, 1.9rem);
  --step-3:  clamp(1.85rem, 1.55rem + 1.5vw, 2.7rem);
  --step-4:  clamp(2.3rem, 1.7rem + 3.2vw, 4.1rem);

  --wrap: 1160px;
  --gutter: clamp(1.125rem, 4vw, 3.25rem);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 0.68, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0A1410;
    --paper-2: #111E18;
    --paper-3: #16251E;
    --ink:     #E8EFE8;
    --ink-2:   #BDCAC2;
    --muted:   #8CA095;
    --line:    #22342B;
    --line-2:  #2E443A;
    --accent:  #7FD7A4;
    --accent-2:#6FCF97;
    --signal:  #6FCF97;
    --glow:    rgba(111, 207, 151, 0.14);
    --on-accent: #07110C;
    --band-bg: #0F1F18;
  }
}

:root[data-theme="dark"] {
  --paper:   #0A1410;
  --paper-2: #111E18;
  --paper-3: #16251E;
  --ink:     #E8EFE8;
  --ink-2:   #BDCAC2;
  --muted:   #8CA095;
  --line:    #22342B;
  --line-2:  #2E443A;
  --accent:  #7FD7A4;
  --accent-2:#6FCF97;
  --signal:  #6FCF97;
  --glow:    rgba(111, 207, 151, 0.14);
  --on-accent: #07110C;
  --band-bg: #0F1F18;
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* A class that sets display must not out-rank the hidden attribute. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 0;
  font-weight: 600;
}

p { margin: 0; }
img, svg, canvas { max-width: 100%; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  border-radius: 0 0 8px 8px;
  transform: translateY(-110%);
  transition: transform 160ms var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0;
}

.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); max-width: 34ch; }
.prose { max-width: 62ch; }

/* --- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms var(--ease);
}
.site-header[data-stuck="true"] { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .mark-stroke { stroke: var(--ink); }
.brand .mark-node { fill: var(--signal); }
.brand .mark-root { fill: var(--ink); }
.brand .mark-pulse { stroke: var(--signal); }

/* --- Sections ------------------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-head { display: grid; gap: 0.9rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head h2 { font-size: var(--step-3); max-width: 24ch; }
.section-head .prose { color: var(--muted); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* --- Hero: type in front, the grove growing behind it --------------------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(1.75rem, 4vw, 3rem) clamp(3rem, 7vw, 5.5rem);
  min-height: clamp(560px, 80vh, 860px);
  display: flex;
  align-items: flex-start;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(92% 108% at 68% 82%, #000 52%, transparent 92%);
  mask-image: radial-gradient(92% 108% at 68% 82%, #000 52%, transparent 92%);
}
.hero-inner { position: relative; }
.hero h1 { max-width: 20ch; }
.hero .lede { max-width: 34ch; }
.hero h1 {
  font-size: var(--step-4);
  max-width: 20ch;
  margin-block: 1.1rem 1.4rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
/* Solid ground: these buttons sit over the hero animation. */
.btn-ghost { border-color: var(--line-2); color: var(--ink); background: var(--paper-2); }
.btn-ghost:hover { border-color: var(--accent-2); background: var(--paper-3); color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }

.hero-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.75rem;
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  letter-spacing: 0.03em;
  max-width: 60rem;
}
.hero-strip li { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero-strip li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
}

@media (max-width: 900px) {
  .hero { min-height: 0; padding-bottom: clamp(2.5rem, 8vw, 4rem); }
  .hero-canvas { opacity: 0.4; }
  .lede { max-width: 52ch; }
}

/* --- Services ------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: clamp(1.4rem, 2.5vw, 2rem);
  background: var(--paper-2);
  transition: background 200ms var(--ease);
}
.card:hover { background: var(--paper-3); }
.card-wide { grid-column: 1 / -1; }
.card-wide p { max-width: 62ch; }
.card-wide ul { grid-template-columns: repeat(auto-fit, minmax(11rem, auto)); display: grid; }
.card h3 { font-size: var(--step-1); }
.card p { color: var(--ink-2); font-size: 0.97rem; }
.card-glyph { width: 34px; height: 34px; color: var(--signal); }
.card ul {
  margin: auto 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1rem;
}
.card li { display: flex; gap: 0.55rem; }
.card li::before { content: "/"; color: var(--signal); }

@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
}

/* --- Process (a real sequence, so it is numbered) ------------------------- */
.process { position: relative; }
.steps { display: grid; gap: 0; position: relative; }
.step {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: start;
  padding-block: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--line);
}
.step:last-child { border-bottom: 1px solid var(--line); }
.step-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--signal);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.step-num::after {
  content: "";
  width: 0; height: 1px;
  background: var(--signal);
  transition: width 700ms var(--ease);
}
.step.is-in .step-num::after { width: 1.4rem; }
.step h3 { font-size: var(--step-2); }
.step p { color: var(--ink-2); }
.step-out {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.8rem;
}
@media (max-width: 780px) {
  .step { grid-template-columns: 3rem minmax(0, 1fr); }
  .step-body { grid-column: 2; }
  .step-aside { grid-column: 2; }
}

/* --- Scale band ----------------------------------------------------------- */
.scale-band {
  background: var(--band-bg);
  color: var(--band-ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 3.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
}
.scale-band h2 { color: var(--band-ink); font-size: var(--step-3); max-width: 20ch; }
.scale-band p { color: var(--band-ink-2); max-width: 46ch; margin-top: 1rem; }
.scale-points { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.scale-points li { display: flex; gap: 0.7rem; font-size: 0.97rem; color: var(--band-ink-3); }
.scale-points svg { width: 17px; height: 17px; flex: none; margin-top: 0.28rem; color: var(--band-accent); }

.scale-band .eyebrow { color: var(--band-accent); }
.lattice { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px; }
.lattice i {
  display: block;
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--band-accent);
  opacity: 0.18;
  transition: opacity 600ms var(--ease);
}
.lattice i.lit { opacity: 0.95; }
@media (max-width: 860px) {
  .scale-band { grid-template-columns: 1fr; }
}

/* --- Audiences ------------------------------------------------------------ */
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 2.5vw, 2.1rem);
  background: var(--paper-2);
  display: grid;
  gap: 0.85rem;
  align-content: start;
}
.panel h3 { font-size: var(--step-2); }
.panel p { color: var(--ink-2); }
.panel ul { margin: 0.3rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.45rem; color: var(--ink-2); font-size: 0.97rem; }
.panel li::marker { color: var(--signal); }
.panel-note {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--signal);
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: 0.4rem;
}

/* --- Contact -------------------------------------------------------------- */
.contact-block { display: grid; gap: 0.9rem; justify-items: start; }
.contact-block h2 { font-size: var(--step-3); max-width: 20ch; }
.contact-sub { color: var(--muted); }
.contact-mail-row { margin-top: 0.9rem; }
.contact-mail {
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 0.2rem;
  display: inline-block;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.contact-mail:hover { color: var(--accent); border-color: var(--accent-2); }
.contact-meta { margin-top: 1.25rem; display: grid; gap: 0.45rem; font-size: 0.95rem; color: var(--muted); }

/* --- Legal pages ---------------------------------------------------------- */
.legal { max-width: 50rem; }
.legal-head { display: grid; gap: 0.9rem; padding-bottom: clamp(1.5rem, 4vw, 2.25rem); border-bottom: 1px solid var(--line); }
.legal-head h1 { font-size: var(--step-3); max-width: 20ch; }
.legal-head .lede { max-width: 48ch; }
.legal-date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.legal section { padding-block: clamp(1.75rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
.legal h2 { font-size: var(--step-2); margin-bottom: 0.9rem; }
.legal h3 { font-size: var(--step-1); margin: 1.6rem 0 0.5rem; }
.legal p { margin-bottom: 0.9rem; max-width: 66ch; }
.legal p:last-child { margin-bottom: 0; }
.legal-list { display: grid; gap: 0.7rem; margin: 0 0 0.9rem; padding-left: 1.15rem; max-width: 66ch; }
.legal-list li::marker { color: var(--signal); }
.legal-list strong { color: var(--ink); }
.legal-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
.legal-contact { margin-top: 0.4rem; }
.legal-contact-spaced { padding-top: 1.75rem; }
.legal-meta { color: var(--muted); font-size: 0.95rem; margin-top: 0.9rem; }
.legal-note {
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.legal-note p { font-size: 0.95rem; color: var(--ink-2); margin: 0; }
.legal .contact-mail { font-size: var(--step-2); overflow-wrap: anywhere; }

/* --- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem 3rem; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); text-decoration: underline; }

/* --- Motion: reveal from a visible resting state -------------------------- */
.reveal { opacity: 1; transform: none; }
html[data-anim="on"] .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}
html[data-anim="on"] .reveal.is-in { opacity: 1; transform: none; }

@keyframes hg-pulse {
  0%   { opacity: 0; transform: scale(0.7); }
  35%  { opacity: 0.55; }
  100% { opacity: 0; transform: scale(1.45); }
}
html[data-anim="on"] .brand .mark-pulse {
  transform-origin: 16px 27.5px;
  animation: hg-pulse 3.6s var(--ease) infinite;
}

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