/* MKO Invent - shared stylesheet.
   Design tokens, base elements, utilities and responsive rules.
   Formerly duplicated inline across all twelve pages. */

/* =========================================================
   MKO Invent — global stylesheet entry point.
   This file is import-only. Consumers link THIS one file.
   ========================================================= */


/* =========================================================
   MKO Invent — Color tokens
   A near-monochrome, architectural palette. Deep navy ink +
   slate (from the brand mark) + warm paper. Product photography
   carries the color; a single disciplined "blueprint" blue is the
   only interactive accent. No gradients on brand surfaces.
   ========================================================= */
:root {
  /* ---- Ink (primary brand navy, from the logo "M") ---- */
  --ink-900: #0E1622;   /* near-black navy */
  --ink-800: #16202E;   /* primary ink / brand */
  --ink-700: #1E2C3E;
  --ink-600: #2B3B50;
  --ink-500: #3C4F68;

  /* ---- Slate (the logo background blue-gray) ---- */
  --slate-700: #4E5C75;
  --slate-600: #677591;
  --slate-500: #7E8DA9;   /* brand slate */
  --slate-400: #9BA8BF;
  --slate-300: #BCC5D6;
  --slate-200: #D8DEE9;
  --slate-100: #EAEEF4;
  --slate-50:  #F4F6FA;

  /* ---- Paper / neutral surfaces (warm-cool gray) ---- */
  --paper:     #F7F7F5;   /* page background, studio-seamless feel */
  --paper-2:   #EFEFEC;
  --white:     #FFFFFF;
  --line-soft: rgba(22,32,46,.08);
  --line:      rgba(22,32,46,.14);
  --line-strong: rgba(22,32,46,.22);

  /* ---- Accent — blueprint blue (use sparingly, solid only) ---- */
  --blueprint-600: #1F4FD4;
  --blueprint-500: #2B5FE0;   /* links, focus, small marks */
  --blueprint-400: #5A85EE;
  --blueprint-tint: rgba(43,95,224,.10);

  /* ---- Material accents (echo the matte-PLA products) ---- */
  --pla-black:  #1A1A1C;
  --pla-orange: #E2622B;
  --pla-blue:   #2C3E63;
  --pla-yellow: #E8B53A;

  /* ---- Semantic ---- */
  --signal-success: #1F8A5B;
  --signal-warning: #C7861B;
  --signal-error:   #C8453B;

  /* =======================================================
     Semantic aliases — reference these in components
     ======================================================= */
  --bg:            var(--paper);
  --surface:       var(--white);
  --surface-sunk:  var(--slate-50);
  --surface-card:  var(--white);
  --surface-invert: var(--ink-800);

  --text-strong:   var(--ink-800);
  --text-body:     var(--ink-600);
  --text-muted:    var(--slate-600);
  --text-faint:    var(--slate-500);
  --text-on-dark:  rgba(255,255,255,.92);
  --text-on-dark-muted: rgba(255,255,255,.62);

  --accent:        var(--blueprint-500);
  --accent-strong: var(--blueprint-600);
  --accent-tint:   var(--blueprint-tint);

  --border:        var(--line);
  --border-soft:   var(--line-soft);
  --border-strong: var(--line-strong);

  --focus-ring:    var(--blueprint-500);

  /* Badge "paper" tone (frosted chip on photos) — flips in dark mode */
  --badge-paper-bg: rgba(255,255,255,.92);
  --badge-paper-fg: var(--ink-800);

  /* Sticky-nav backdrop (flips in dark mode) */
  --nav-bg:        rgba(247,247,245,.82);
}

/* =========================================================
   Dark theme — set [data-theme="dark"] on a root element to apply.
   Overrides only the semantic aliases + neutral surfaces; the base
   ink/slate/blueprint scales and literal --white are left intact.
   ========================================================= */
[data-theme="dark"] {
  --paper:   #0B121C;
  --paper-2: #0E1622;
  --slate-50: #16202E;
  --line-soft:   rgba(255,255,255,.06);
  --line:        rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);

  --bg:            #0B121C;
  --surface:       #141E2B;
  --surface-sunk:  #1B2636;
  --surface-card:  #141E2B;
  --surface-invert: #1E2A3B;

  --text-strong:   #F4F6FA;
  --text-body:     #D2DAE6;
  --text-muted:    #9BA8BF;
  --text-faint:    #7E8DA9;

  --border:        rgba(255,255,255,.12);
  --border-soft:   rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.22);

  --nav-bg:        rgba(11,18,28,.82);

  --badge-paper-bg: rgba(20,30,43,.92);
  --badge-paper-fg: #F4F6FA;
}

/* Device dark mode is applied by the consuming page setting [data-theme="dark"]
   on the root (e.g. from a prefers-color-scheme check) — see the website kit. */


/* =========================================================
   MKO Invent — Typography tokens
   Display: Space Grotesk — technical geometric grotesque that
            echoes the angular "MI" mark.
   Body/UI: Hanken Grotesk — warm, legible humanist sans.
   Mono:    Space Mono — for spec labels, dimensions (mm), SKUs,
            eyebrows. The "engineering" voice of the brand.
   (Original site used the system SF stack; these are the closest
    sophisticated open substitutes — see readme CAVEATS.)
   ========================================================= */

:root {
  /* ---- Families ---- */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ---- Type scale (fluid, 1.25 major-third-ish) ---- */
  --fs-display: clamp(2.8rem, 5.2vw, 4.5rem); /* @kind font */
  --fs-h1: clamp(2.1rem, 3.8vw, 3.2rem); /* @kind font */
  --fs-h2: clamp(1.6rem, 2.6vw, 2.25rem); /* @kind font */
  --fs-h3: clamp(1.25rem, 1.7vw, 1.5rem); /* @kind font */
  --fs-h4: 1.15rem; /* @kind font */
  --fs-lead: clamp(1.05rem, 1.4vw, 1.25rem); /* @kind font */
  --fs-body: 1rem; /* @kind font */
  --fs-sm: 0.9rem; /* @kind font */
  --fs-xs: 0.8rem; /* @kind font */
  --fs-mono-label: 0.74rem; /* @kind font */

  /* ---- Weights ---- */
  --fw-regular: 400; /* @kind font */
  --fw-medium: 500; /* @kind font */
  --fw-semibold: 600; /* @kind font */
  --fw-bold: 700; /* @kind font */
  --fw-black: 800; /* @kind font */

  /* ---- Line heights ---- */
  --lh-tight: 1.04; /* @kind font */
  --lh-snug: 1.18; /* @kind font */
  --lh-body: 1.6; /* @kind font */
  --lh-relaxed: 1.7; /* @kind font */

  /* ---- Letter spacing ---- */
  --ls-display: -0.03em; /* @kind font */
  --ls-heading: -0.02em; /* @kind font */
  --ls-body: -0.005em; /* @kind font */
  --ls-mono: 0.18em; /* @kind font */
}


/* =========================================================
   MKO Invent — Spacing, radii, borders, shadows, motion
   System feel: architectural & precise. Modest corner radii,
   crisp hairline borders, soft low shadows (no heavy blur).
   ========================================================= */
:root {
  /* ---- Spacing scale (4px base) ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 128px;

  /* ---- Section rhythm ---- */
  --section-y: clamp(64px, 9vw, 128px); /* @kind spacing */
  --section-y-tight: clamp(40px, 6vw, 80px); /* @kind spacing */
  --container: 1200px;
  --container-narrow: 820px;
  --gutter: clamp(20px, 4vw, 40px); /* @kind spacing */

  /* ---- Radii (precise, not pill-soft) ---- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ---- Borders ---- */
  --bw: 1px; /* @kind spacing */
  --bw-2: 1.5px; /* @kind spacing */

  /* ---- Shadows — low, soft, architectural ---- */
  --shadow-xs: 0 1px 2px rgba(16,22,34,.05);
  --shadow-sm: 0 2px 8px -2px rgba(16,22,34,.10);
  --shadow-md: 0 12px 28px -14px rgba(16,22,34,.22);
  --shadow-lg: 0 28px 60px -28px rgba(16,22,34,.32);
  --shadow-focus: 0 0 0 3px rgba(43,95,224,.32);

  /* ---- Motion — precise, no bounce ---- */
  --ease-out: cubic-bezier(.22,.61,.36,1); /* @kind other */
  --ease-in-out: cubic-bezier(.65,.05,.36,1); /* @kind other */
  --dur-fast: .18s; /* @kind other */
  --dur: .32s; /* @kind other */
  --dur-slow: .6s; /* @kind other */
}


/* =========================================================
   MKO Invent — base element styles & shared primitives
   Kept lean: resets, type defaults, and a few brand utilities
   (mono eyebrow, hairline rules, blueprint grid). Components
   carry their own styles.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: var(--ls-body); }
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--ink-800); color: #fff; }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-xs);
}

/* ---- Brand utilities ---- */

/* Mono eyebrow — the "engineering label" voice */
.mko-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-label);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.mko-eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: var(--accent);
  display: inline-block;
}

/* Display heading scale */
.mko-display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  color: var(--text-strong);
  margin: 0;
}

.mko-lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 60ch;
}

/* Hairline rule */
.mko-rule { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Blueprint dotted grid — subtle technical background texture */
.mko-grid-bg {
  background-image: radial-gradient(var(--slate-300) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -1px -1px;
}

/* Container */
.mko-container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Mono spec value (dimensions, SKU, price ticks) */
.mko-spec {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* Footer: stack the brand block above the link columns on tablet/phone so the
   three link columns get the full width instead of being squeezed off the right. */
@media (max-width: 720px) {
  .mko-footer-grid { grid-template-columns: 1fr !important; gap: var(--sp-6) !important; }
}
@media (max-width: 460px) {
  .mko-footer-cols { grid-template-columns: repeat(2, 1fr) !important; row-gap: var(--sp-5) !important; }
}


  /* ============================================================
     Automatic dark mode - the site follows the device / OS setting.
     Re-applies the design system's dark palette whenever the OS prefers
     dark, UNLESS the user has explicitly forced light via
     [data-theme="light"]. The manual "Dark mode" toggle sets
     [data-theme="dark"] (handled by the bound styles.css) and still wins
     on a light OS. Values mirror styles.css → [data-theme="dark"].
     ============================================================ */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --paper:   #0B121C;
      --paper-2: #0E1622;
      --slate-50: #16202E;
      --line-soft:   rgba(255,255,255,.06);
      --line:        rgba(255,255,255,.12);
      --line-strong: rgba(255,255,255,.22);

      --bg:            #0B121C;
      --surface:       #141E2B;
      --surface-sunk:  #1B2636;
      --surface-card:  #141E2B;
      --surface-invert: #1E2A3B;

      --text-strong:   #F4F6FA;
      --text-body:     #D2DAE6;
      --text-muted:    #9BA8BF;
      --text-faint:    #7E8DA9;

      --border:        rgba(255,255,255,.12);
      --border-soft:   rgba(255,255,255,.06);
      --border-strong: rgba(255,255,255,.22);

      --nav-bg:        rgba(11,18,28,.82);

      --badge-paper-bg: rgba(20,30,43,.92);
      --badge-paper-fg: #F4F6FA;
    }
  }

  html, body { margin: 0; background: var(--paper); overflow-x: clip; }
  /* Fill the viewport so mobile overscroll / notch / toolbar regions show paper, not a black backdrop */
  html { min-height: 100%; background-color: var(--paper); }
  body { min-height: 100dvh; }

  /* ============================================================
     iOS safe areas - absolutely no black behind the Dynamic Island
     or the home indicator. A SOLID paper bar backs the top safe area
     (the translucent nav alone would let a black system backdrop show
     through), and the solid dark footer fills the bottom safe area
     with content. Both adapt to light/dark. Any region not covered
     falls back to the solid paper page background.
     ============================================================ */
  .mko-nav { position: sticky; top: 0; padding-top: env(safe-area-inset-top, 0px); }
  .mko-nav::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0;
    height: env(safe-area-inset-top, 0px);
    background: var(--paper);
  }
  .mko-nav-inner {
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)) !important;
  }
  body footer { padding-bottom: env(safe-area-inset-bottom, 0px); }
  /* nothing should be able to push the page wider than the viewport on phones */
  #root { overflow-x: clip; }
  /* responsive collapse for the kit's two-col layouts */
  @media (max-width: 920px) {
    .hero-grid, .pdp-grid { grid-template-columns: 1fr !important; }
    .grid-4 { grid-template-columns: repeat(2,1fr) !important; }
    .grid-3 { grid-template-columns: 1fr !important; }
    /* PDP gallery must scroll with the page, not stay pinned over the info column */
    .mko-pdp-gallery { position: static !important; top: auto !important; }
    /* Services: two-up grid instead of a single stacked column */
    .mko-services-grid { grid-template-columns: repeat(2,1fr) !important; gap: 14px !important; }
  }
  /* NFC hero: drop the content below the 3 fixed dot-rows the canvas paints at the
     very top - only where the canvas is in its "narrow" mode (≤760px). */
  @media (max-width: 760px) {
    .nfc-hero { padding-top: calc(var(--section-y) + 84px) !important; }
  }
  /* ---- Tablet & down: nav must not overflow horizontally ---- */
  @media (max-width: 860px) {
    /* Hide the wordmark (keep the logo mark) so the tab row has room */
    .mko-nav-wordmark { display: none !important; }
    .mko-nav-inner { gap: 10px !important; }
    /* Let the tab row scroll horizontally instead of overflowing the page */
    .mko-nav-links {
      margin-left: auto !important;
      overflow-x: auto !important;
      flex-wrap: nowrap !important;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      -ms-overflow-style: none;
      min-width: 0;
    }
    .mko-nav-links::-webkit-scrollbar { display: none; }
    .mko-nav-links a { padding: 8px 10px !important; font-size: .88rem !important; white-space: nowrap; }
    .mko-nav-cart { padding-left: 10px !important; }
  }
  /* ---- Phones ---- */
  @media (max-width: 620px) {
    /* Product grids stay at 2 columns */
    .mko-pgrid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    /* Drop the heavy 3D model window + its hint */
    .hero-model, .hero-model-hint { display: none !important; }
    /* Hide service description on mobile to show the preview image */
    .service-desc { display: none !important; }
  }
  /* Show service description on larger screens */
  @media (min-width: 621px) {
    .service-desc { display: inline !important; }
  }
  @keyframes mkoPageEnter {
    from { opacity: 0; transform: scale(1.02); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes mkoSwipe {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: none; }
  }
  /* ---- Service gallery ---- */
  @keyframes mkoKenBurns {
    from { transform: scale(1.001); }
    to   { transform: scale(1.075); }
  }
  @keyframes mkoGalFade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes mkoGalCaption {
    from { opacity: 0; transform: translateY(14px); filter: blur(3px); }
    to   { opacity: 1; transform: none; filter: none; }
  }
  @keyframes mkoGalProgress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
  @keyframes mkoSpin  { to { transform: rotateZ(360deg); } }
  @keyframes mkoSpinR { to { transform: rotateZ(-360deg); } }
  @keyframes mkoDotsIn {
    from { opacity: 0; transform: translateX(-26px); }
    to   { opacity: 1; transform: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .mko-gear { animation: none !important; }
  }
  @keyframes mkoGalCount {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }
  .mko-gal-strip::-webkit-scrollbar { height: 0; }
  .mko-gal-strip { scrollbar-width: none; }
  @media (prefers-reduced-motion: reduce) {
    .mko-gal-img { animation: none !important; }
  }
