/* ==========================================================================
   Q Star Engineering
   Design tokens, base, components and sections.
   ========================================================================== */

:root {
  /* Colour */
  --ink: #131C4A;          /* instrument navy: text, dark sections */
  --q: #2A3799;            /* Q blue: brand, links, primary buttons */
  --q-hover: #1F2A7D;
  --q-ring: rgba(42, 55, 153, .18);
  --paper: #F5F6F8;        /* bench white */
  --white: #FFFFFF;
  --line: #E2E5EC;
  --line-strong: #C8CDD9;
  --line-dark: rgba(255, 255, 255, .14);
  --steel: #5B6476;        /* secondary text */
  --mist: #AEB5D6;         /* secondary text on navy */
  --amber: #E8A200;        /* needle amber: the one accent */
  --pass: #1F8A57;
  --fail: #B3261E;
  --warn: #8A5A00;

  /* Shape */
  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --pill: 999px;

  /* Layout */
  --max: 1120px;
  --gutter: 24px;
  --nav-h: 56px;
  --section-y: clamp(96px, 12vw, 168px);

  --ease: cubic-bezier(.2, .8, .2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.menu-open { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  font-stretch: 106%;
  letter-spacing: -.025em;
  line-height: 1.08;
  text-wrap: balance;
}

p, dl, dd, ul, ol, figure { margin: 0; }
p { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }

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

.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 {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--ink); color: var(--white);
  padding: 10px 18px; border-radius: var(--pill); text-decoration: none;
  transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }

.container { max-width: var(--max); margin: 0 auto; }
.muted { color: var(--steel); }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 1rem; font-weight: 600; letter-spacing: -.005em;
  padding: 12px 24px;
  border: 0; border-radius: var(--pill);
  background: var(--q); color: var(--white);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: var(--q-hover); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: progress; }

.btn-small { font-size: .8rem; padding: 7px 15px; }
.btn-large { font-size: 1.05rem; padding: 15px 30px; }

.link {
  color: var(--q); font-weight: 500; text-decoration: none;
  display: inline-flex; gap: 6px; align-items: baseline;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link--light { color: var(--white); }
.link--button { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; cursor: pointer; }

/* ---------- Icons ---------- */
.icon {
  width: 40px; height: 40px;
  fill: none; stroke: var(--q); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--muted { width: 20px; height: 20px; stroke: var(--steel); flex: none; }

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.nav-inner {
  max-width: var(--max); height: 100%; margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 28px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 650; font-stretch: 110%; letter-spacing: -.015em;
}
.brand-mark { width: 26px; height: 26px; color: var(--q); }

.nav-links { display: flex; gap: 26px; margin-left: auto; }
.nav-links a {
  font-size: .82rem; text-decoration: none;
  color: var(--ink); opacity: .72;
  transition: opacity .2s var(--ease);
}
.nav-links a:hover, .nav-links a.is-current { opacity: 1; }

.nav-toggle {
  display: none;
  width: 40px; height: 40px; margin-right: -8px;
  background: none; border: 0; cursor: pointer; position: relative;
}
.nav-toggle span {
  position: absolute; left: 11px; width: 18px; height: 1.5px;
  background: var(--ink); border-radius: 2px;
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.nav-toggle span:first-child { top: 16px; }
.nav-toggle span:last-child { top: 23px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 19.5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 19.5px; transform: rotate(-45deg); }

@media (max-width: 900px) {
  /* The nav's backdrop-filter makes it the containing block for this fixed
     panel, so the height is set explicitly rather than with bottom: 0. */
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    flex-direction: column; gap: 0; margin: 0;
    padding: 12px var(--gutter) 40px;
    background: var(--white);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
  }
  .nav-links.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a {
    font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; opacity: 1;
    padding: 14px 0; border-bottom: 1px solid var(--line);
  }
  .nav-cta { margin-left: auto; }
  .nav-toggle { display: block; }
}

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

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: var(--section-y) var(--gutter); }
.section--paper { background: var(--paper); }
.section--dark { background: var(--ink); color: var(--paper); }

.section-head { max-width: 760px; margin-bottom: clamp(44px, 6vw, 72px); }
.section-head h2 { font-size: clamp(2.4rem, 5.6vw, 4.6rem); letter-spacing: -.04em; line-height: 1.02; }
.section-head p {
  margin-top: 18px; max-width: 46ch;
  font-size: clamp(1.1rem, 1.7vw, 1.4rem); line-height: 1.4; letter-spacing: -.01em;
  color: var(--steel);
}
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head--center p { margin-left: auto; margin-right: auto; }

.section--dark .section-head p,
.section--dark .lead { color: var(--mist); }

.lead {
  font-size: clamp(1.15rem, 1.8vw, 1.45rem); line-height: 1.4; letter-spacing: -.01em;
  color: var(--steel); max-width: 40ch;
}

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-h) + clamp(56px, 9vw, 112px)) var(--gutter) clamp(72px, 9vw, 120px);
  text-align: center;
  overflow: hidden;
}
.hero-title {
  font-size: clamp(3.1rem, 9vw, 7.4rem);
  font-weight: 740; font-stretch: 112%;
  letter-spacing: -.05em; line-height: .96;
}
.hero-sub {
  margin: 26px auto 0; max-width: 34ch;
  font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.35; letter-spacing: -.012em;
  color: var(--steel);
}
.hero-actions {
  margin-top: 34px;
  display: flex; flex-wrap: wrap; gap: 14px 28px;
  justify-content: center; align-items: center;
}

.gauge-wrap { width: min(500px, 84vw); margin: clamp(56px, 8vw, 96px) auto 0; }
.gauge {
  width: 100%; height: auto;
  filter: drop-shadow(0 44px 60px rgba(19, 28, 74, .16)) drop-shadow(0 10px 18px rgba(19, 28, 74, .10));
}
.g-ticks line { stroke: var(--ink); stroke-linecap: round; }
.g-ticks .t-major { stroke-width: 3; }
.g-ticks .t-mid { stroke-width: 1.6; }
.g-ticks .t-minor { stroke-width: 1; stroke: #7C849A; }
.g-num {
  font-family: inherit; font-size: 19px; font-weight: 600;
  fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums;
}
.g-brand { font-size: 15px; font-weight: 700; font-stretch: 115%; fill: var(--q); text-anchor: middle; letter-spacing: .02em; }
.g-unit { font-size: 16px; font-weight: 500; fill: var(--steel); text-anchor: middle; }

.readout {
  margin-top: 30px;
  display: flex; justify-content: center; align-items: baseline; gap: 10px;
  color: var(--steel); font-size: .95rem;
}
.readout strong {
  min-width: 4.4ch; text-align: right;
  font-size: 2.1rem; font-weight: 600; letter-spacing: -.02em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}

/* ---------- Statement ---------- */
.statement-text {
  max-width: 17ch;
  font-size: clamp(2.3rem, 6.6vw, 5.2rem);
  font-weight: 650; font-stretch: 104%;
  line-height: 1.12; letter-spacing: -.035em;
}
.facts {
  margin-top: clamp(56px, 8vw, 96px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
}
.facts > div { border-top: 1px solid var(--line-strong); padding-top: 20px; }
.facts h3 { font-size: 1.15rem; margin-bottom: 8px; }
.facts p { color: var(--steel); max-width: 32ch; }

/* ---------- Calibration bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(250px, auto);
  gap: 16px;
}
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 28px;
  padding: 32px;
  background: var(--paper);
  border-radius: var(--r-lg);
}
.tile-text { margin-top: 0; }
.tile--feature .tile-text { margin-top: auto; }
.tile h3 { font-size: 1.55rem; letter-spacing: -.03em; margin-bottom: 8px; }
.tile p { color: var(--steel); max-width: 36ch; }

.tile--feature { grid-column: span 2; grid-row: span 2; border-radius: var(--r-xl); padding: 40px; }
.tile--wide { grid-column: span 2; }

.tile--dark { background: var(--ink); color: var(--white); }
.tile--dark p { color: var(--mist); }
.tile--dark h3 { font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -.04em; }

.tile--blue { background: var(--q); color: var(--white); }
.tile--blue p { color: rgba(255, 255, 255, .8); margin-bottom: 16px; }
.tile--blue h3 { font-size: 1.9rem; }

.mini-dial { width: min(100%, 420px); margin: 12px auto 0; }
.mini-dial .m-major { stroke: var(--white); stroke-width: 2.4; stroke-linecap: round; }
.mini-dial .m-minor { stroke: rgba(255, 255, 255, .42); stroke-width: 1.2; stroke-linecap: round; }

@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, 1fr); grid-auto-rows: minmax(220px, auto); }
  .tile--feature { grid-row: span 1; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
  .tile--feature, .tile--wide { grid-column: span 1; }
  .tile, .tile--feature { padding: 28px; }
}

/* ---------- Valves ---------- */
.valves-grid {
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: clamp(40px, 7vw, 96px); align-items: center;
}
.valves-copy h2 { font-size: clamp(2.4rem, 5.2vw, 4.3rem); letter-spacing: -.04em; line-height: 1.02; margin-bottom: 24px; }
.specs { margin-top: 48px; }
.specs > div { padding: 22px 0; border-top: 1px solid var(--line-dark); }
.specs dt { font-size: 1.15rem; font-weight: 650; color: var(--white); }
.specs dd { margin-top: 6px; color: var(--mist); max-width: 50ch; }

.valve-art svg { width: 100%; max-width: 540px; height: auto; margin: 0 auto; overflow: visible; }
.v-line rect, .v-line path, .v-line circle {
  fill: rgba(255, 255, 255, .025);
  stroke: #C9CEE6; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round;
}
.v-line path { fill: none; }
.v-spring { fill: none; stroke: var(--amber); stroke-width: 2.2; stroke-linejoin: round; }
.v-callout path { stroke: var(--mist); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.v-callout text { fill: var(--mist); font-size: 12px; font-family: inherit; }

@media (max-width: 900px) {
  .valves-grid { grid-template-columns: 1fr; }
  .valve-art { order: -1; max-width: 360px; margin: 0 auto; }
}

/* ---------- Turnaround story ---------- */
.story {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(48px, 8vw, 112px); align-items: center;
}
.story-copy h2 { font-size: clamp(2.4rem, 5.2vw, 4.3rem); letter-spacing: -.04em; line-height: 1.02; margin-bottom: 24px; }
.story-copy .muted { margin: 20px 0 32px; max-width: 46ch; }

.story-steps {
  position: relative;
  display: grid; grid-template-columns: 26px 1fr; gap: 28px;
}
.vscale {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, var(--line-strong) 0 2px, transparent 2px 48px) left top / 22px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 8px) left top / 12px 100% no-repeat;
}
.vneedle {
  position: absolute; top: -1px; left: -4px;
  width: 36px; height: 2px; border-radius: 2px;
  background: var(--amber);
  opacity: 0;
}
.vneedle::before {
  content: ""; position: absolute; left: -5px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--amber);
}

.steps { display: grid; gap: 40px; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 8px; transition: opacity .45s var(--ease); }
.step-no {
  font-size: 1rem; font-weight: 700; color: var(--q);
  font-variant-numeric: tabular-nums; padding-top: .35em;
}
.step h3 { font-size: 1.55rem; letter-spacing: -.03em; margin-bottom: 6px; }
.step p { color: var(--steel); max-width: 40ch; }

/* Scroll-driven state, only added by JS on wide screens */
.turnaround.is-pinned {
  min-height: 100vh;
  display: flex; align-items: center;
  padding-top: calc(var(--nav-h) + 32px); padding-bottom: 32px;
}
.turnaround.is-pinned .story { width: 100%; }
.is-story .vneedle { opacity: 1; }
.is-story .step { opacity: .26; }
.is-story .step.is-active { opacity: 1; }

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

/* ---------- Quality ---------- */
.quality-grid {
  margin-top: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
}
.quality-grid > div { border-top: 1px solid var(--line-strong); padding-top: 20px; }
.quality-grid p { margin-top: 0; }
.quality-grid h3 { font-size: 1.15rem; margin-bottom: 8px; }
.quality-grid p { color: var(--steel); max-width: 34ch; }
.quality-grid .link { display: inline; }

@media (max-width: 800px) {
  .facts, .quality-grid { grid-template-columns: 1fr; gap: 28px; }
}
/* ---------- Industries ---------- */
.industries {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 48px 40px;
}
.industries li { border-top: 1px solid var(--ink); padding-top: 20px; }
.industries h3 { font-size: 1.35rem; letter-spacing: -.025em; margin-bottom: 8px; }
.industries p { color: var(--steel); max-width: 34ch; }

@media (max-width: 900px) { .industries { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .industries { grid-template-columns: 1fr; gap: 32px; } }

/* ---------- Offices ---------- */
.cities { display: grid; grid-template-columns: repeat(5, 1fr); gap: 32px; }
.cities li { border-top: 1px solid var(--line-dark); padding-top: 20px; }
.cities h3 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.035em; color: var(--white); margin-bottom: 8px; }
.cities p { color: var(--mist); font-size: .95rem; max-width: 22ch; }

@media (max-width: 960px) { .cities { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .cities { grid-template-columns: 1fr 1fr; } }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid; grid-template-columns: .8fr 1.2fr;
  gap: clamp(48px, 8vw, 112px); align-items: start;
}
.contact-copy h2 { font-size: clamp(2.4rem, 5.2vw, 4.3rem); letter-spacing: -.04em; line-height: 1.02; margin-bottom: 24px; }
.contact-list { margin-top: 40px; }
.contact-list > div { padding: 16px 0; border-top: 1px solid var(--line); }
.contact-list dt { font-size: .82rem; color: var(--steel); }
.contact-list dd a { font-size: 1.25rem; font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.contact-list dd a:hover { color: var(--q); }

.quote {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px;
  padding: clamp(24px, 4vw, 40px);
  background: var(--paper); border-radius: var(--r-xl);
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field--full { grid-column: 1 / -1; }
.field label, .field legend, .label-text { font-size: .85rem; font-weight: 600; padding: 0; }
.field legend { margin-bottom: 7px; }

.field input:not([type="radio"]):not([type="file"]),
.field select,
.field textarea {
  width: 100%;
  font: inherit; font-size: 1rem; color: var(--ink);
  padding: 13px 16px;
  background: var(--white);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.field textarea { resize: vertical; min-height: 110px; }
.field select {
  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.5 6 6.5l5-5' fill='none' stroke='%235B6476' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--q); box-shadow: 0 0 0 4px var(--q-ring);
}
.field.is-invalid input:not([type="radio"]):not([type="file"]),
.field.is-invalid select { border-color: var(--fail); }
.error { min-height: 0; font-size: .82rem; color: var(--fail); }
.error:empty { display: none; }

.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; align-self: flex-start;
  padding: 4px;
  background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--pill);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  padding: 8px 16px; border-radius: var(--pill);
  font-size: .9rem; font-weight: 500; cursor: pointer; color: var(--steel);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.segmented input:checked + label { background: var(--ink); color: var(--white); }
.segmented input:focus-visible + label { outline: 3px solid var(--amber); outline-offset: 2px; }

.form-actions { flex-direction: row; align-items: center; gap: 16px; margin-top: 6px; }
.form-status { font-size: .9rem; color: var(--fail); }

.form-note {
  grid-column: 1 / -1;
  font-size: .85rem; color: var(--steel); max-width: 52ch; margin-top: -4px;
}
.form-note a { color: var(--q); }

.quote-success {
  padding: clamp(40px, 6vw, 64px);
  background: var(--paper); border-radius: var(--r-xl);
  text-align: center;
}
.quote-success:focus { outline: none; }
.success-mark { width: 56px; height: 56px; margin: 0 auto 20px; }
.success-mark circle { fill: none; stroke: var(--pass); stroke-width: 2; }
.success-mark path { fill: none; stroke: var(--pass); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.quote-success h3 { font-size: 1.8rem; letter-spacing: -.03em; margin-bottom: 10px; }
.quote-success p { color: var(--steel); max-width: 40ch; margin: 0 auto 20px; }

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .quote { grid-template-columns: 1fr; }
  .segmented { display: grid; grid-template-columns: repeat(3, 1fr); align-self: stretch; }
  .segmented label { padding: 8px 6px; text-align: center; font-size: .85rem; }
  .form-actions { flex-direction: column; align-items: stretch; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--paper);
  padding: 56px var(--gutter) 36px;
  font-size: .82rem; color: var(--steel);
}
.footer-cols {
  display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 32px;
  padding-bottom: 32px; border-bottom: 1px solid var(--line);
}
.footer h4 { font-size: .82rem; font-weight: 650; color: var(--ink); letter-spacing: 0; margin-bottom: 12px; font-stretch: 100%; }
.footer li { margin-bottom: 8px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 20px; }

@media (max-width: 600px) {
  .footer-cols { grid-template-columns: 1fr 1fr; }
}

/* ---------- WhatsApp button (shown only when configured in script.js) ---------- */
.wa {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--pill);
  background: var(--ink); color: var(--white); text-decoration: none;
  font-size: .9rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(19, 28, 74, .25);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
