/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #050506;
  --bg-2: #09090b;
  --panel: #0e0e11;
  --panel-2: #131317;
  --edge: #1d1d23;
  --line: #2c2c34;
  --ink: #8d8d99;
  --ink-2: #b9b9c3;
  --ink-hi: #f4f4f6;
  /* Accent (gold; the token names are historical). Change these two and everything derived follows (tints via color-mix).
     If you change them, also update the RGB copies at the top of assets/js/animations.js. */
  --magenta: oklch(55.5% 0.1 86);               /* #8d6e21 antique gold — fills, lines, buttons (white text 4.8:1, WCAG AA) */
  --magenta-hi: #cfb53b;                        /* bright gold — text and glints on black (10.3:1) */
  --magenta-dim: color-mix(in oklch, var(--magenta) 16%, transparent);
  --magenta-glow: 0 0 18px color-mix(in oklch, var(--magenta) 70%, transparent);
  --radius: 18px;
  --wrap: 1200px;
  --head: "Archivo", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font: 16px/1.65 var(--head); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { color: var(--ink-hi); font-family: var(--head); font-stretch: 118%; line-height: 1.05; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(32px, 4.6vw, 56px); font-weight: 750; }
h3 { font-size: 20px; font-weight: 700; font-stretch: 110%; }
p { margin: 0 0 1em; }
::selection { background: var(--magenta); color: #fff; }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--magenta); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  --b: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px; border: 1px solid var(--b);
  font: 600 15px/1 var(--head); font-stretch: 110%; letter-spacing: .01em; color: var(--ink-hi);
  cursor: pointer; position: relative; overflow: hidden; isolation: isolate;
  /* calm, slow hover; hero intro animates `transform` with GSAP */
  transition: scale .3s var(--ease), border-color .7s ease, color .7s ease, box-shadow .65s ease, background .7s ease;
}
.btn span[aria-hidden] { transition: transform .8s var(--ease); }
.btn:hover span[aria-hidden] { transform: translateX(3px); }
.btn:active { scale: .97; }
.btn-primary { background: var(--magenta); --b: var(--magenta); color: #fff; box-shadow: 0 0 0 0 color-mix(in oklch, var(--magenta) 0%, transparent); }
.btn-primary:hover { box-shadow: 0 10px 34px -14px color-mix(in oklch, var(--magenta) 45%, transparent); }
/* Laser sweep: a soft, faint glint drifts slowly across on hover; on leave it fades out instead of sweeping back */
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .16) 50%, transparent 80%);
  opacity: 0; transform: translateX(-110%);
  transition: opacity .6s ease, transform 0s linear .6s; /* reset position only after it has faded */
}
.btn-primary:hover::after {
  opacity: 1; transform: translateX(110%);
  transition: opacity .5s ease, transform 1.2s cubic-bezier(.45, 0, .25, 1);
}
.btn-ghost { background: transparent; }
.btn-ghost:hover { --b: var(--magenta); color: var(--magenta-hi); }
.btn-sm { padding: 10px 16px; font-size: 14px; }
.btn-block { width: 100%; }

/* ── Header ─────────────────────────────────────────────────── */
/* Always pinned. The bar itself is a floating, centred capsule (not full width) that tightens a little once you scroll. */
.site-header { position: fixed; inset: 14px 0 auto; z-index: 50; pointer-events: none; }
.site-header .header-inner {
  pointer-events: auto; position: relative;
  width: min(var(--wrap), 100% - 32px); height: 64px; padding: 0 10px 0 22px; /* top of page: same width as the content (.wrap) */
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid color-mix(in oklch, var(--edge) 80%, transparent); border-radius: 999px;
  background: rgba(9, 9, 11, .55); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 10px 40px -20px rgba(0, 0, 0, .9);
  transition: width .6s var(--ease), background .4s, border-color .4s, box-shadow .4s;
}
.site-header.scrolled .header-inner {
  width: min(880px, 100% - 48px); /* after scrolling: compact capsule */
  background: rgba(9, 9, 11, .82); border-color: var(--edge);
  box-shadow: 0 14px 48px -18px rgba(0, 0, 0, .95), 0 0 0 1px color-mix(in oklch, var(--magenta) 12%, transparent);
}
.logo { display: inline-flex; align-items: center; }
/* The logo SVG is used as a mask, so it can take any colour — here white with a magenta laser glint sweeping across on hover */
.logo-mark {
  display: block; height: 42px; aspect-ratio: 797.1 / 308.11; /* = logo.svg viewBox (generated from the DXF by scripts/dxf-to-svg.mjs) */
  background: linear-gradient(100deg, var(--ink-hi) 42%, var(--magenta-hi) 48%, #fff 50%, var(--magenta-hi) 52%, var(--ink-hi) 58%);
  background-size: 320% 100%; background-position: 100% 0;
  -webkit-mask: url("../img/logo.svg") center / contain no-repeat; mask: url("../img/logo.svg") center / contain no-repeat;
  transition: background-position 1.1s var(--ease);
}
.logo:hover .logo-mark, .logo:focus-visible .logo-mark { background-position: 0 0; }
.logo-footer .logo-mark { height: 56px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.menu { display: flex; align-items: center; gap: 18px; }
.menu > ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.menu > ul > li { position: relative; }
.menu > ul > li > a { display: block; padding: 10px 14px; font-size: 15px; font-weight: 500; color: var(--ink-2); border-radius: 999px; transition: color .2s, background .2s; }
.menu > ul > li > a:hover { color: var(--ink-hi); background: var(--panel-2); }
/* Chevron shared by the nav dropdown and the custom select */
.has-sub > a::after, .select-btn::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 9px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-3px) rotate(45deg); transition: transform .35s var(--ease);
}
.has-sub:hover > a::after, .has-sub:focus-within > a::after { transform: translateY(1px) rotate(225deg); }
.has-sub:hover > a, .has-sub:focus-within > a { color: var(--ink-hi); background: var(--panel-2); }

/* Nav dropdown: glass panel floating 10px under the header bar */
.sub {
  position: absolute; top: calc(100% + 20px); left: -10px; width: 340px; list-style: none; margin: 0; padding: 8px;
  background: rgba(11, 11, 14, .97); border: 1px solid var(--edge); border-radius: 20px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .95), 0 0 0 1px color-mix(in oklch, var(--magenta) 10%, transparent);
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98); transform-origin: 20% 0;
  transition: opacity .25s, transform .35s var(--ease), visibility .25s;
}
.sub::before { content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 22px; } /* hover bridge across the gap */
.sub::after { /* thin laser line along the top edge */
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--magenta), transparent); opacity: .8;
}
.has-sub:hover .sub, .has-sub:focus-within .sub { opacity: 1; visibility: visible; transform: none; }
.sub li { opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .35s var(--ease); }
.has-sub:hover .sub li, .has-sub:focus-within .sub li { opacity: 1; transform: none; }
.sub li:nth-child(2) { transition-delay: .03s; } .sub li:nth-child(3) { transition-delay: .06s; }
.sub li:nth-child(4) { transition-delay: .09s; } .sub li:nth-child(5) { transition-delay: .12s; }
.sub a {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 13px;
  color: var(--ink-2); transition: background .2s, color .2s;
}
.sub a::before { /* magenta marker that grows in on hover */
  content: ""; position: absolute; left: 0; top: 50%; width: 2px; height: 0; border-radius: 2px; translate: 0 -50%;
  background: var(--magenta-hi); box-shadow: var(--magenta-glow); transition: height .3s var(--ease);
}
.sub a:hover, .sub a:focus-visible { background: var(--panel-2); color: var(--ink-hi); }
.sub a:hover::before, .sub a:focus-visible::before { height: 60%; }
.sub-num { flex: none; font: 11px/1 var(--mono); color: var(--ink); width: 18px; transition: color .2s; }
.sub a:hover .sub-num { color: var(--magenta-hi); }
.sub-text { display: grid; gap: 3px; }
.sub-text b { font-size: 14.5px; font-weight: 600; font-stretch: 108%; }
.sub-text small { font-size: 12.5px; color: var(--ink); }

.menu-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: none; cursor: pointer; position: relative; }
.menu-toggle span { position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--ink-hi); transition: transform .3s var(--ease), top .3s; }
.menu-toggle span:first-child { top: 17px; }
.menu-toggle span:last-child { top: 25px; }
.menu-toggle[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }

/* ── Hero ───────────────────────────────────────────────────── */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; padding: 110px 0 60px; overflow: hidden; }
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--edge) 1px, transparent 1px), linear-gradient(90deg, var(--edge) 1px, transparent 1px);
  background-size: 64px 64px; background-position: center;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 50%, #000 20%, transparent 75%);
  opacity: .55;
}
/* minmax(0, …): content (the SVG illustrations) must never be able to push the columns wider than the screen (WebKit/iOS) */
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 13px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink); margin-bottom: 26px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--magenta); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--magenta); animation: ping 2s var(--ease) infinite; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.hero h1 { font-size: clamp(44px, 6.6vw, 92px); font-weight: 800; font-stretch: 122%; letter-spacing: -.025em; margin-bottom: 26px; }
.lead { font-size: clamp(17px, 1.4vw, 19px); color: var(--ink-2); max-width: 520px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 44px; }
.hero-facts { display: grid; grid-template-columns: repeat(3, auto); gap: 28px; margin: 0; border-top: 1px solid var(--edge); padding-top: 22px; max-width: 560px; }
.hero-facts dt { font: 700 22px/1.1 var(--head); font-stretch: 115%; color: var(--ink-hi); }
.hero-facts dd { margin: 4px 0 0; font: 12px/1.4 var(--mono); color: var(--ink); }
.hero-visual { position: relative; }
/* Both machine illustrations share one slot and take turns (cross-faded by main.js) */
.hero-stack { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); width: 104%; margin-left: -2%; }
.hero-stack > * { grid-area: 1 / 1; width: 100%; min-width: 0; --accent: var(--magenta); --accent-hi: var(--magenta-hi); --bg: #050506; position: relative; }
.hero-stack > [inert] { opacity: 0; visibility: hidden; }
.hero-glow { position: absolute; inset: 10% 5%; background: radial-gradient(ellipse at 50% 55%, var(--magenta-dim), transparent 65%); filter: blur(10px); }
/* laser scan across the hero on load (animated by GSAP) */
.scan { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--magenta), transparent); box-shadow: 0 0 24px 4px color-mix(in oklch, var(--magenta) 50%, transparent); opacity: 0; pointer-events: none; }

/* Scroll progress: a thin laser line along the top edge (scaled by GSAP) */
.progress { position: fixed; z-index: 60; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--magenta), var(--magenta-hi)); box-shadow: 0 0 12px var(--magenta); transform-origin: left; transform: scaleX(0); pointer-events: none; }

/* Until GSAP starts, animated elements stay hidden (no flash); the inline script removes .js if GSAP fails */
.js [data-hero], .js [data-reveal] { visibility: hidden; }

/* ── Sections ───────────────────────────────────────────────── */
.section { position: relative; padding: clamp(80px, 11vw, 150px) 0; }
.section + .section::before {
  content: ""; position: absolute; top: 0; left: 50%; width: min(var(--wrap), 100% - 32px); height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--edge) 15%, var(--edge) 85%, transparent);
}
.sec-head { margin-bottom: clamp(36px, 5vw, 64px); max-width: 760px; }
.sec-head-row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.sec-num { display: inline-flex; align-items: center; gap: 10px; font: 13px/1 var(--mono); letter-spacing: .14em; color: var(--magenta-hi); margin-bottom: 18px; }
.sec-num::after { content: ""; width: 48px; height: 1px; background: var(--magenta); box-shadow: var(--magenta-glow); transform-origin: left; transform: scaleX(var(--ln, 1)); }
.sec-sub { margin-top: 18px; font-size: 18px; color: var(--ink); max-width: 560px; }

/* ── About ──────────────────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
.about-text .sec-head { margin-bottom: 32px; }

/* Workshop video reel */
.reel { justify-self: center; width: min(400px, 100%); }
.reel-frame {
  position: relative; aspect-ratio: 9 / 16; max-height: 700px; margin-inline: auto; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--edge); background: var(--panel); box-shadow: 0 40px 80px -40px color-mix(in oklch, var(--magenta) 35%, transparent);
}
.reel-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-frame::before, .reel-frame::after { /* magenta corner brackets */
  content: ""; position: absolute; z-index: 1; width: 28px; height: 28px; pointer-events: none;
  border: 2px solid var(--magenta); filter: drop-shadow(0 0 6px var(--magenta));
}
.reel-frame::before { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.reel-frame::after { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.reel-rec {
  position: absolute; z-index: 1; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 8px;
  font: 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #fff;
  padding: 7px 10px; border-radius: 999px; background: rgba(5, 5, 6, .6); backdrop-filter: blur(6px);
}
.reel-rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--magenta); box-shadow: var(--magenta-glow); animation: blink 1.4s infinite; }
.reel-play {
  position: absolute; z-index: 1; left: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(5, 5, 6, .55); backdrop-filter: blur(6px);
  color: #fff; font-size: 13px; cursor: pointer; transition: border-color .2s, color .2s;
}
.reel-play:hover { border-color: var(--magenta); color: var(--magenta-hi); }
.reel-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.reel-tabs button {
  display: grid; gap: 6px; padding: 6px; border: 1px solid var(--edge); border-radius: 12px; background: var(--bg-2);
  color: var(--ink); font: 11px/1.2 var(--mono); text-align: left; cursor: pointer; transition: border-color .25s, color .25s;
}
.reel-tabs img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 7px; opacity: .55; transition: opacity .25s; }
.reel-tabs span { padding: 0 2px 2px; }
.reel-tabs button:hover img, .reel-tabs [aria-selected="true"] img { opacity: 1; }
.reel-tabs [aria-selected="true"] { border-color: var(--magenta); color: var(--ink-hi); }
.about-copy p { font-size: 18px; color: var(--ink-2); }
.materials { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 28px 0 0; }
.materials li { font: 13px/1 var(--mono); padding: 10px 14px; border: 1px solid var(--edge); border-radius: 999px; color: var(--ink-2); background: var(--bg-2); transition: border-color .3s, color .3s; }
.materials li:hover { border-color: var(--magenta); color: var(--ink-hi); }

/* ── Service tiles ──────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile {
  position: relative; padding: 34px 30px 30px; min-height: 330px; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--edge); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .4s, translate .5s var(--ease); /* GSAP owns `transform` */
}
.tile::before { /* laser line sweeping down on hover */
  content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--magenta), transparent); box-shadow: 0 0 16px 2px color-mix(in oklch, var(--magenta) 60%, transparent);
  opacity: 0;
}
.tile:hover::before { animation: tile-scan 1.1s var(--ease); }
@keyframes tile-scan { 0% { top: 0; opacity: 0; } 20% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
.tile::after { /* soft magenta glow following the pointer */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), color-mix(in oklch, var(--magenta) 12%, transparent), transparent 60%);
}
.tile:hover { border-color: color-mix(in oklch, var(--magenta) 40%, var(--edge)); translate: 0 -4px; }
.tile:hover::after { opacity: 1; }
.tile-icon { width: 68px; height: 68px; margin-bottom: auto; fill: none; stroke: var(--ink-2); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s; }
.tile-icon .accent { stroke: var(--magenta); }
.tile-icon .beam { stroke: var(--magenta); stroke-width: 1.6; filter: drop-shadow(0 0 3px var(--magenta)); }
.tile-icon .dash { stroke-dasharray: 3 3; }
.tile:hover .tile-icon .dash { animation: march 1s linear infinite; }
@keyframes march { to { stroke-dashoffset: -12; } }
.tile:hover .tile-icon { stroke: var(--ink-hi); }
.tile h3 { margin: 40px 0 12px; font-size: 24px; }
.tile p { color: var(--ink); margin-bottom: 22px; }
.tile-more { font: 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--magenta-hi); }
.tile-more span { display: inline-block; transition: transform .3s var(--ease); }
.tile:hover .tile-more span { transform: translateX(6px); }

/* ── Gallery ────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { font: 13px/1 var(--mono); padding: 10px 14px; border-radius: 999px; border: 1px solid var(--edge); background: transparent; color: var(--ink); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.filters button:hover { color: var(--ink-hi); border-color: var(--line); }
.filters button[aria-selected="true"] { color: #fff; background: var(--magenta); border-color: var(--magenta); }
.gallery { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 260px; grid-auto-flow: dense; gap: 14px; }
/* Cards (absolutely positioned while Flip animates) must stay above the next section's 1px divider */
.works { z-index: 1; }
.work {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--edge); background: var(--panel);
  cursor: zoom-in; padding: 0; text-align: left; color: inherit; font: inherit;
  transition: border-color .3s; /* position/scale animated by GSAP Flip */
}
.work.wide { grid-column: span 2; }
.work.tall { grid-row: span 2; }
.work.hide { display: none; }
.work .art { position: absolute; inset: 0; transition: transform .8s var(--ease); }
.work .art img { width: 100%; height: 100%; object-fit: cover; }
.work .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(5, 5, 6, .55)); }
.work:hover .art { transform: scale(1.04); }
.work:hover { border-color: color-mix(in oklch, var(--magenta) 40%, var(--edge)); }
.work figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 16px;
  background: linear-gradient(transparent, rgba(5, 5, 6, .92)); transform: translateY(8px); opacity: .9; transition: transform .4s var(--ease), opacity .4s;
}
.work:hover figcaption { transform: none; opacity: 1; }
.work figcaption b { display: block; color: var(--ink-hi); font-weight: 650; font-stretch: 110%; }
.work figcaption small { font: 12px/1.4 var(--mono); color: var(--ink); }


.lightbox { width: min(1000px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--edge); border-radius: 22px; background: var(--panel); color: var(--ink-2); overflow: hidden; }
.lightbox::backdrop { background: rgba(0, 0, 0, .8); backdrop-filter: blur(6px); }
.lightbox[open] { animation: lb-in .4s var(--ease); }
@keyframes lb-in { from { opacity: 0; transform: scale(.96); } }
.lightbox figure { margin: 0; }
.lb-media { aspect-ratio: 4 / 3; max-height: 72vh; background: var(--bg-2); }
.lb-media img { width: 100%; height: 100%; object-fit: contain; }
.lightbox figcaption { padding: 18px 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lightbox figcaption b { color: var(--ink-hi); }
.lightbox figcaption small { font: 12px var(--mono); color: var(--ink); }
.lb-close, .lb-nav { position: absolute; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(5, 5, 6, .7); color: var(--ink-hi); font-size: 20px; cursor: pointer; transition: border-color .2s, color .2s; }
.lb-close:hover, .lb-nav:hover { border-color: var(--magenta); color: var(--magenta-hi); }
.lb-close { top: 14px; right: 14px; }
.lb-nav { top: calc(50% - 50px); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ── Why ────────────────────────────────────────────────────── */
.why-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); counter-reset: why; border-top: 1px solid var(--edge); }
.why-list li { counter-increment: why; padding: 34px 30px 34px 0; border-bottom: 1px solid var(--edge); position: relative; }
.why-list li:not(:nth-child(3n + 1)) { padding-left: 30px; border-left: 1px solid var(--edge); }
.why-list li::before { content: "0" counter(why); display: block; font: 13px/1 var(--mono); color: var(--magenta-hi); margin-bottom: 26px; }
.why-list h3 { margin-bottom: 10px; }
.why-list p { color: var(--ink); margin: 0; }

/* ── Calculator ─────────────────────────────────────────────── */
.calc-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.calc-form, .calc-result, .quote { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--edge); border-radius: 22px; }
.calc-form { padding: 34px; display: grid; gap: 30px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font: 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin-bottom: 14px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; height: 100%; padding: 16px; border: 1px solid var(--edge); border-radius: 14px; background: var(--bg); transition: border-color .25s, background .25s, box-shadow .25s; }
.seg b { display: block; color: var(--ink-hi); font-weight: 650; font-stretch: 110%; }
.seg small { display: block; margin-top: 4px; font-size: 13px; color: var(--ink); line-height: 1.35; }
.seg label:hover span { border-color: var(--line); }
.seg input:checked + span { border-color: var(--magenta); background: linear-gradient(180deg, color-mix(in oklch, var(--magenta) 10%, transparent), transparent); box-shadow: inset 0 0 0 1px var(--magenta); }
.seg input:focus-visible + span { outline: 2px solid var(--magenta); outline-offset: 3px; }

.qty-row { display: flex; gap: 8px; margin-bottom: 18px; }
.qty-row input { flex: 1; min-width: 0; text-align: center; font: 700 30px/1 var(--head); font-stretch: 115%; color: var(--ink-hi); background: var(--bg); border: 1px solid var(--edge); border-radius: 14px; padding: 12px; -moz-appearance: textfield; }
.qty-row input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-row input:focus { border-color: var(--magenta); outline: none; }
.step { width: 60px; border-radius: 14px; border: 1px solid var(--edge); background: var(--bg); color: var(--ink-hi); font-size: 22px; cursor: pointer; transition: border-color .2s, color .2s; }
.step:hover { border-color: var(--magenta); color: var(--magenta-hi); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--magenta) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 2px; background: linear-gradient(90deg, var(--magenta) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -9px; border-radius: 50%; background: #fff; border: 4px solid var(--magenta); box-shadow: 0 0 14px color-mix(in oklch, var(--magenta) 80%, transparent); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--magenta); box-shadow: 0 0 14px color-mix(in oklch, var(--magenta) 80%, transparent); }
.ticks { display: flex; justify-content: space-between; font: 10px/1 var(--mono); color: var(--ink); margin-top: 4px; padding: 0 6px; }
.ticks span { width: 0; display: flex; justify-content: center; }
.ticks span.on { color: var(--magenta-hi); }

.toggles { display: grid; gap: 10px; }
.switch { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: 14px; background: var(--bg); cursor: pointer; transition: border-color .25s; }
.switch:hover { border-color: var(--line); }
.switch input { position: absolute; opacity: 0; }
.sw { flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .3s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .35s var(--ease); }
.switch input:checked + .sw { background: var(--magenta); box-shadow: 0 0 14px color-mix(in oklch, var(--magenta) 50%, transparent); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--magenta); outline-offset: 3px; }
.switch b { display: block; color: var(--ink-hi); font-weight: 600; }
.switch small { color: var(--ink); font-size: 13px; }

.calc-result { padding: 34px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.calc-result::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 320px; height: 320px; background: radial-gradient(circle, color-mix(in oklch, var(--magenta) 18%, transparent), transparent 65%); pointer-events: none; }
.res-label { font: 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 0 0 10px; }
.res-total { font: 800 clamp(48px, 6vw, 72px)/1 var(--head); font-stretch: 120%; color: var(--ink-hi); margin: 0 0 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.res-total small { font-size: .4em; color: var(--ink); font-weight: 600; }
.res-total.flash { animation: flash .6s var(--ease); }
@keyframes flash { 0% { text-shadow: 0 0 22px var(--magenta); color: var(--magenta-hi); } 100% { text-shadow: none; } }
.res-break { margin: 0 0 18px; display: grid; gap: 0; }
.res-break div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--edge); font-size: 15px; }
.res-break dt { color: var(--ink); }
.res-break dd { margin: 0; color: var(--ink-hi); font-variant-numeric: tabular-nums; font-weight: 600; }
.res-hint { font-size: 14px; color: var(--magenta-hi); min-height: 1.5em; margin: 0 0 10px; }
.res-chart { width: 100%; height: auto; margin: 4px 0 22px; overflow: visible; }
.res-chart .axis { stroke: var(--edge); }
.res-chart .curve { fill: none; stroke: var(--magenta); stroke-width: 1.6; filter: drop-shadow(0 0 4px color-mix(in oklch, var(--magenta) 60%, transparent)); }
.res-chart .area { fill: url(#chart-fill); }
.res-chart .dot { fill: #fff; stroke: var(--magenta); stroke-width: 3; transition: cx .4s var(--ease), cy .4s var(--ease); }
.res-chart text { font: 9px var(--mono); fill: var(--ink); }
.res-note { font-size: 12.5px; color: var(--ink); margin: 14px 0 0; }

/* Quick quote form */
.quote { margin-top: 16px; padding: 34px; display: grid; grid-template-columns: 280px 1fr; gap: 40px; }
.quote-head h3 { font-size: 28px; margin-bottom: 10px; }
.quote-head p { color: var(--ink); }
.quote-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quote-form label { display: grid; gap: 8px; font: 12px/1 var(--mono); letter-spacing: .08em; color: var(--ink); }
.quote-form .full { grid-column: 1 / -1; }
.quote-form input:not([type="checkbox"]), .quote-form select, .quote-form textarea {
  width: 100%; font: 15px/1.4 var(--head); color: var(--ink-hi); background: var(--bg); border: 1px solid var(--edge); border-radius: 12px; padding: 13px 14px;
  transition: border-color .2s, box-shadow .2s;
}
.quote-form textarea { resize: vertical; }
.quote-form select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.quote-form :is(input, select, textarea):focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-dim); }

/* Custom select (assets/js/select.js) — the native <select> stays in the form, visually hidden */
.quote-form .select-native, .select-native { /* beats `.quote-form select { width: 100% }` */
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important;
  overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none;
}
.select { position: relative; }
.select-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  font: 15px/1.4 var(--head); color: var(--ink-hi); background: var(--bg); border: 1px solid var(--edge); border-radius: 12px;
  padding: 13px 16px 13px 14px; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.select-btn::after { margin-left: 0; color: var(--ink); }
.select-btn:hover { border-color: var(--line); }
.select-btn:focus-visible, .select.open .select-btn { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-dim); }
.select.open .select-btn::after { transform: translateY(1px) rotate(225deg); color: var(--magenta-hi); }
.select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-list {
  position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; right: 0; min-width: 240px; max-height: 300px; overflow: auto;
  list-style: none; margin: 0; padding: 6px; outline: none;
  background: rgba(11, 11, 14, .98); border: 1px solid var(--edge); border-radius: 16px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .95), 0 0 0 1px color-mix(in oklch, var(--magenta) 10%, transparent);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: 50% 0;
  transition: opacity .2s, transform .3s var(--ease), visibility .2s;
}
/* visibility flips instantly on open, so the list can take keyboard focus right away */
.select.open .select-list { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .3s var(--ease), visibility 0s; }
.select-list li {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px 11px 14px; border-radius: 10px; cursor: pointer;
  font: 14.5px/1.3 var(--head); color: var(--ink-2); letter-spacing: 0;
  opacity: 0; transform: translateY(-3px); transition: opacity .25s, transform .3s var(--ease), background .15s, color .15s;
  transition-delay: calc(var(--i) * 25ms), calc(var(--i) * 25ms), 0s, 0s;
}
.select.open .select-list li { opacity: 1; transform: none; }
.select-list li::before { /* same magenta marker as the nav dropdown */
  content: ""; position: absolute; left: 0; top: 50%; width: 2px; height: 0; border-radius: 2px; translate: 0 -50%;
  background: var(--magenta-hi); box-shadow: var(--magenta-glow); transition: height .25s var(--ease);
}
.select-list li.active { background: var(--panel-2); color: var(--ink-hi); }
.select-list li.active::before { height: 55%; }
.select-list li[aria-selected="true"] { color: var(--ink-hi); }
.select-list li[aria-selected="true"]::after { /* check mark */
  content: ""; flex: none; width: 12px; height: 6px; border: solid var(--magenta-hi); border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg);
}
.quote-form .invalid { border-color: #ff5c7a !important; }
.consent { grid-template-columns: auto 1fr; align-items: start; font: 13px/1.5 var(--head) !important; letter-spacing: 0 !important; }
.consent input { width: 18px; height: 18px; accent-color: var(--magenta); margin-top: 1px; }
.calc-attached { font: 13px/1.5 var(--mono); color: var(--magenta-hi); padding: 12px 14px; border: 1px dashed color-mix(in oklch, var(--magenta) 40%, transparent); border-radius: 12px; margin: 0; }
.form-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.form-msg { margin: 0; font-size: 14px; }
.form-msg.ok { color: #6ee7a8; }
.form-msg.err { color: #ff8aa1; }

/* ── Contact ────────────────────────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: stretch; }
.contact-info :is(h1, h2) { margin-bottom: 30px; }
.contact-list { margin: 0 0 30px; display: grid; gap: 18px; }
.contact-list dt { font: 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.contact-list dd { margin: 0; color: var(--ink-hi); font-size: 18px; }
.contact-list a:hover { color: var(--magenta-hi); }
.map { position: relative; min-height: 420px; border-radius: 22px; overflow: hidden; border: 1px solid var(--edge); background: var(--panel); }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; filter: invert(.92) hue-rotate(180deg) grayscale(.85) contrast(.9) brightness(.85); }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--edge); padding: 40px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-inner nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-inner nav a { color: var(--ink); font-size: 14px; transition: color .2s; }
.footer-inner nav a:hover { color: var(--ink-hi); }
.footer-inner p { margin: 0; font: 12px var(--mono); color: var(--ink); }

/* ── Subpages (generated by scripts/build-pages.mjs) ──────── */
.page main > .section:first-child { padding-top: clamp(130px, 15vw, 190px); }
.page main > .section:first-child::before { display: none; }
.page :is(.sec-head, .contact-info) h1 { font-size: clamp(40px, 6.4vw, 76px); font-weight: 780; font-stretch: 120%; letter-spacing: -.02em; }
/* breadcrumbs sit where the section number used to be */
.sec-num a { color: var(--ink); transition: color .2s; }
.sec-num a:hover { color: var(--ink-hi); }
.sec-num span[aria-hidden] { color: var(--line); margin: 0 2px; }
/* current page in the menu */
.menu > ul > li > a[aria-current], .sub a[aria-current="page"] { color: var(--ink-hi); background: var(--panel-2); }
.menu > ul > li > a[aria-current="page"]::before, .menu > ul > li > a[aria-current="true"]::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; vertical-align: 2px;
  background: var(--magenta-hi); box-shadow: var(--magenta-glow);
}
.sub a[aria-current="page"]::before { height: 60%; }
.sub a[aria-current="page"] .sub-num { color: var(--magenta-hi); }

/* service page intro: text + large line-art icon */
.service-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.service-intro .sec-head { margin-bottom: 0; }
.service-intro .hero-cta { margin: 34px 0 0; }
.service-art {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 28px;
  border: 1px solid var(--edge); background: radial-gradient(circle at 50% 45%, var(--magenta-dim), transparent 62%), linear-gradient(180deg, var(--panel), var(--bg-2));
}
.service-art .tile-icon { width: 46%; height: auto; margin: 0; stroke-width: 1; }
.quote-only .quote { margin-top: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .why-list { grid-template-columns: repeat(2, 1fr); }
  .why-list li:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
  .why-list li:nth-child(2n) { padding-left: 30px; border-left: 1px solid var(--edge); }
  .quote { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .menu {
    /* drops down as a rounded panel right under the floating bar, same width
       (the bar's backdrop-filter makes it the containing block, so position relative to it) */
    position: absolute; top: calc(100% + 10px); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 16px; padding: 12px 12px 16px;
    background: rgba(9, 9, 11, .97); backdrop-filter: blur(16px); border: 1px solid var(--edge); border-radius: 22px;
    max-height: calc(100svh - 104px); overflow: auto;
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .3s, transform .3s var(--ease), visibility .3s;
  }
  .menu.open { opacity: 1; visibility: visible; transform: none; }
  .menu > ul { flex-direction: column; }
  .menu > ul > li > a { padding: 14px 8px; font-size: 18px; border-radius: 10px; }
  /* visibility: inherit — "visible" would keep the closed (invisible) menu's links tappable over the page */
  .sub { position: static; width: auto; opacity: 1; visibility: inherit; transform: none; background: none; border: 0; box-shadow: none; padding: 0 0 6px 4px; }
  .sub::before, .sub::after { display: none; }
  .sub li { opacity: 1; transform: none; }
  .sub a { padding: 9px 10px; }
  .has-sub > a::after { display: none; }
  .site-header:has(.menu.open) .header-inner { background: rgba(9, 9, 11, .97); }
  .site-header .header-inner { padding-left: 18px; padding-right: 8px; }
  .menu-toggle { width: 46px; height: 46px; border-radius: 999px; }
  .menu-toggle span:first-child { top: 18px; }
  .menu-toggle span:last-child { top: 26px; }
  .menu-toggle[aria-expanded="true"] span { top: 22px; }
  .hero { min-height: auto; padding-top: 112px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { order: -1; margin: -10px -6% 0; }
  .hero-stack { width: 100%; margin: 0; }
  .service-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .service-art { width: min(320px, 100%); justify-self: start; }
  .about-grid, .calc-grid, .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .reel { width: min(360px, 100%); }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { min-height: 0; }
  .tile h3 { margin-top: 28px; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 170px; gap: 10px; }
  .work.wide { grid-column: span 2; }
  .why-list { grid-template-columns: 1fr; }
  .why-list li:nth-child(2n) { padding-left: 0; border-left: 0; }
  .hero-facts { grid-template-columns: 1fr 1fr; gap: 18px; }
  .hero-facts div:last-child { grid-column: 1 / -1; }
  .calc-form, .calc-result, .quote { padding: 22px; }
  .seg { grid-template-columns: 1fr; }
  .quote-form { grid-template-columns: 1fr; }
  .map { min-height: 300px; }
  .lb-nav { top: auto; bottom: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-hero], .js [data-reveal] { visibility: visible; }
}

/* Anti-spam honeypot field in the quote form */
.quote-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Treść z edytora WordPressa (opis usługi, zwykłe strony) */
.service-body { padding-top: 0; }
.entry { max-width: 760px; color: var(--ink); font-size: 17px; line-height: 1.7; }
.entry > * + * { margin-top: 1em; }
.entry :is(h2, h3) { color: var(--ink-hi); line-height: 1.2; margin-top: 1.6em; }
.entry a { color: var(--magenta-hi); }
.entry img { max-width: 100%; height: auto; border-radius: 14px; }
.entry ul, .entry ol { padding-left: 1.2em; }

/* Pasek administratora WordPressa (widoczny po zalogowaniu) */
.admin-bar .site-header { top: 46px; } /* 14px + 32px pasek */
@media (max-width: 782px) { .admin-bar .site-header { top: 60px; } }
@media (max-width: 600px) { #wpadminbar { position: fixed; } }
