/* ============================================================================
 EcuTunerx — shared site stylesheet.

 The design system every page is built from: tokens, reset, type scale,
 buttons, masthead, section shell, price cards, footer and the Swiss folio
 numerals. Extracted from index.html so order.html and track.html inherit the
 same look from ONE file — a colour or a font changes here and changes
 everywhere, rather than drifting across three copies.

 Page-specific styles stay inline in the page that needs them.
 ========================================================================= */

/* ================================================================
   VARIANT 03 · EDITORIAL / MAGAZINE
   Cream paper, ink type, burgundy accent, thin rules.
   Road & Track meets Monocle. Fraunces display + Inter body.
   ================================================================ */
:root {
  --paper: #F7F3EC;
  --paper-2: #F1EBE0;
  --paper-hi: #FBF8F2;
  --paper-white: #FFFDF8;
  --ink: #1B1712;
  --ink-soft: #5C5346;
  --ink-faint: #8A7F6E;
  --burgundy: #7A1F2B;
  --burgundy-deep: #5E1620;
  --rule: #C9BFAF;
  --rule-soft: #DDD5C7;
  --navy: #274E68;
  --green: #2F6B44;
  --danger: #A8332F;

  /* dark "photographic plate" used for app-window figures */
  --plate: #191411;
  --plate-2: #221B16;
  --plate-line: rgba(243, 237, 226, 0.16);
  --plate-text: #F3EDE2;
  --plate-mut: #B9AE9C;
  --ok: #6FBF8B;      /* on-plate healthy */
  --warn: #E0A33A;    /* on-plate needs-attention */

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1160px;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
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: hidden;
}
/* paper grain */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.16;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  mix-blend-mode: multiply;
}
/* burgundy press bar at the very top of the page */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 4px;
  background: var(--burgundy); z-index: 200;
}

a { color: inherit; text-decoration: none; }
img, svg, iframe { max-width: 100%; }
svg { display: block; }
::selection { background: rgba(122, 31, 43, 0.22); }
:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 3px; }

/* ============================== RESPONSIVE + PERFORMANCE (look-preserving) ============================== */
/* Keep our exact type scale on phones — stop iOS/Android auto-inflating text in landscape. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Positioning context so the grain can paint once (below) instead of every scroll frame. */
body { position: relative; }
/* Uniform noise looks identical fixed vs absolute, but absolute paints ONCE — removing the
   per-frame recomposite of a fixed + blend-mode layer that janks scrolling on real phones. */
body::after { position: absolute; }
/* Snappier taps: no 300ms delay, softer iOS tap flash. */
a, button, summary, label, input, select, .btn { touch-action: manipulation; -webkit-tap-highlight-color: rgba(122, 31, 43, 0.16); }

/* Touch devices only — comfortable 44px targets + cheaper header; desktop is untouched. */
@media (pointer: coarse), (max-width: 900px) {
  header.nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .nav-links a { min-height: 44px; display: inline-flex; align-items: center; }
  .foot-col a { min-height: 44px; display: inline-flex; align-items: center; }
  .brand { min-height: 44px; }
  .faq summary { min-height: 48px; }
  .checker-foot a, .footer a { -webkit-tap-highlight-color: rgba(122, 31, 43, 0.16); }
}

.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; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
section[id] { scroll-margin-top: 84px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.08; letter-spacing: -0.015em; margin: 0; }

/* ============================== TYPE SYSTEM ============================== */
.kicker {
  display: flex; align-items: baseline; gap: 0.75rem; margin: 0;
  font-family: var(--sans); font-weight: 600; font-size: 0.72rem;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--burgundy);
}
.sect-title { font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.03; margin-top: 0.9rem; max-width: 22ch; }
.lead { font-size: 1.05rem; line-height: 1.65; color: var(--ink-soft); max-width: 64ch; margin: 1rem 0 0; }
.accent-text { font-style: italic; font-weight: 500; color: var(--burgundy); }

/* ============================== BUTTONS ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 0.92rem; letter-spacing: 0.02em;
  padding: 0.75rem 1.4rem; min-height: 44px; border: 1px solid var(--ink); border-radius: 2px;
  cursor: pointer; white-space: nowrap; background: transparent; color: var(--ink);
  transition: transform 0.25s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--burgundy); border-color: var(--burgundy); color: var(--paper); }
.btn-primary:hover { background: var(--burgundy-deep); border-color: var(--burgundy-deep); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.82rem; }
.btn svg { flex: none; }

kbd {
  font-family: var(--mono); font-size: 0.7rem; color: var(--plate-text);
  background: rgba(243, 237, 226, 0.08); border: 1px solid rgba(243, 237, 226, 0.35);
  border-bottom-width: 2px; border-radius: 3px; padding: 0.14rem 0.42rem; display: inline-block;
}

/* ============================== MASTHEAD / NAV ============================== */
header#nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
header#nav.scrolled { box-shadow: 0 12px 28px -20px rgba(27, 23, 18, 0.45); border-bottom-color: var(--ink); }
.mast-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.55rem; font-family: var(--serif); font-weight: 700; font-size: 1.22rem; letter-spacing: -0.01em; }
.brand .logo { width: 28px; height: 28px; flex: none; border-radius: 6px; }
.brand b { font-weight: 700; }
.brand .x { color: var(--burgundy); font-style: italic; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0.75rem 0; position: relative; transition: color 0.2s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0.45rem; height: 2px; width: 100%;
  background: var(--burgundy); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.cta {
  font-weight: 600; color: var(--paper); background: var(--burgundy);
  padding: 0.55rem 1.05rem; border: 1px solid var(--burgundy);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-links a.cta::after { content: none; }
.nav-links a.cta:hover { background: var(--burgundy-deep); border-color: var(--burgundy-deep); color: var(--paper); }
/* Hide the link list on narrow screens but always keep the CTA reachable. */
@media (max-width: 900px) { .nav-links a:not(.cta) { display: none; } }

/* ============================== SECTION SHELL ============================== */
.band { padding-block: clamp(2.6rem, 5.5vw, 4.4rem); }
.band.ruled { border-top: 1px solid var(--rule); }
.sect-split { display: grid; gap: clamp(1.6rem, 3vw, 2.6rem); }
@media (min-width: 1024px) { .sect-split { grid-template-columns: 330px minmax(0, 1fr); align-items: start; } }
.sect-split > * { min-width: 0; }

/* reveal on scroll — hiding only applies when JS is active */
.reveal { transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; }


/* ============================== PRICING ============================== */
.tri-grid { display: grid; grid-template-columns: 1fr; gap: 1.4rem; margin-top: 2.2rem; align-items: stretch; }
@media (min-width: 640px) { .tri-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .tri-grid { grid-template-columns: repeat(4, 1fr); } }
/* two-plan layout: never stretch two cards across four tracks */
.tri-grid--duo { max-width: 860px; margin-inline: auto; }
@media (min-width: 1100px) { .tri-grid--duo { grid-template-columns: repeat(2, 1fr); } }
/* Three stages, not four products — let the cards take the full measure. */
@media (min-width: 1100px) { .tri-grid--trio { grid-template-columns: repeat(3, 1fr); } }
.tri-card {
  position: relative; display: flex; flex-direction: column;
  padding: clamp(1.5rem, 2.6vw, 2rem); background: var(--paper-hi); border: 1px solid var(--rule);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.tri-card::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 4px; background: var(--ink); }
.tri-card:hover { transform: translateY(-4px); border-color: var(--ink); box-shadow: 0 22px 40px -30px rgba(27, 23, 18, 0.5); }
.tri-card.master { background: #F6EDE3; border-color: var(--burgundy); }
.tri-card.master::before { background: var(--burgundy); height: 6px; }
.tri-flag { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; min-height: 26px; }
.tri-flag .lbl { font-size: 0.70rem; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); }
.tri-save {
  font-size: 0.70rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--green); padding: 0.3rem 0.55rem; border: 1px solid rgba(47, 107, 68, 0.5); background: rgba(47, 107, 68, 0.07); white-space: nowrap;
}
.tri-card h3 { font-size: 1.45rem; margin-top: 0.9rem; }
.tri-price { display: flex; align-items: baseline; gap: 0.55rem; margin: 0.85rem 0 0.2rem; flex-wrap: wrap; }
.tri-price .amt { font-family: var(--serif); font-weight: 700; font-size: clamp(2.4rem, 4vw, 3.1rem); line-height: 1; color: var(--ink); }
.tri-card.master .tri-price .amt { color: var(--burgundy); }
.tri-price .per { font-size: 0.70rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.tri-sub { color: var(--ink-soft); font-size: 0.93rem; margin: 0.4rem 0 1.2rem; }
.tri-list { list-style: none; margin: 0 0 1.6rem; padding: 0; display: grid; gap: 0.55rem; }
.tri-list li { position: relative; padding-left: 1.35rem; font-size: 0.92rem; line-height: 1.65; color: var(--ink-soft); }
.tri-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--green); font-weight: 700; font-size: 0.85rem; line-height: 1.65; }
.tri-list li b { color: var(--ink); }
.tri-card .btn { width: 100%; margin-top: auto; }
.tri-lic { font-family: var(--mono); font-size: 0.70rem; letter-spacing: 0.02em; line-height: 1.4; color: var(--ink-faint); display: flex; gap: 0.5rem; align-items: center; margin: -0.4rem 0 1.15rem; padding-top: 0.9rem; border-top: 1px dashed var(--rule); }
.tri-lic svg { flex: none; width: 14px; height: 14px; opacity: 0.85; }
.tri-lic b { color: var(--ink-soft); font-weight: 600; }
/* Dealer / Reseller — dark editorial "business" tier */
.tri-card.dealer { background: var(--ink); border-color: var(--ink); }
.tri-card.dealer::before { background: var(--burgundy); height: 6px; }
.tri-card.dealer:hover { border-color: var(--burgundy); box-shadow: 0 22px 44px -28px rgba(27, 23, 18, 0.7); }
.tri-card.dealer h3, .tri-card.dealer .tri-price .amt { color: var(--paper-white); }
.tri-card.dealer .tri-price .per, .tri-card.dealer .tri-flag .lbl { color: rgba(247, 243, 236, 0.62); }
.tri-card.dealer .tri-sub, .tri-card.dealer .tri-list li { color: rgba(247, 243, 236, 0.82); }
.tri-card.dealer .tri-list li b { color: var(--paper-white); }
.tri-card.dealer .tri-list li::before { color: var(--paper-white); }
.tri-card.dealer .tri-lic { color: rgba(247, 243, 236, 0.72); border-top-color: rgba(247, 243, 236, 0.22); }
.tri-card.dealer .tri-lic b { color: rgba(247, 243, 236, 0.92); }
.tri-save.reseller { color: var(--paper-white); border-color: rgba(247, 243, 236, 0.4); background: rgba(247, 243, 236, 0.08); }
.tri-card.dealer .btn { background: var(--paper-white); color: var(--ink); border-color: var(--paper-white); }
.tri-card.dealer .btn:hover { background: #FFFFFF; border-color: #FFFFFF; }
.tri-fine { font-size: 0.85rem; color: var(--ink-soft); margin: 2.2rem auto 0; padding-top: 1.1rem; border-top: 1px solid var(--rule); max-width: 74ch; }
.tri-fine b { color: var(--ink); }


/* ============================== FOOTER ============================== */
footer.site { border-top: 6px double var(--ink); margin-top: clamp(2rem, 4vw, 3rem); padding-block: 3rem 2rem; background: var(--paper-2); }
.foot-top { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 780px) { .foot-top { grid-template-columns: 1.4fr 1fr 1fr; } }
.foot-brand p { color: var(--ink-soft); font-size: 0.92rem; max-width: 36ch; margin: 0.9rem 0 0; }
.foot-col h3 { font-family: var(--sans); font-size: 0.70rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--burgundy); margin: 0 0 1rem; }
.foot-col a { display: block; color: var(--ink); font-size: 0.94rem; padding: 0.4rem 0; transition: color 0.2s; }
.foot-col a:hover { color: var(--burgundy); text-decoration: underline; text-underline-offset: 3px; }
.legal { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.legal p { font-family: var(--serif); font-style: italic; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.6; margin: 0 0 0.7rem; max-width: 90ch; }
.foot-bottom {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  font-size: 0.70rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft);
}

.foot-ver {
  font-family: var(--mono); font-size: 0.70rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: none; color: var(--ink-faint);
  border: 1px solid var(--rule-soft); border-radius: 2px; padding: 0.15rem 0.45rem;
}

/* ============================== FOLIO — big section numerals (from the Swiss study) ============================== */
.folio { display: flex; align-items: baseline; gap: 0.8rem; margin: 0 0 1.1rem; }
.folio .fn {
  font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 0.9;
  letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums;
}
.folio .fl {
  font-family: var(--sans); font-weight: 600; font-size: 0.70rem;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
}
.folio::after { content: ""; flex: 1; height: 1px; background: var(--rule-soft); align-self: center; }
/* wide screens: the numeral moves into the left margin as a sticky chapter marker */
@media (min-width: 1400px) {
  .band > .wrap { display: grid; grid-template-columns: 7rem minmax(0, 1fr); column-gap: 2rem; max-width: calc(var(--maxw) + 9rem); }
  .band > .wrap > * { grid-column: 2; }
  .band > .wrap > .folio {
    grid-column: 1; grid-row: 1 / span 99; align-self: start;
    position: sticky; top: 96px; margin: 0.3rem 0 0;
    flex-direction: column; align-items: flex-end; text-align: right; gap: 0.55rem;
  }
  .folio .fn { font-size: 4.4rem; }
  .folio .fl { white-space: normal; }
  .folio::after { display: none; }
}

/* ============================== REDUCED MOTION ============================== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .log .msg { opacity: 1 !important; transform: none !important; }
}
