/* Steuerkanzlei Bagha – Website
   Tokens: tokens.css (Design System). Motion follows Emil Kowalski's design-engineering rules:
   custom curves, transform/opacity only, hover gated to fine pointers, press feedback, reduced motion. */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  --fs-hero: clamp(42px, 3.6vw + 18px, 70px);
  --fs-section: clamp(34px, 1.8vw + 22px, 50px);
  --section-y: clamp(72px, 7vw + 24px, 128px);
  --gutter: clamp(20px, 4vw, 40px);

  /* Contrast-corrected text tokens (WCAG AA ≥4.5:1 on paper-50/100/200).
     Design-system values #8C7556 / #7A776F measured 4.0–4.3:1 for small text. */
  --text-accent: #76623f;
  --text-subtle: #696660;
  --focus-ring: var(--sand-600);

  interpolate-size: allow-keywords;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--ink-300) var(--paper-100);
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-strong);
  text-wrap: balance;
}
h1 em, h2 em, h3 em { font-style: italic; font-weight: 400; color: var(--ink-700); }
p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul, ol { list-style: none; }

a {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--sand-400);
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--text-link-hover); text-decoration-color: currentColor; }
}

::placeholder { color: var(--text-subtle); opacity: 1; }
::selection { background: var(--sand-200); color: var(--ink-900); }
input, textarea { caret-color: var(--ink-900); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; background: var(--ink-900); color: var(--paper-50);
  border-radius: var(--radius-1); text-decoration: none; font-size: 15px;
  transform: translateY(-160%);
  transition: transform 200ms var(--ease-out);
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: calc(var(--container-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left));
}

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Type helpers ---------- */
.eyebrow {
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; line-height: 1.2; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-accent);
}
.eyebrow .rule { width: var(--rule-accent-w); height: 1px; background: var(--sand-500); flex: none; }
.eyebrow-inverse { color: var(--sand-400); }
.eyebrow-inverse .rule { background: var(--sand-400); }
.lead { font-size: clamp(18px, 0.4vw + 16px, 20px); line-height: 1.55; }
.muted { color: var(--text-muted); }

.placeholder {
  background: var(--amber-100);
  box-shadow: 0 0 0 3px var(--amber-100);
  border-radius: 1px;
}

/* ---------- Buttons ---------- */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 22px;
  font: 500 15px/1 var(--font-body); letter-spacing: 0.02em; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-1);
  touch-action: manipulation; user-select: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn .arrow { width: 18px; height: 18px; transition: transform 200ms var(--ease-out); }
.btn-sm { --h: 38px; padding: 0 16px; font-size: 14px; }
.btn-lg { --h: 54px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }
.cta-short { display: none; }

.btn-primary { background: var(--action-primary); color: var(--action-on-primary); }
.btn-secondary { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--action-primary-hover); color: var(--action-on-primary); }
  .btn-secondary:hover { background: var(--action-secondary-hover); color: var(--text-strong); }
  .btn:hover .arrow { transform: translateX(3px); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 245, 241, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.site-header[data-scrolled] { border-bottom-color: var(--border-hairline); }

.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 40px;
}
.brand {
  display: flex; align-items: center; gap: 14px;
  color: var(--ink-900); text-decoration: none; margin-right: auto;
}
.brand-mono svg { height: 38px; width: auto; }
.brand-word { padding-left: 14px; border-left: 1px solid var(--border-hairline); }
.brand-word svg { height: 15px; width: auto; }

.main-nav ul { display: flex; gap: 32px; }
.main-nav a {
  position: relative; display: inline-block; padding: 6px 0;
  font-size: 15px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-body); text-decoration: none;
}
.main-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--sand-500);
  transform: scaleX(0); transform-origin: right;
  transition: transform 220ms var(--ease-out);
}
.main-nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }
@media (hover: hover) and (pointer: fine) {
  .main-nav a:hover { color: var(--text-strong); }
  .main-nav a:hover::after { transform: scaleX(1); transform-origin: left; }
}

.menu-toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; cursor: pointer; color: var(--ink-900);
  touch-action: manipulation;
}
.menu-icon { position: relative; display: block; width: 22px; height: 12px; margin: auto; }
.menu-icon span {
  position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 1px;
  transition: transform 240ms var(--ease-in-out);
}
.menu-icon span:first-child { top: 0; }
.menu-icon span:last-child { bottom: 0; }
.menu-toggle[aria-expanded="true"] .menu-icon span:first-child { transform: translateY(5.25px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-icon span:last-child { transform: translateY(-5.25px) rotate(-45deg); }

.mobile-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--paper-100);
  border-bottom: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-2);
  visibility: hidden; opacity: 0; transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms var(--ease-out), visibility 0s linear 160ms;
}
.mobile-menu[data-open] {
  visibility: visible; opacity: 1; transform: none;
  transition: opacity 220ms ease, transform 260ms var(--ease-out), visibility 0s;
}
.mobile-menu nav {
  display: flex; flex-direction: column;
  padding: 8px var(--gutter) calc(24px + env(safe-area-inset-bottom));
}
.mobile-menu nav a:not(.btn) {
  padding: 16px 0; border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-display); font-size: 26px; line-height: 1.2;
  color: var(--text-strong); text-decoration: none;
}
.mobile-menu .btn { margin-top: 24px; height: 52px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 5vw, 72px) 0 var(--section-y); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(40px, 5vw, 80px); align-items: center;
}
.hero-title {
  margin-top: 0; text-wrap: balance;
  font-size: var(--fs-hero); line-height: 1.02; letter-spacing: -0.01em;
}
.hero-title > * { display: block; }
.hero-copy .lead { margin-top: 28px; max-width: 34em; color: var(--text-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.hero-media { position: relative; }
.hero-image { aspect-ratio: 4 / 5; overflow: hidden; background: var(--paper-300); }
.hero-image img { width: 100%; height: 100%; object-fit: cover; object-position: 27% 50%; }

/* Hero entrance: one-time, marketing context → may run a little longer */
.js .hero-in { animation: rise 640ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
.js .hero-image { animation: unveil 1000ms var(--ease-in-out) 80ms both; }
.js .hero-image img { animation: settle 1400ms var(--ease-out) 80ms both; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes unveil { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes settle { from { transform: scale(1.06); } }

/* ---------- Sections ---------- */
.section { padding: var(--section-y) 0; }
.section-alt {
  background: var(--paper-50);
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
}
.section-head { max-width: 800px; }
.section-head h2, .band-head h2, .contact-info h2 {
  margin-top: 0; font-size: var(--fs-section); line-height: 1.08;
}
.section-head .lead, .section-head > p:last-child { margin-top: 20px; }

/* Scroll reveal: one entrance per container, once */
.js .reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Tabs (clip-path highlight) ---------- */
.tabs { margin-top: 44px; }
.tablist-wrap {
  position: relative;
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border-hairline);
}
.tablist-wrap::-webkit-scrollbar { display: none; }
.tablist { display: flex; gap: 40px; width: max-content; }
.tablist > * {
  position: relative;
  padding: 12px 0 16px; margin: 0;
  background: none; border: 0;
  font: 500 16px/1.3 var(--font-body); letter-spacing: 0.02em;
  color: var(--text-muted); white-space: nowrap; cursor: pointer;
  touch-action: manipulation;
  transition: color 150ms ease;
}
.tablist > *:focus-visible { outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .tablist button:hover { color: var(--text-body); }
}
.tablist-active {
  position: absolute; inset: 0 auto 0 0;
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 300ms var(--ease-in-out);
}
.tablist-active > * { color: var(--text-strong); box-shadow: inset 0 -2px 0 var(--ink-900); }
.tablist-active[data-instant] { transition: none; }

.tabpanel { padding-top: 40px; }
.tabpanel:focus-visible { outline-offset: 12px; }
.tabpanel[data-entering] { animation: panel-in 260ms var(--ease-out) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.service-card {
  position: relative;
  display: flex; flex-direction: column; gap: 18px;
  padding: 32px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-2);
  transition: transform 260ms var(--ease-out), border-color 200ms ease;
}
/* Shadow lives on a pseudo-element so hover animates opacity, not box-shadow */
.service-card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none;
  transition: opacity 260ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .service-card:hover { transform: translateY(-2px); border-color: var(--border-default); }
  .service-card:hover::after { opacity: 1; }
}
.service-icon {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid var(--border-accent); border-radius: 50%;
  color: var(--navy-700);
}
.service-icon .icon { width: 22px; height: 22px; }
.service-card h3 { font-size: 26px; line-height: 1.2; }
.service-list { display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.service-list li { position: relative; padding-left: 20px; }
.service-list li::before {
  content: ""; position: absolute; left: 0; top: 0.75em; width: 10px; height: 1px; background: var(--sand-500);
}
.service-desc { font-size: 15px; line-height: 1.5; color: var(--text-muted); }

.founder { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.founder-intro h3 { font-size: clamp(28px, 1vw + 22px, 34px); line-height: 1.15; }
.founder-intro p { margin-top: 16px; }
.founder-intro .btn { margin-top: 28px; }
.founder-steps { border-top: 1px solid var(--border-hairline); }
.founder-steps li {
  display: grid; grid-template-columns: 56px 1fr; align-items: baseline;
  padding: 20px 0; border-bottom: 1px solid var(--border-hairline);
  font-size: 17px; color: var(--text-strong);
}
.step-no { font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--text-accent); }

/* ---------- Dark band ---------- */
.band { background: var(--navy-900); color: var(--text-inverse-muted); padding: var(--section-y) 0; }
.band h2, .band h3 { color: var(--paper-50); }
.band h2 em { color: var(--sand-200); }
.band-head { max-width: 760px; }
.values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(32px, 4vw, 64px); margin-top: 64px; }
.values li { padding-top: 28px; border-top: 1px solid var(--border-inverse); }
.value-no { display: block; font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--sand-400); }
.values h3 { margin-top: 14px; font-size: 30px; }
.values p { margin-top: 12px; max-width: 60ch; font-size: 16px; line-height: 1.6; }

/* ---------- About ---------- */
.about-grid {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  grid-template-areas: "aside head" "aside copy";
  grid-template-rows: auto 1fr;
  column-gap: clamp(40px, 7vw, 112px); align-items: start;
}
.about-head { grid-area: head; }
.about-copy { grid-area: copy; }
.about-aside { grid-area: aside; position: sticky; top: calc(var(--header-h) + 32px); }
.about-head h2 { margin-top: 0; font-size: var(--fs-section); line-height: 1.08; }
.portrait { width: min(100%, 300px); aspect-ratio: 233 / 300; overflow: hidden; background: var(--paper-300); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.facts { margin-top: 32px; border-top: 1px solid var(--border-hairline); max-width: 360px; }
.facts > div { padding: 14px 0; border-bottom: 1px solid var(--border-hairline); }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-subtle); }
.facts dd { margin-top: 2px; font-size: 15px; color: var(--text-strong); }
.prose { margin-top: 32px; max-width: var(--container-text); display: flex; flex-direction: column; gap: 20px; }
.prose p:not(.lead) { color: var(--text-body); }
.prose .lead { color: var(--text-strong); }
.signature {
  margin-top: 40px; padding-top: 24px; max-width: var(--container-text);
  border-top: 1px solid var(--border-hairline);
  font-family: var(--font-display); font-style: italic; font-size: 30px; color: var(--text-strong);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
}
.signature span { font-family: var(--font-body); font-style: normal; font-size: 14px; letter-spacing: 0.04em; color: var(--text-muted); }

/* ---------- Digital flow ---------- */
.flow-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
.flow-head { position: sticky; top: calc(var(--header-h) + 32px); }

.flow-needs { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border-hairline); }
.flow-needs-title { font-family: var(--font-display); font-size: 22px; line-height: 1.25; color: var(--text-strong); }
.flow-needs .assurances { margin-top: 16px; }
/* Timeline: connector fills with scroll, nodes light up in sequence (main.js) */
.flow { --node: 48px; }
.flow-step { position: relative; display: grid; grid-template-columns: var(--node) minmax(0, 1fr); gap: 24px; }
.flow-step:not(:last-child) .flow-body { padding-bottom: 56px; }
.flow-step:not(:last-child)::before,
.flow-step:not(:last-child)::after {
  content: ""; position: absolute; left: calc(var(--node) / 2 - 0.5px); width: 1px;
  top: calc(var(--node) + 8px); bottom: 8px;
}
.flow-step:not(:last-child)::before { background: var(--border-default); }
.flow-step:not(:last-child)::after {
  background: var(--sand-500); transform-origin: top; transform: scaleY(var(--seg, 1));
}
.flow-node {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: var(--node); height: var(--node); border-radius: 50%;
  background: var(--ink-900); border: 1px solid var(--ink-900); color: var(--paper-50);
  transition: background-color 240ms var(--ease-out), border-color 240ms var(--ease-out), color 240ms var(--ease-out);
}
.flow-node .icon { width: 20px; height: 20px; }
.js .flow-step:not(:last-child)::after { transform: scaleY(var(--seg, 0)); }
.js .flow-step:not(.is-active) .flow-node { background: var(--surface-card); border-color: var(--border-default); color: var(--text-accent); }
.flow-body h3 { font-size: 28px; line-height: 1.2; margin-top: 6px; }
.flow-body p { margin-top: 10px; max-width: 60ch; color: var(--text-muted); font-size: 16px; }
.flow-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.flow-tags li {
  padding: 4px 10px; font-size: 13px; line-height: 1.4; color: var(--text-body);
  border: 1px solid var(--border-hairline); border-radius: var(--radius-1); background: var(--surface-card);
}

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
.faq-head { position: sticky; top: calc(var(--header-h) + 32px); }
.faq-head > p.muted { margin-top: 24px; }
.faq-group + .faq-group { margin-top: 64px; }
.faq-group h3 { font-size: 15px; font-family: var(--font-body); font-weight: 500; letter-spacing: 0.02em; color: var(--text-accent); margin-bottom: 8px; }
.faq { border-top: 1px solid var(--border-hairline); }
.faq details { border-bottom: 1px solid var(--border-hairline); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 24px 0; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-size: clamp(21px, 0.5vw + 18px, 24px); line-height: 1.3; color: var(--text-strong);
  touch-action: manipulation;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform 240ms var(--ease-out); color: var(--text-muted); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size 280ms var(--ease-out), content-visibility 280ms allow-discrete;
}
.faq details[open]::details-content { block-size: auto; }
.faq-body { padding: 0 48px 24px 0; color: var(--text-muted); }
.faq-body p { opacity: 0; transition: opacity 200ms ease; }
.faq details[open] .faq-body p { opacity: 1; transition-delay: 60ms; }
@media (hover: hover) and (pointer: fine) {
  .faq summary:hover .icon { color: var(--text-strong); }
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
.contact-info h2 em { display: block; }
.contact-info .lead { margin-top: 20px; }
.assurances { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.5; color: var(--text-body); }
.assurances li { display: flex; gap: 12px; align-items: flex-start; }
.assurances .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--sand-600); }

.submit-group { display: flex; flex-direction: column; gap: 12px; }
.form-note { font-size: 14px; line-height: 1.5; color: var(--text-muted); text-align: center; text-wrap: pretty; }
.form-result {
  padding: 24px; border: 1px solid var(--border-accent); border-radius: var(--radius-2);
  background: var(--surface-accent); color: var(--text-body); font-size: 15px; line-height: 1.55;
}
.form-result:focus-visible { outline-offset: 4px; }
.form-result:not([hidden]) { animation: rise 260ms var(--ease-out); }
.form-result-title { font-family: var(--font-display); font-size: 24px; font-weight: 500; line-height: 1.2; color: var(--text-strong); margin-bottom: 8px; }
.form-result a { color: var(--text-strong); }
.form-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.form-result-actions .btn { background: var(--paper-50); }
.contact-list { margin-top: 40px; border-top: 1px solid var(--border-hairline); }
.contact-list li {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 0; border-bottom: 1px solid var(--border-hairline);
  font-size: 16px; color: var(--text-strong);
}
.contact-list .icon { margin-top: 3px; color: var(--sand-600); }
.contact-list .label {
  display: block; margin-bottom: 2px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-subtle);
}
.contact-list a { color: var(--text-strong); }

.contact-form {
  display: flex; flex-direction: column; gap: 22px;
  padding: clamp(24px, 4vw, 40px);
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-2);
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--text-strong); padding: 0; }
.optional { font-weight: 400; color: var(--text-subtle); margin-left: 6px; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  font: 400 17px/1.4 var(--font-body); color: var(--text-strong);
  background: var(--paper-50);
  border: 1px solid var(--border-default); border-radius: var(--radius-1);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  -webkit-appearance: none; appearance: none;
}
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; background: #fff;
  border-color: var(--ink-900); box-shadow: 0 0 0 3px var(--sand-200);
}
.field[data-invalid] input, .field[data-invalid] textarea { border-color: var(--status-error); }
.field-error {
  display: none; font-size: 13px; color: var(--status-error);
}
.field[data-invalid] .field-error { display: block; animation: rise 200ms var(--ease-out); }

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-default); border-radius: var(--radius-1);
  padding: 3px; gap: 3px; background: var(--paper-50);
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center; min-height: 42px; padding: 0 8px;
  font-size: 14px; font-weight: 500; text-align: center; color: var(--text-muted);
  border-radius: 1px;
  transition: background-color 150ms ease, color 150ms ease;
}
.segmented input:checked + span { background: var(--ink-900); color: var(--paper-50); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .segmented input:not(:checked):hover + span { background: var(--paper-200); color: var(--text-strong); }
}

.check { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: 14px; line-height: 1.5; color: var(--text-muted); cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; }
.check-box {
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-1); background: var(--paper-50);
  color: var(--paper-50);
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.check-box .icon { width: 15px; height: 15px; stroke-width: 2.25; opacity: 0; transform: scale(0.8); transition: opacity 150ms ease, transform 200ms var(--ease-out); }
.check input:checked + .check-box { background: var(--ink-900); }
.check input:checked + .check-box .icon { opacity: 1; transform: none; }
.check:active .check-box { transform: scale(0.94); }
.check input:focus-visible + .check-box { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.field[data-invalid] .check-box { border-color: var(--status-error); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-900); color: var(--text-inverse-muted);
  padding: 80px 0 calc(32px + env(safe-area-inset-bottom));
  font-size: 15px;
}
.site-footer a { color: var(--paper-50); text-decoration-color: rgba(247,245,241,.3); }
@media (hover: hover) and (pointer: fine) {
  .site-footer a:hover { color: var(--paper-50); text-decoration-color: var(--sand-400); }
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 48px; }
.footer-logo { display: inline-block; color: var(--paper-50); }
.footer-logo svg { width: 220px; height: auto; }
.footer-brand p { margin-top: 24px; max-width: 32ch; }
.footer-nav, .footer-contact { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.footer-nav a { text-decoration: none; }
.footer-nav .eyebrow, .footer-contact .eyebrow { margin-bottom: 8px; }
.site-footer .placeholder { background: rgba(245,234,216,.14); box-shadow: 0 0 0 3px rgba(245,234,216,.14); }
.footer-legal {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  position: relative;
  margin-top: 64px; padding-top: 24px;
  font-size: 13px;
}
.footer-legal::before {
  content: ""; position: absolute; top: 0; height: 1px; background: var(--border-inverse);
  left: max(var(--gutter), env(safe-area-inset-left)); right: max(var(--gutter), env(safe-area-inset-right));
}
.legal-links { display: flex; gap: 24px; }
.legal-links a[aria-current="page"] { text-decoration-color: var(--sand-400); }

/* ---------- Legal pages ---------- */
.legal .container { max-width: calc(760px + var(--gutter) * 2); }
.legal h1 { font-size: var(--fs-section); line-height: 1.08; }
.legal .lead { margin-top: 20px; color: var(--text-muted); }
.legal-note {
  margin-top: 32px; padding: 16px 20px;
  background: var(--amber-100); border-radius: var(--radius-1);
  font-size: 15px; color: var(--text-body);
}
.legal section { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border-hairline); }
.legal h2 { font-size: 26px; line-height: 1.2; }
.legal h2, .legal h3 { overflow-wrap: break-word; hyphens: auto; }
.legal h3 { margin-top: 32px; font-size: 21px; line-height: 1.3; }
.legal h4 { margin-top: 20px; font-family: var(--font-body); font-size: 16px; line-height: 1.4; font-weight: 600; }
.legal section p { margin-top: 12px; max-width: 65ch; }
.legal section ul { margin-top: 12px; padding-left: 1.2em; list-style: disc; }
.legal section li + li { margin-top: 4px; }

/* ---------- Toast (Sonner-style: 400ms ease, enters & exits from the same edge) ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 80;
  width: min(420px, calc(100vw - 32px)); transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px;
  background: var(--ink-900); color: var(--paper-50);
  border-radius: var(--radius-2); box-shadow: var(--shadow-3);
  font-size: 15px; line-height: 1.45;
  pointer-events: auto;
  opacity: 0; transform: translateY(100%);
  transition: opacity 400ms ease, transform 400ms ease;
}
.toast[data-mounted] { opacity: 1; transform: none; }
.toast[data-removed] { opacity: 0; transform: translateY(100%); transition-duration: 300ms; }
.toast .icon { color: var(--sand-400); margin-top: 1px; }
.toast strong { display: block; font-weight: 600; }
@media (min-width: 720px) {
  .toast-region { left: auto; right: 24px; transform: none; width: 380px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .main-nav ul { gap: 24px; }
  .header-inner { gap: 28px; }
  .brand-word { display: none; }
}

@media (max-width: 900px) {
  .main-nav, .cta-long { display: none; }
  .header-inner { gap: 16px; }
  .cta-short { display: inline; }
  .brand-word { display: block; }
  .menu-toggle { display: block; }
  :root { --header-h: 68px; }
  .brand-mono svg { height: 32px; }
  .brand-word svg { height: 13px; }

  .hero-grid, .faq-grid, .flow-grid, .contact-grid, .founder { grid-template-columns: 1fr; }
  .flow-head, .faq-head { position: static; }
  .about-grid { grid-template-columns: 1fr; grid-template-areas: "head" "aside" "copy"; grid-template-rows: auto; row-gap: 40px; }
  .about-copy .prose { margin-top: 0; }
  .hero-media { order: -1; }
  .hero-image { aspect-ratio: 4 / 3; }
  .hero-image img { object-position: 30% 35%; }
  .card-grid, .values { grid-template-columns: 1fr; }
  .card-grid { gap: 16px; }
  .about-aside { position: static; display: grid; grid-template-columns: 160px 1fr; gap: 24px; align-items: end; }
  .facts { margin-top: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .service-card { padding: 24px; }
  .tablist { gap: 20px; }
  .tablist > * { font-size: 15px; letter-spacing: 0; }
  .field-row { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: 1fr; }
  .about-aside { grid-template-columns: 1fr; }
  .portrait { width: 200px; }
  .footer-grid { grid-template-columns: 1fr; }
  .faq-body { padding-right: 0; }
  .flow { --node: 40px; }
  .flow-step { gap: 16px; }
  .flow-body h3 { font-size: 24px; margin-top: 4px; }
  .flow-step:not(:last-child) .flow-body { padding-bottom: 44px; }
}

/* Touch: 44px minimum hit areas without changing the visual rhythm */
@media (pointer: coarse) {
  .header-cta { --h: 44px; }
  .footer-nav, .footer-contact { gap: 0; }
  .footer-nav a, .footer-contact a { padding-block: 10px; }
  .footer-contact > span { padding-block: 2px; }
  .footer-nav .eyebrow, .footer-contact .eyebrow { margin-bottom: 4px; }
  .legal-links a { padding-block: 12px; }
}

@media (max-width: 374px) {
  .brand-word { display: none; }
}

/* ---------- Reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero-in { animation-name: fade; }
  .js .hero-image, .js .hero-image img { animation: none; }
  .js .reveal { transform: none; transition: opacity 400ms ease; }
  .tabpanel[data-entering], .field[data-invalid] .field-error, .form-result:not([hidden]) { animation-name: fade; }
  .tablist-active { transition-duration: 0ms; }
  .btn:active, .check:active .check-box { transform: none; }
  .mobile-menu, .mobile-menu[data-open] { transform: none; }
  .toast, .toast[data-removed] { transform: none; }
  .service-card { transition: border-color 200ms ease; }
  @media (hover: hover) and (pointer: fine) { .service-card:hover { transform: none; } }
}
@keyframes fade { from { opacity: 0; } }
