/* CalmInfra — one stylesheet, light/dark via prefers-color-scheme. No inline styles (CSP: style-src 'self'). */

:root {
  color-scheme: light dark;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --text: #10201f;
  --muted: #4c605d;
  --border: #dae4e1;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e2f1ee;
  --on-accent: #ffffff;
  --code-bg: #0d1a1b;
  --code-text: #d5e6e2;
  --ok: #34d399;
  --danger: #b42318;
  --shadow: 0 1px 2px rgb(16 32 31 / 0.05), 0 10px 30px rgb(16 32 31 / 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1120px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1413;
    --surface: #101d1c;
    --surface-2: #0d1918;
    --text: #e3eeeb;
    --muted: #9db1ad;
    --border: #213532;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #11332f;
    --on-accent: #052421;
    --code-bg: #071010;
    --danger: #f97066;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.25);
  }
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.25rem, 5.5vw, 3.6rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); letter-spacing: -0.03em; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
@media (max-width: 480px) { .container { padding-inline: 16px; } }

section { padding-block: clamp(56px, 9vw, 104px); }
.section-alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.section-head { max-width: 700px; margin-bottom: clamp(28px, 4vw, 44px); }

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.lead { max-width: 640px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.22rem); }
.muted { color: var(--muted); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -10000px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent); }
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 0.95rem/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 8px 16px; font-size: 0.875rem; }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 66px; }

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
.logo:hover { color: var(--text); }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-bg { fill: var(--accent); }
.logo-wave, .logo-line { fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; }
.logo-line { opacity: 0.65; }

/* Tabs: every section is its own page; the active one carries aria-current="page". */
.tabs { display: flex; align-items: center; gap: 4px; }
.tabs a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tabs a.tab-cta { margin-left: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.tabs a.tab-cta:hover { background: var(--accent-strong); color: var(--on-accent); }
.tabs a.tab-cta[aria-current="page"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

.header-cta { display: none; }

@media (max-width: 860px) {
  .site-header { position: static; }
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 8px; }
  .header-cta { display: inline-flex; }
  .tabs a.tab-cta { display: none; }
  .tabs {
    width: calc(100% + 32px);
    margin-inline: -16px;
    padding: 2px 12px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 7px 10px; font-size: 0.9rem; }
}

[hidden] { display: none !important; }

/* ---------- Hero ---------- */

.hero {
  padding-top: clamp(48px, 8vw, 96px);
  background: radial-gradient(1100px 480px at 85% -10%, var(--accent-soft), transparent 65%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 56px; align-items: center; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; } }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }

.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; color: var(--muted); font-size: 0.9rem; list-style: none; }
.hero-facts li { display: inline-flex; align-items: center; gap: 8px; }
.hero-facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.terminal {
  margin: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 35%, #000);
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: var(--shadow);
}
.terminal-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid rgb(255 255 255 / 0.07); }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgb(255 255 255 / 0.18); }
.terminal-bar p { margin: 0 0 0 8px; color: rgb(255 255 255 / 0.5); font: 500 0.75rem var(--mono); }
.terminal pre { margin: 0; padding: 20px 22px 14px; overflow-x: auto; color: var(--code-text); font: 0.86rem/1.85 var(--mono); }
.terminal .prompt { color: #5eead4; }
.terminal .arrow { color: rgb(213 230 226 / 0.45); }
.terminal .key { color: #93c5fd; }
.terminal .ok { color: var(--ok); }
.terminal figcaption { padding: 0 22px 18px; color: rgb(255 255 255 / 0.45); font-size: 0.78rem; }
@media (max-width: 480px) { .terminal pre { font-size: 0.78rem; padding-inline: 16px; } }

/* ---------- Grids & cards ---------- */

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 920px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.card { padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card h3 { margin-bottom: 0.4em; }
.card p { color: var(--muted); }
.card-title { font-size: 1.25rem; letter-spacing: -0.02em; }

/* ---------- Services ---------- */

.service-block + .service-block { margin-top: 44px; }
.service-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.service-block-head h3 { margin: 0; font-size: 1.3rem; }
.group-tag { padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.service-item h4 { margin-bottom: 8px; font-size: 1.05rem; }
.service-item p { font-size: 0.94rem; }

.callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-top: 24px;
  padding: 28px 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.callout h3 { font-size: 1.3rem; }
.callout p { max-width: 680px; color: var(--muted); }
@media (max-width: 720px) { .callout { grid-template-columns: minmax(0, 1fr); } .callout .btn { justify-self: start; } }

.tags-block { margin-top: 48px; }
.tags-block h3 { margin-bottom: 14px; color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.9rem; font-weight: 500; }

/* ---------- Results ---------- */

.result { display: flex; flex-direction: column; gap: 6px; }
.card .result-context { margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.card .metric { margin: 4px 0 0; color: var(--accent); font-size: clamp(1.9rem, 4vw, 2.5rem); font-weight: 750; line-height: 1.1; letter-spacing: -0.03em; }
.result h3 { margin: 0; }
.footnote { margin-top: 20px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Steps ---------- */

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .steps, .steps-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps, .steps-4 { grid-template-columns: minmax(0, 1fr); } }
.steps li { position: relative; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.steps h3 { font-size: 1.05rem; }
.steps p { color: var(--muted); font-size: 0.94rem; }

.models { margin-top: 28px; }
.models h3 { font-size: 1.05rem; }

/* ---------- About ---------- */

.about-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 48px; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
.about-grid .lead { max-width: none; }

.checklist { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 0.2em; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); }
.checklist li::after { content: ""; position: absolute; left: 7px; top: calc(0.2em + 4px); width: 6px; height: 10px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- Contact & forms ---------- */

.contact-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 48px; align-items: start; }
@media (max-width: 920px) { .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
.next-steps { margin: 24px 0; padding-left: 1.2em; color: var(--muted); }
.next-steps li { margin-bottom: 6px; }
.next-steps strong { color: var(--text); }

.form { position: relative; padding: clamp(20px, 4vw, 32px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-wrap { max-width: 800px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field > span { font-size: 0.9rem; font-weight: 600; }
.optional { color: var(--muted); font-style: normal; font-weight: 400; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237d918d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 15px center;
  background-repeat: no-repeat;
}
textarea { min-height: 140px; resize: vertical; }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 0.82rem; }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.cf-turnstile { min-height: 65px; margin-top: 20px; }
.form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 20px; }
.form-status { margin: 0; font-size: 0.94rem; }
.form-status[data-state="error"] { color: var(--danger); }
.form-status[data-state="pending"] { color: var(--muted); }
.form-note { margin: 14px 0 0; color: var(--muted); font-size: 0.82rem; }

.form-success { padding: 28px 8px; text-align: center; }
.form-success:focus { outline: none; }
.form-success::before {
  content: "";
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%2314a394' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
}
.form-success p { color: var(--muted); }

/* ---------- Engineer band ---------- */

.band-section { padding-top: 0; }

/* ---------- Footer ---------- */

.site-footer { padding-block: 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px; }
.footer-brand p { margin-top: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.copyright { width: 100%; margin: 0; font-size: 0.85rem; }

/* ---------- Simple pages ---------- */

.page-hero { padding-bottom: clamp(24px, 4vw, 40px); }
.prose { max-width: 740px; }
.prose h2 { margin-top: 2em; font-size: 1.35rem; letter-spacing: -0.02em; }
.prose ul { padding-left: 1.25em; }
.prose li { margin-bottom: 6px; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }

.not-found { min-height: 60vh; display: grid; align-content: center; }

/* ---------- About us (home) ---------- */

.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.principle h3 { display: flex; align-items: center; gap: 10px; }
.principle h3::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--accent); }
.principle-main { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats li { padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); }
.stats strong { display: block; color: var(--text); font-size: clamp(1.6rem, 3.4vw, 2.2rem); line-height: 1.15; letter-spacing: -0.03em; }
.stats span { color: var(--muted); font-size: 0.92rem; }
.stats-section { padding-block: clamp(36px, 6vw, 56px); }

.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 32px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); }
.cta-band h2 { margin-bottom: 6px; font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
.cta-band p { color: var(--muted); }
.cta-band .actions { margin: 0; }

.deliverables { margin-top: 28px; }
