/* ==========================================================================
   Sambhav Jain — site stylesheet
   Editorial system matching the 2026–27 rate card: paper, ink, one red.
   Phone-first. Animations touch only transform/opacity. No backdrop blur.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #F2EDE4;
  --paper-2: #E9E3D7;
  --card: #F7F3EC;
  --ink: #1C1B19;
  --ink-2: #3F3B35;
  --muted: #6E685E;
  --rule: #D6CFC2;
  --rule-strong: #1C1B19;
  --accent: #B3361C;
  --accent-soft: rgba(179, 54, 28, 0.1);
  --hl: #EFE0A6;
  --wa: #1B7F46;
  --wa-ink: #FFFFFF;
  --btn: #1C1B19;
  --btn-ink: #F7F3EC;
  --contact-bg: #1B1B1D;
  --contact-ink: #EFE9DD;
  --contact-muted: #A09A90;
  --contact-rule: #34332F;
  --gold: #D6C08A;
  --backdrop: rgba(24, 22, 18, 0.52);
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 8px 24px rgba(28, 27, 25, 0.08);
  --shadow-lg: 0 24px 64px rgba(28, 27, 25, 0.22);
  --art-bg: #EAE3D5;

  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --gutter: clamp(16px, 4.5vw, 40px);
  --max: 1120px;
  --radius: 10px;
  --header-h: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #141413;
  --paper-2: #1C1B19;
  --card: #1B1A18;
  --ink: #EEE8DC;
  --ink-2: #D2CBBE;
  --muted: #9F988C;
  --rule: #34312C;
  --rule-strong: #EEE8DC;
  --accent: #E8704F;
  --accent-soft: rgba(232, 112, 79, 0.12);
  --hl: rgba(214, 192, 138, 0.25);
  --wa: #25A55F;
  --btn: #EEE8DC;
  --btn-ink: #141413;
  --contact-bg: #0D0D0C;
  --contact-rule: #2A2926;
  --backdrop: rgba(0, 0, 0, 0.66);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --art-bg: #1F1E1B;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom);
}
img, svg { display: block; max-width: 100%; }
svg { width: 1em; height: 1em; flex: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
em { font-style: italic; }
small { font-size: 0.78em; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--hl); color: var(--ink); }

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--btn); color: var(--btn-ink); padding: 10px 14px; border-radius: 6px;
  text-decoration: none; font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* View switching (Business / Technical) */
html:not([data-mode="technical"]) .only-tech { display: none !important; }
html[data-mode="technical"] .only-client { display: none !important; }

/* Theme-dependent visibility */
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: block; }
:root[data-theme="dark"] .show-light { display: none; }

.mono-muted, .rule-label, .eyebrow, .service-kicker, .section-num, .tag, .price small, .sheet-kicker {
  font-family: var(--mono);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .2s, border-color .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-secondary { border-color: var(--rule-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--paper); }
.btn-wa { background: var(--wa); color: var(--wa-ink); }
.btn-wa:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--contact-rule); color: var(--contact-ink); }
.btn-ghost:hover { border-color: var(--contact-ink); }
.btn-sm { min-height: 42px; padding: 0 16px; font-size: 14px; }
.btn-sm svg { width: 17px; height: 17px; }

.text-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-2); font-size: 15px; text-decoration: underline; text-decoration-color: var(--rule);
  text-underline-offset: 4px; min-height: 44px;
}
.text-link svg { width: 17px; height: 17px; }
.text-link:hover { color: var(--accent); text-decoration-color: currentColor; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 999px; border: 1px solid var(--rule); color: var(--ink);
  transition: background-color .2s, border-color .2s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--paper-2); border-color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.wordmark { font-family: var(--serif); font-size: 21px; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; margin-right: auto; }
.wordmark em { color: var(--accent); }
.wordmark-short { display: none; }
.header-nav { display: none; gap: 26px; }
.header-nav a { font-size: 14.5px; color: var(--ink-2); text-decoration: none; padding: 8px 0; position: relative; }
.header-nav a:hover { color: var(--ink); }
.header-nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 1.5px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.header-nav a:hover::after { transform: scaleX(1); }
.header-tools { display: flex; align-items: center; gap: 8px; }

.view-switch {
  display: inline-flex; padding: 3px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card);
}
.view-btn {
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.view-btn[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.view-btn:not([aria-pressed="true"]):hover { color: var(--ink); }

@media (min-width: 900px) {
  .header-nav { display: flex; margin-right: 8px; }
  .wordmark { margin-right: auto; }
}
@media (max-width: 379px) {
  .hero-top .mono-muted { display: none; }
  .wordmark-full { display: none; }
  .wordmark-short { display: inline; font-size: 24px; }
  .view-btn { padding: 0 10px; font-size: 13px; }
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(20px, 5vw, 44px); padding-bottom: clamp(36px, 7vw, 72px); }
.hero-top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-bottom: 12px; border-bottom: 2px solid var(--rule-strong);
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); color: var(--ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wa); box-shadow: 0 0 0 4px color-mix(in srgb, var(--wa) 18%, transparent); }
.mono-muted { color: var(--muted); }

.hero-grid {
  display: grid; gap: 28px; align-items: center;
  grid-template-columns: 1fr;
  padding-top: clamp(28px, 6vw, 64px);
}
.hero-portrait { order: -1; width: clamp(108px, 30vw, 140px); }
.hero-portrait img {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  padding: 5px; background: var(--card); border: 1px solid var(--rule);
}
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow-mark { width: 11px; height: 11px; background: var(--accent); flex: none; }
.hero-name {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.9rem, 12vw, 5.6rem); line-height: 0.98; letter-spacing: -0.025em;
}
.hero-name em { font-weight: 400; }
.hero-lead {
  margin-top: 22px; max-width: 34ch;
  font-family: var(--serif); font-size: clamp(1.2rem, 4.4vw, 1.6rem); line-height: 1.42; color: var(--ink-2);
}
.hero-lead em { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.hero-sub-actions { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 8px; }

@media (max-width: 479px) {
  .hero-actions .btn { flex: 1 1 100%; }
}
@media (min-width: 760px) {
  .hero-grid { grid-template-columns: 1fr auto; gap: 48px; }
  .hero-portrait { order: 0; width: clamp(200px, 24vw, 280px); }
  .hero-portrait img { padding: 8px; }
}

.fact-row {
  display: grid; grid-template-columns: 1fr; margin-top: clamp(36px, 6vw, 56px);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.fact-row > div { padding: 14px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.fact-row > div:last-child { border-bottom: 0; }
.fact-row dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fact-row dd { margin-top: 3px; font-size: 15.5px; overflow-wrap: anywhere; }
.fact-row a { text-decoration-color: var(--rule); text-underline-offset: 3px; }
@media (min-width: 640px) {
  .fact-row { grid-template-columns: repeat(3, 1fr); }
  .fact-row > div { border-bottom: 0; padding: 16px 20px; border-left: 1px solid var(--rule); }
  .fact-row > div:first-child { border-left: 0; padding-left: 0; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(44px, 8vw, 96px); }
.section-head {
  display: grid; gap: 6px; margin-bottom: clamp(26px, 4vw, 40px);
  grid-template-columns: 1fr;
}
.section-num { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: clamp(2.4rem, 8vw, 4.2rem); line-height: 1; }
.section-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.05; letter-spacing: -0.02em; }
.section-lead { margin-top: 14px; max-width: 58ch; color: var(--ink-2); font-size: 16.5px; }
@media (min-width: 760px) {
  .section-head { grid-template-columns: 120px 1fr; gap: 24px; align-items: start; }
  .section-num { padding-top: 2px; }
}

.rule-label {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding-bottom: 10px; margin-bottom: 18px; border-bottom: 2px solid var(--rule-strong);
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
}
.rule-label > span:last-child:not(:first-child) { color: var(--muted); text-align: right; }
.rule-label .accent, .accent { color: var(--accent) !important; }
* + .rule-label { margin-top: clamp(36px, 5vw, 52px); }

/* Stretched-link pattern: whole card clickable, one real button inside */
.stretched { text-align: left; font: inherit; color: inherit; line-height: inherit; }
.stretched::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Services ---------- */
.service-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .service-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }

.service-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s var(--ease);
}
@media (hover: hover) {
  .service-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
  .service-card:hover .more { color: var(--accent); }
  .service-card:hover .more svg { transform: translateX(3px); }
}
.service-art {
  background: var(--art-bg); border-bottom: 1px solid var(--rule);
  height: clamp(180px, 46vw, 230px); padding: 16px 16px 0;
  overflow: hidden;
}
.service-art img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.service-art .art-dark { display: none; }
:root[data-theme="dark"] .service-art .art-light { display: none; }
:root[data-theme="dark"] .service-art .art-dark { display: block; }
.service-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 18px; flex: 1; }
.service-kicker { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.service-title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.35rem, 5vw, 1.6rem); line-height: 1.2; letter-spacing: -0.01em; }
.service-text { color: var(--ink-2); font-size: 15.5px; }
.example-list { display: grid; gap: 2px; margin-top: 2px; }
.example-list li { position: relative; padding-left: 20px; font-size: 14.5px; color: var(--ink-2); }
.example-list li::before { content: ''; position: absolute; left: 0; top: 0.8em; width: 10px; height: 1.5px; background: var(--accent); }
.service-stack { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 10px; border-top: 1px dashed var(--rule); }
.service-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.price { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.price small { color: var(--muted); font-weight: 400; }
.more { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); transition: color .2s; }
.more svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }

.also-list { display: grid; }
.also-list li { border-bottom: 1px solid var(--rule); }
.also-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 0; text-align: left;
}
.also-name { font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.also-price { font-family: var(--mono); font-size: 14px; white-space: nowrap; }
.also-list svg { width: 18px; height: 18px; color: var(--muted); transition: transform .2s var(--ease); }
.also-list button:hover .also-name { color: var(--accent); }
.also-list button:hover svg { transform: translateX(3px); color: var(--ink); }
.leader { flex: 1; min-width: 16px; border-bottom: 1.5px dotted var(--rule); transform: translateY(-4px); }

/* ---------- Work ---------- */
.work-list { display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .work-list { grid-template-columns: 1fr 1fr; column-gap: 40px; } }
.work-item {
  position: relative; display: grid; grid-template-columns: 60px 1fr auto; gap: 16px; align-items: center;
  padding: 18px 0; border-bottom: 1px solid var(--rule);
}
.work-thumb { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; background: #EFE9DD; border: 1px solid var(--rule); }
.work-main { min-width: 0; }
.work-name { font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.25; }
.work-sum { margin-top: 3px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.work-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.work-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s var(--ease), color .2s; }
@media (hover: hover) {
  .work-item:hover .work-name { color: var(--accent); }
  .work-item:hover .work-chev { transform: translateX(3px); color: var(--ink); }
}
@media (min-width: 560px) {
  .work-item { grid-template-columns: 72px 1fr auto; gap: 20px; }
  .work-thumb { width: 72px; height: 72px; border-radius: 16px; }
}

.tag {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 4px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); background: var(--card);
}
.tag-open { border-color: color-mix(in srgb, var(--wa) 45%, var(--rule)); color: var(--wa); }

/* ---------- Engineering notes (technical view) ---------- */
.notes-list { display: grid; }
.note { border-bottom: 1px solid var(--rule); }
.note summary {
  list-style: none; cursor: pointer; display: grid; gap: 4px; padding: 18px 36px 18px 0; position: relative;
}
.note summary::-webkit-details-marker { display: none; }
.note summary::after {
  content: '+'; position: absolute; right: 4px; top: 16px; font-family: var(--mono); font-size: 22px; color: var(--muted);
  transition: transform .2s var(--ease);
}
.note[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.note-proj { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.note-title { font-family: var(--serif); font-size: 19px; line-height: 1.35; }
.note-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 4px; background: var(--paper-2); color: var(--ink-2); }
.note-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 2px 0 22px; }
.note-body > div { min-width: 0; }
.note-body dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.note-body dd { margin-top: 2px; color: var(--ink-2); }
.note-body .result { color: var(--ink); font-weight: 600; }
.tree {
  margin: 6px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--paper-2);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; color: var(--ink);
}
@media (min-width: 760px) {
  .note-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; }
}

.perf-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.perf-cell { padding: 14px 14px 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: grid; gap: 4px; min-width: 0; }
.perf-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.perf-v { font-family: var(--mono); font-size: 20px; color: var(--ink); }
.perf-v.good { color: var(--wa); }
.perf-v.warn { color: var(--accent); }
@media (min-width: 640px) { .perf-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .perf-grid { grid-template-columns: repeat(6, 1fr); } }
.fine-print { margin-top: 12px; font-size: 13.5px; color: var(--muted); max-width: 70ch; }

/* ---------- Pricing ---------- */
.pricing-layout { display: grid; gap: 8px 56px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .pricing-layout { grid-template-columns: 1fr 1fr; } }
.pricing-layout > div > .rule-label:first-child { margin-top: 0; }
@media (max-width: 899px) { .pricing-layout > div + div > .rule-label:first-child { margin-top: 40px; } }

.price-list li { display: flex; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.pl-name { font-family: var(--serif); font-size: 17px; }
.pl-price { font-family: var(--mono); font-size: 14.5px; white-space: nowrap; }
.pl-price small { color: var(--muted); }

.ratecard {
  display: flex; align-items: center; gap: 16px; margin-top: 22px; padding: 16px 18px;
  border: 1.5px solid var(--ink); border-radius: var(--radius); text-decoration: none;
  background: var(--card); transition: background-color .2s, color .2s, transform .15s var(--ease);
}
.ratecard:hover { background: var(--ink); color: var(--paper); }
.ratecard:hover .ratecard-text span { color: inherit; opacity: .8; }
.ratecard:active { transform: scale(0.99); }
.ratecard-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; flex: none; }
.ratecard-icon svg { width: 20px; height: 20px; }
.ratecard-text { display: grid; gap: 2px; }
.ratecard-text strong { font-family: var(--serif); font-weight: 500; font-size: 18px; }
.ratecard-text span { font-size: 13.5px; color: var(--muted); }

.steps { display: grid; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.step-n { font-family: var(--mono); font-size: 12.5px; color: var(--accent); padding-top: 5px; }
.steps h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; }
.steps p { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.terms { display: grid; gap: 10px; margin-top: 22px; padding: 16px 18px; background: var(--paper-2); border-radius: var(--radius); }
.terms li { font-size: 14.5px; color: var(--ink-2); }
.terms strong { display: block; font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }

/* ---------- Contact ---------- */
.contact { background: var(--contact-bg); color: var(--contact-ink); padding-block: clamp(56px, 10vw, 110px); }
.contact-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--contact-muted); }
.contact-title { margin-top: 14px; font-family: var(--serif); font-weight: 400; font-size: clamp(2.1rem, 8vw, 4rem); line-height: 1.08; letter-spacing: -0.02em; }
.contact-title em { color: var(--gold); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
@media (max-width: 479px) {
  .contact-actions .btn-wa { flex: 1 1 100%; }
  .contact-actions .btn-ghost { flex: 1 1 0; }
}
.contact-details { display: grid; gap: 0; margin-top: 36px; max-width: 560px; border-top: 1px solid var(--contact-rule); }
.contact-details > div { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--contact-rule); align-items: baseline; }
.contact-details dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--contact-muted); }
.contact-details dd { font-family: var(--mono); font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.contact-details a { text-decoration: none; }
.contact-details a:hover { color: var(--gold); }
.contact-utils { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.util {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--contact-rule); color: var(--contact-ink);
  font-size: 14px; text-decoration: none; transition: border-color .2s, background-color .2s;
}
.util svg { width: 17px; height: 17px; color: var(--contact-muted); }
.util:hover { border-color: var(--contact-muted); background: rgba(255, 255, 255, 0.04); }

.site-footer { background: var(--contact-bg); color: var(--contact-muted); border-top: 1px solid var(--contact-rule); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding-block: 20px calc(20px + var(--quickbar-space, 0px)); font-size: 13.5px; }
.footer-inner a { color: var(--contact-ink); text-underline-offset: 3px; }

/* ---------- Mobile quick-contact bar ---------- */
.quickbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
  display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 6px; padding: 6px;
  background: var(--btn); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(calc(100% + 24px)); transition: transform .35s var(--ease);
}
.quickbar.is-visible { transform: none; }
.qb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px;
  border-radius: 11px; color: var(--btn-ink); text-decoration: none; font-size: 14px; font-weight: 600;
}
.qb-btn svg { width: 18px; height: 18px; }
.qb-wa { background: var(--wa); color: #fff; }
@media (min-width: 760px) { .quickbar { display: none; } }
@media (max-width: 759px) { :root { --quickbar-space: 76px; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 90;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px;
  background: var(--btn); color: var(--btn-ink); font-size: 14.5px; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
@media (min-width: 760px) { .toast { bottom: 28px; } }

/* ==========================================================================
   Detail sheet (dialog)
   ========================================================================== */
.sheet {
  width: min(780px, calc(100% - 48px)); max-width: none; max-height: min(90dvh, 920px);
  padding: 0; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .32s var(--ease); }
.sheet.is-closing { animation: sheet-out .2s ease-in forwards; }
.sheet::backdrop { background: var(--backdrop); animation: fade-in .3s ease; }
.sheet.is-closing::backdrop { animation: fade-out .2s ease-in forwards; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(0.99); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* Phones: a bottom sheet that uses the whole height */
@media (max-width: 639px) {
  .sheet {
    width: 100%; max-width: 100%; height: calc(100dvh - 28px); max-height: none;
    margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0;
  }
  .sheet[open] { animation: sheet-up .36s var(--ease); }
  .sheet.is-closing { animation: sheet-down .24s ease-in forwards; }
  @keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheet-down { to { transform: translateY(35%); opacity: 0; } }
  .sheet-head::before {
    content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 4px; background: var(--rule);
  }
}

.sheet-head {
  position: relative; flex: none;
  display: flex; align-items: flex-start; gap: 14px; justify-content: space-between;
  padding: 22px var(--sheet-pad, 28px) 16px; border-bottom: 1px solid var(--rule); background: var(--paper);
}
.sheet-heading { min-width: 0; }
.sheet-kicker { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.sheet-title { margin-top: 4px; font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 5.4vw, 2.1rem); line-height: 1.15; letter-spacing: -0.015em; }
.sheet-close { flex: none; width: 44px; height: 44px; margin: -4px -6px 0 0; }

.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 22px var(--sheet-pad, 28px) 32px; outline: none;
  font-size: 16px; color: var(--ink-2);
}
.sheet-body > * + * { margin-top: 16px; }
.sheet-body strong { color: var(--ink); }
.sheet-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--sheet-pad, 28px) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--paper);
}
.sheet-pager { display: flex; align-items: center; gap: 8px; }
.sheet-pager[hidden] { display: none; }
.sheet-pager .icon-btn { width: 44px; height: 44px; }
.sheet-count { font-family: var(--mono); font-size: 12.5px; color: var(--muted); min-width: 52px; text-align: center; }
.sheet-foot .btn { margin-left: auto; }
@media (max-width: 639px) { .sheet { --sheet-pad: 18px; } }

/* Sheet content blocks */
.sheet-lead { font-family: var(--serif); font-size: 18.5px; line-height: 1.5; color: var(--ink); }
.sh {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 30px !important; padding-bottom: 8px; border-bottom: 2px solid var(--rule-strong);
  font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
}
.sh-note { color: var(--muted); font-size: 11.5px; }
.sheet-body p { max-width: 68ch; }
.fine { font-size: 14px; color: var(--muted); }

.dash-list { display: grid; }
.dash-list li { position: relative; padding: 8px 0 8px 22px; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.dash-list li::before { content: ''; position: absolute; left: 0; top: 1.05em; width: 11px; height: 1.5px; background: var(--accent); }
@media (min-width: 640px) {
  .dash-list.cols { grid-template-columns: 1fr 1fr; column-gap: 28px; }
}

.tier-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .tier-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 700px) { .tier-grid-3 { grid-template-columns: repeat(3, 1fr); } }
.tier { padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); min-width: 0; }
.tier-shaded { background: var(--paper-2); }
.tier-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tier-name { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.tier-price { font-family: var(--mono); font-size: 19px; color: var(--ink); background: var(--hl); padding: 0 6px; border-radius: 3px; }
.tier-price small { color: var(--muted); font-size: 11px; }
.tier-for { margin-top: 4px; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 15.5px; }
.tier-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.tier-meta span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--rule); padding: 3px 7px; border-radius: 3px; color: var(--ink-2); }
.tier-plus { font-family: var(--serif); font-style: italic; color: var(--ink-2); padding: 4px 0 6px; border-bottom: 1px solid var(--rule); }
.tier .dash-list li:last-child { border-bottom: 0; }

.offer-list { display: grid; }
.offer-list li { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.offer-list h4 { font-family: var(--serif); font-weight: 500; font-size: 19px; color: var(--ink); }
.offer-list p { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }
.offer-price { text-align: right; font-family: var(--mono); font-size: 17px; color: var(--ink); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.offer-price small { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.offer-price span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
@media (max-width: 479px) {
  .offer-list li { grid-template-columns: 1fr; gap: 6px; }
  .offer-price { flex-direction: row; align-items: baseline; gap: 8px; text-align: left; flex-wrap: wrap; }
  .offer-price span { margin-top: 0; }
  .offer-price span::before { content: '· '; }
}

.note-pair { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 30px !important; padding-top: 16px; border-top: 2px solid var(--rule-strong); }
@media (min-width: 640px) { .note-pair { grid-template-columns: 1fr 1fr; gap: 28px; } }
.note-pair h4 { font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.note-pair p { margin-top: 6px; font-size: 14.5px; }

.flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--paper-2);
}
.flow span { font-family: var(--mono); font-size: 13px; padding: 6px 10px; border: 1px solid var(--rule); background: var(--card); border-radius: 4px; color: var(--ink); }
.flow svg { width: 16px; height: 16px; color: var(--accent); }

.related { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 26px !important; }
.related-k { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.related button { min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; font-size: 14px; background: var(--card); }
.related button:hover { border-color: var(--ink); }
.inline-link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; font: inherit; }
.inline-link:hover { color: var(--accent); }

/* Case study */
.cs-hero { display: flex; align-items: center; gap: 16px; }
.cs-hero img { width: 72px; height: 72px; border-radius: 16px; border: 1px solid var(--rule); object-fit: cover; flex: none; background: #EFE9DD; }
.cs-sub { font-family: var(--serif); font-size: 18px; line-height: 1.35; color: var(--ink); }
.cs-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.plain { padding: 16px 18px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; margin-top: 20px !important; }
.plain h3 { font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.plain p { margin-top: 6px; font-family: var(--serif); font-size: 17.5px; line-height: 1.55; color: var(--ink); }
.pipeline { padding: 14px 16px; border: 1px dashed var(--rule); border-radius: var(--radius); }
.pipeline-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pipeline-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.pipeline-steps span { font-size: 14px; font-weight: 600; color: var(--ink); }
.pipeline-steps svg { width: 15px; height: 15px; color: var(--accent); }
.callout { padding: 16px 18px; border-radius: var(--radius); background: var(--paper-2); }
.callout h4 { font-family: var(--mono); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.callout p { margin-top: 6px; font-size: 15px; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px !important; }
.stack span { font-family: var(--mono); font-size: 12px; padding: 4px 9px; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink-2); }
.cs-links { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px !important; }
.private-note { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.private-note svg { width: 16px; height: 16px; }

/* Demos */
.demo { margin-top: 28px !important; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.demo-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.demo-head h4 { margin-top: 4px; font-family: var(--serif); font-weight: 500; font-size: 20px; color: var(--ink); }
.demo-desc { margin-top: 6px; font-size: 14px; color: var(--muted); }
.demo-sliders { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 560px) { .demo-sliders { grid-template-columns: 1fr 1fr; gap: 20px; } }
.demo-sliders label { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.demo-sliders output { font-family: var(--mono); font-weight: 400; font-size: 13px; color: var(--ink-2); }
.demo-sliders input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.grade-row button {
  display: grid; gap: 1px; justify-items: center; padding: 9px 4px; min-height: 52px;
  border: 1px solid var(--rule); border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--paper);
  transition: border-color .15s, background-color .15s;
}
.grade-row button span { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); }
.grade-row button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.grade-row button[aria-pressed="true"] span { color: inherit; opacity: .75; }
.demo-result { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.demo-result span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.demo-result strong { font-family: var(--serif); font-weight: 500; font-size: 24px; }

.mesh { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 4px; margin-top: 18px; }
.mesh-node { display: grid; justify-items: center; gap: 2px; text-align: center; min-width: 0; }
.mesh-node strong { font-size: 14px; color: var(--ink); }
.mesh-node small { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.mesh-dot {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--rule); background: var(--paper);
  transition: background-color .3s, border-color .3s, box-shadow .3s;
}
.mesh-node.is-holding .mesh-dot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 5px var(--accent-soft); }
.mesh-node.is-done .mesh-dot { border-color: var(--wa); background: color-mix(in srgb, var(--wa) 20%, transparent); }
.mesh-link { position: relative; height: 38px; display: grid; align-items: end; justify-items: center; align-self: start; }
.mesh-link::before { content: ''; position: absolute; left: 4px; right: 4px; top: 18px; border-top: 1.5px dashed var(--rule); }
.mesh-link small { font-family: var(--mono); font-size: 10px; color: var(--muted); transform: translateY(18px); white-space: nowrap; }
.mesh-packet {
  position: absolute; top: 14px; left: 4px; width: 10px; height: 10px; border-radius: 2px; background: var(--accent);
  opacity: 0; transition: left .7s var(--ease), opacity .2s;
}
.mesh-link.is-moving .mesh-packet { opacity: 1; left: calc(100% - 14px); }
.mesh-link.is-arrived .mesh-packet { opacity: 0; }
.mesh-link.is-arrived::before { border-top-style: solid; border-color: var(--accent); }
.mesh-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 30px; }
.mesh-log { display: grid; gap: 4px; margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--paper-2); max-height: 160px; overflow-y: auto; }
.mesh-log li { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.mesh-log li::before { content: '› '; color: var(--accent); }
.demo .fine { margin-top: 10px; font-size: 12.5px; }

/* ==========================================================================
   Command palette (technical view)
   ========================================================================== */
.palette {
  width: min(560px, calc(100% - 24px)); max-width: none; margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette[open] { animation: sheet-in .22s var(--ease); }
.palette::backdrop { background: var(--backdrop); }
.palette-bar { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--rule); }
.palette-bar svg { width: 18px; height: 18px; color: var(--accent); }
.palette-bar input { flex: 1; min-width: 0; height: 54px; border: 0; background: none; color: var(--ink); font-family: var(--mono); font-size: 15px; outline: none; }
.palette-bar kbd { font-family: var(--mono); font-size: 11px; padding: 3px 6px; border: 1px solid var(--rule); border-radius: 4px; color: var(--muted); }
.palette-list { max-height: min(52vh, 420px); overflow-y: auto; padding: 6px; }
.palette-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 7px; cursor: pointer; font-size: 14.5px; }
.palette-list li span:last-child { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.palette-list li[aria-selected="true"] { background: var(--paper-2); }
.palette-list li[aria-selected="true"] span:first-child { color: var(--accent); }
.palette-empty { color: var(--muted); cursor: default !important; }

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

/* Print: the page prints as a clean one-pager */
@media print {
  .site-header, .quickbar, .toast, .contact-utils, .hero-actions, .hero-sub-actions { display: none !important; }
  .contact { background: none; color: #000; }
}
