/* ============================================================
   DMD / СПА - design system
   ============================================================ */

@layer reset, tokens, base, layout, components, utilities;

@property --cube-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 90deg;
}

@property --cube-hover {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

@property --cube-target {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }
  body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
  img, svg, video { display: block; max-width: 100%; height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  ul, ol { list-style: none; padding: 0; }
  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
}

@layer tokens {
  :root {
    color-scheme: dark;

    --bg: #06080b;
    --bg-soft: #0b0f15;
    --panel: #10151d;
    --panel-2: #151b25;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .20);
    --text: #e9edf3;
    --muted: #94a1b3;
    --accent: #ff4b3e;
    --accent-soft: rgba(255, 75, 62, .14);
    --accent-ink: #ffffff;
    --accent-2: #46c8ff;
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, .75);
    --grid-line: rgba(255, 255, 255, .045);

    --radius: 14px;
    --radius-sm: 8px;
    --pad: clamp(1rem, 3.5vw, 2.25rem);
    --maxw: 1220px;

    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono",
      monospace;

    --step--1: clamp(.78rem, .74rem + .2vw, .875rem);
    --step-0: clamp(.94rem, .88rem + .3vw, 1.05rem);
    --step-1: clamp(1.1rem, 1rem + .5vw, 1.35rem);
    --step-2: clamp(1.4rem, 1.15rem + 1.1vw, 2rem);
    --step-3: clamp(1.85rem, 1.4rem + 2.1vw, 2.9rem);
    --step-4: clamp(2.3rem, 1.55rem + 3.6vw, 4.25rem);
  }

  html[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f6f9;
    --bg-soft: #ffffff;
    --panel: #ffffff;
    --panel-2: #f0f3f7;
    --line: rgba(12, 20, 32, .12);
    --line-strong: rgba(12, 20, 32, .24);
    --text: #0e141c;
    --muted: #5b6776;
    --accent: #c02a1f;
    --accent-soft: rgba(192, 42, 31, .10);
    --accent-ink: #ffffff;
    --accent-2: #0f7fb8;
    --shadow: 0 20px 45px -25px rgba(15, 25, 40, .35);
    --grid-line: rgba(12, 20, 32, .05);
  }
}

@layer base {
  body {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
  }

  h1, h2, h3, h4 { line-height: 1.15; font-weight: 650; letter-spacing: -.02em; text-wrap: balance; }
  h1 { font-size: var(--step-4); }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-1); }
  h4 { font-size: var(--step-0); font-weight: 600; }
  p { text-wrap: pretty; }
  a { text-decoration: none; }
  ::selection { background: var(--accent); color: var(--accent-ink); }

  .prose > * + * { margin-top: 1rem; }
  .prose p { color: var(--muted); }
  .prose strong { color: var(--text); }
  .prose ul { display: grid; gap: .55rem; margin-top: 1rem; }
  .prose li { position: relative; padding-left: 1.35rem; color: var(--muted); }
  .prose li::before {
    content: ""; position: absolute; left: 0; top: .62em;
    width: .5rem; height: .5rem; background: var(--accent); border-radius: 1px;
  }
}

@layer layout {
  .container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--pad);
  }

  .section { padding-block: clamp(3.5rem, 8vw, 7rem); position: relative; }
  .section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
  .section + .section { border-top: 1px solid var(--line); }

  .grid { display: grid; gap: clamp(1rem, 2vw, 1.5rem); }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

  .split {
    display: grid;
    gap: clamp(1.5rem, 4vw, 4rem);
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: start;
  }
  @media (width < 900px) { .split { grid-template-columns: 1fr; } }

  .skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 999;
    background: var(--accent); color: var(--accent-ink);
    padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
  }
  .skip-link:focus { left: 0; }
}

@layer components {
  /* ---------- header ---------- */
  .site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
  }
  .site-header__inner {
    display: flex; align-items: center; gap: 1rem;
    min-height: 68px;
  }

  .brand { display: flex; align-items: center; gap: .7rem; margin-right: auto; }
  .brand__scene {
    --cube-unit: 16px;
    --cube-size: calc(var(--cube-unit) * .32);
    --cube-depth: calc(var(--cube-unit) * .32);
    position: relative; width: 116px; height: 40px; flex: none; pointer-events: none;
  }
  .cube-scene__model {
    /* Keep animation state local to the rotating element for Firefox paints. */
    --cube-angle: 90deg;
    --cube-hover: 0;
    --cube-target: 0deg;
    --view-angle: calc(var(--cube-angle) * (1 - var(--cube-hover)) + var(--cube-target) * var(--cube-hover));
    /* Add depth midway through a turn; keep the word and side grid flat. */
    --perspective-scale: calc(5 / max(.000001, sin(calc(var(--view-angle) * 2))));
    --perspective-distance: calc(var(--cube-unit) * var(--perspective-scale));
    /* The last letter defines the right edge throughout this quarter-turn. */
    --edge-depth: calc(var(--cube-edge-x, 2.67) * sin(var(--view-angle)) - .79 * cos(var(--view-angle)));
    --right-edge: calc(var(--cube-unit) * (var(--cube-edge-x, 2.67) * cos(var(--view-angle)) + .79 * sin(var(--view-angle))) / (1 - var(--edge-depth) / var(--perspective-scale)));
    position: absolute; right: 6%; top: 50%; width: 0; height: 0;
    transform-style: preserve-3d;
    will-change: transform;
    transform: translateX(calc(-1 * var(--right-edge))) perspective(var(--perspective-distance)) rotateY(calc(-1 * var(--view-angle)));
    animation: cube-turn 30s 15s cubic-bezier(.37, 0, .63, 1) infinite both,
      cube-target 30s 15s steps(1, end) infinite both;
    transition: --cube-hover 1.8s cubic-bezier(.37, 0, .63, 1);
  }
  .cube-scene__cube {
    position: absolute; width: 0; height: 0; transform-style: preserve-3d;
    transform: translate3d(calc(var(--x) * var(--cube-unit)), calc(var(--y) * var(--cube-unit)), calc(var(--z) * var(--cube-unit)));
  }
  .cube-scene__cube::before, .cube-scene__cube::after {
    content: ""; position: absolute; backface-visibility: hidden;
    top: calc(var(--cube-size) / -2); height: var(--cube-size);
    background: var(--accent);
  }
  .cube-scene__cube::before {
    left: calc(var(--cube-size) / -2); width: var(--cube-size);
    transform: translateZ(calc(var(--cube-depth) / 2));
  }
  .cube-scene__cube::after {
    left: calc(var(--cube-depth) / -2); width: var(--cube-depth);
    background: color-mix(in srgb, var(--accent) 76%, black);
    transform: rotateY(90deg) translateZ(calc(var(--cube-size) / 2));
  }
  .cube-scene__top, .cube-scene__bottom {
    position: absolute; backface-visibility: hidden;
    width: var(--cube-size); height: var(--cube-depth);
    left: calc(var(--cube-size) / -2); top: calc(var(--cube-depth) / -2);
  }
  .cube-scene__top {
    background: color-mix(in srgb, var(--accent) 82%, white);
    transform: rotateX(90deg) translateZ(calc(var(--cube-size) / 2));
  }
  .cube-scene__bottom {
    background: color-mix(in srgb, var(--accent) 66%, black);
    transform: rotateX(-90deg) translateZ(calc(var(--cube-size) / 2));
  }
  /* A 1.8s turn starts every 15s, after an initial 15s delay. */
  @keyframes cube-turn {
    0%, 100% { --cube-angle: 90deg; }
    6%, 50% { --cube-angle: 0deg; }
    56% { --cube-angle: 90deg; }
  }
  /* Switch the hover destination after the return transition can finish. */
  @keyframes cube-target {
    0%, 100% { --cube-target: 0deg; }
    12% { --cube-target: 90deg; }
    62% { --cube-target: 0deg; }
  }
  @media (hover: hover) and (pointer: fine) {
    .site-header .brand:hover .cube-scene__model { --cube-hover: 1; animation-play-state: paused; }
  }
  .site-header .brand:focus-visible .cube-scene__model { --cube-hover: 1; animation-play-state: paused; }
  .brand__name { font-weight: 750; letter-spacing: .06em; font-size: 1.05rem; white-space: nowrap; }
  .brand__name b { color: var(--accent); font-weight: 750; }
  .brand__tag {
    display: block; font-family: var(--font-mono); font-size: .62rem;
    letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 1px;
  }
  @media (width < 420px) { .brand__tag { display: none; } }
  @media (width < 1200px) { .site-header .brand__tag { display: none; } }
  @media (width < 420px) { .brand__scene { --cube-unit: 14px; width: 96px; height: 36px; } }
  @media (width < 360px) {
    .brand__scene { --cube-unit: 10px; width: 72px; height: 32px; }
    .site-header .brand { gap: .5rem; }
    .site-header__inner { gap: .5rem; }
  }

  .brand__scene--static {
    --cube-unit: 16px;
    width: 34px; height: 34px;
  }
  .brand__scene--static .cube-scene__model {
    right: 50%; transform: perspective(var(--perspective-distance)) rotateY(-90deg);
    animation: none; transition: none; will-change: auto;
  }

  .nav { display: flex; align-items: center; gap: .3rem; }
  .nav__link {
    position: relative; display: inline-flex; align-items: center; gap: .35rem;
    padding: .55rem .8rem; border-radius: var(--radius-sm);
    font-size: .92rem; font-weight: 500; color: var(--muted);
    transition: color .18s, background-color .18s;
  }
  .nav__link:hover, .nav__link:focus-visible { color: var(--text); background: var(--panel-2); }
  .nav__link[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
  .nav__link[aria-current="page"]::before {
    content: ""; position: absolute; left: .3rem; top: 50%; transform: translateY(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: var(--accent); pointer-events: none;
  }

  .has-sub { position: relative; display: flex; }
  .nav__row { display: flex; align-items: center; }
  .nav__sub-toggle { width: 26px; height: 26px; border: 0; margin-left: -.35rem; }
  .nav__sub-toggle svg { width: 14px; height: 14px; transition: transform .2s; opacity: .65; }
  .has-sub:hover .nav__sub-toggle svg,
  .nav__sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); opacity: 1; }

  .nav__sub {
    position: absolute; top: 100%; left: 0; min-width: 250px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: .45rem;
    display: grid; gap: .1rem;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .18s, transform .18s, visibility .18s;
  }
  .has-sub:hover .nav__sub,
  .has-sub:focus-within .nav__sub,
  .has-sub.sub-open .nav__sub {
    opacity: 1; visibility: visible; transform: none;
  }
  .nav__sub a {
    padding: .55rem .75rem; border-radius: var(--radius-sm);
    font-size: .9rem; color: var(--muted);
  }
  .nav__sub a:hover { background: var(--panel-2); color: var(--text); }

  .header-tools { display: flex; align-items: center; gap: .4rem; }
  .icon-btn {
    display: grid; place-items: center; width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted);
    transition: color .18s, border-color .18s, background-color .18s;
  }
  .icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
  .icon-btn svg { width: 18px; height: 18px; }
  .theme-toggle .sun { display: none; }
  html[data-theme="light"] .theme-toggle .sun { display: block; }
  html[data-theme="light"] .theme-toggle .moon { display: none; }

  .burger { display: none; }
  @media (width < 980px) {
    .burger { display: grid; }
    body.nav-open { overflow: hidden; }
    .nav {
      position: absolute; left: 0; right: 0; top: 100%; z-index: 5;
      padding: 1rem var(--pad) 2rem;
      flex-direction: column; align-items: stretch; gap: .25rem;
      background: var(--bg-soft); border-bottom: 1px solid var(--line);
      box-shadow: var(--shadow);
      max-height: calc(100dvh - 68px); overflow-y: auto;
      visibility: hidden; pointer-events: none;
      transform: translateY(-105%); transition: transform .28s ease, visibility .28s ease;
    }
    body.nav-open .nav { transform: none; visibility: visible; pointer-events: auto; }
    .nav__link { padding: .8rem .9rem; font-size: 1rem; }
    .has-sub { display: block; position: static; }
    .nav__sub {
      position: static; transform: none; opacity: 1; visibility: visible;
      box-shadow: none; min-width: 0; background: transparent;
      border: 0; border-left: 1px solid var(--line); border-radius: 0;
      margin: .1rem 0 .3rem .6rem; padding: 0 0 0 .75rem;
      display: none;
    }
    .has-sub:hover .nav__sub { display: none; }
    .has-sub.sub-open .nav__sub { display: grid; }
  }

  /* ---------- buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .8rem 1.35rem; border-radius: 999px;
    font-weight: 600; font-size: .95rem; letter-spacing: -.01em;
    border: 1px solid transparent; white-space: nowrap;
    transition: transform .18s, background-color .18s, border-color .18s, color .18s, box-shadow .18s;
  }
  .btn:hover { transform: translateY(-2px); }
  .btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 30px -14px var(--accent); }
  .btn--primary:hover { box-shadow: 0 18px 40px -14px var(--accent); }
  .btn--ghost { border-color: var(--line-strong); color: var(--text); }
  .btn--ghost:hover { background: var(--panel-2); border-color: var(--text); }
  .btn--sm { padding: .5rem .95rem; font-size: .85rem; }

  .link-arrow {
    display: inline-flex; align-items: center; gap: .4rem;
    font-weight: 600; font-size: .9rem; color: var(--accent);
  }
  .link-arrow svg { width: 15px; height: 15px; transition: transform .2s; }
  .link-arrow:hover svg { transform: translateX(4px); }

  /* ---------- section heading ---------- */
  .eyebrow {
    display: inline-flex; align-items: center; gap: .55rem;
    font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em;
    text-transform: uppercase; color: var(--accent); margin-bottom: .9rem;
  }
  .eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent); }
  .section__head { max-width: 720px; margin-bottom: clamp(1.75rem, 4vw, 3rem); }
  .section__head p { color: var(--muted); margin-top: .9rem; font-size: var(--step-1); }

  /* ---------- hero ---------- */
  .hero { position: relative; padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(2.5rem, 6vw, 5rem); overflow: hidden; }
  .hero::before {
    content: ""; position: absolute; inset: -1px;
    background-image:
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(120% 90% at 20% 0%, #000 25%, transparent 75%);
    pointer-events: none;
  }
  .hero::after {
    content: ""; position: absolute; width: 640px; height: 640px; right: -180px; top: -260px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 62%);
    pointer-events: none;
  }
  .hero .container { position: relative; }
  .hero__copy { position: relative; z-index: 1; }
  .hero__title { max-width: 16ch; }
  .hero__title em { font-style: normal; color: var(--accent); }
  .hero__lead { max-width: 58ch; color: var(--muted); margin-top: 1.4rem; font-size: var(--step-1); }
  .hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

  .hero__panel {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    border: 1px solid var(--line); border-radius: var(--radius);
    background: color-mix(in srgb, var(--panel) 70%, transparent);
    backdrop-filter: blur(6px);
  }
  .stat { padding: 1.35rem 1.5rem; border-right: 1px solid var(--line); }
  .stat:last-child { border-right: 0; }
  .stat__num { font-family: var(--font-mono); font-size: var(--step-2); font-weight: 500; letter-spacing: -.03em; }
  .stat__num span { color: var(--accent); }
  .stat__label { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

  /* ---------- page head (inner pages) ---------- */
  .page-head {
    padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--line);
    background:
      linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 64px 64px,
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 64px 64px;
  }
  .page-head p { color: var(--muted); max-width: 62ch; margin-top: 1rem; font-size: var(--step-1); }
  .breadcrumb { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
  .breadcrumb a:hover { color: var(--accent); }

  /* ---------- cards ---------- */
  .card {
    position: relative; display: flex; flex-direction: column; gap: .75rem;
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .22s, transform .22s, background-color .22s;
  }
  .card:hover { border-color: var(--line-strong); transform: translateY(-4px); }
  .card--static:hover { transform: none; }
  .card__icon {
    display: grid; place-items: center; width: 42px; height: 42px;
    border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  }
  .card__icon svg { width: 21px; height: 21px; }
  .card p { color: var(--muted); font-size: .95rem; }
  .card__link { margin-top: auto; padding-top: .5rem; }

  .card--feature { background: linear-gradient(160deg, var(--panel-2), var(--panel)); }
  .card__photo { align-self: center; }
  .card__photo img { width: auto; max-width: 100%; max-height: 170px; border-radius: var(--radius-sm); margin-inline: auto; }
  .card__photo figcaption { margin-top: .35rem; color: var(--muted); font-size: .75rem; text-align: center; }

  .tag {
    display: inline-block; font-family: var(--font-mono); font-size: .68rem;
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: .25rem .6rem;
  }
  .tag--accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
  .tags { display: flex; flex-wrap: wrap; gap: .4rem; }

  /* ---------- numbered list / models ---------- */
  .models { counter-reset: model; display: grid; gap: 0; border-top: 1px solid var(--line); }
  .model {
    display: grid; grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2.5rem); align-items: start;
    padding-block: clamp(1.4rem, 3vw, 2.1rem); border-bottom: 1px solid var(--line);
  }
  .model__num {
    counter-increment: model;
    font-family: var(--font-mono); font-size: var(--step-1); color: var(--accent);
  }
  .model__num::before { content: counter(model, decimal-leading-zero); }
  .model h3 { margin-bottom: .5rem; }
  .model p { color: var(--muted); max-width: 70ch; }
  @media (width < 620px) { .model { grid-template-columns: 1fr; gap: .4rem; } }

  /* ---------- clients ---------- */
  .clients {
    display: grid; gap: 1px; background: var(--line);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  @media (width < 900px) { .clients { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (width < 460px) { .clients { grid-template-columns: minmax(0, 1fr); } }
  .client {
    display: grid; place-items: center; min-height: 130px; padding: 1.5rem;
    background: var(--panel); transition: background-color .22s;
  }
  .client:hover { background: var(--panel-2); }
  .client img {
    max-width: 78%; max-height: 74px; width: auto; padding: .4rem .55rem;
    background: #fff; border-radius: 6px;
    filter: grayscale(1) contrast(.85); opacity: .62;
    transition: filter .25s, opacity .25s;
  }
  .client:hover img { filter: none; opacity: 1; }
  .client--text {
    font-family: var(--font-mono); font-size: .82rem; letter-spacing: .06em;
    color: var(--muted); text-align: center;
  }

  /* ---------- projects ---------- */
  .filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
  .filter {
    font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em;
    padding: .5rem .95rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
    transition: all .18s;
  }
  .filter:hover { color: var(--text); border-color: var(--line-strong); }
  .filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

  .projects { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .project { background: var(--panel); transition: background-color .2s; }
  .project:hover { background: var(--panel-2); }
  .project[hidden] { display: none; }
  .project > summary {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center;
    padding: clamp(1rem, 2.5vw, 1.5rem); cursor: pointer; list-style: none;
  }
  .project > summary::-webkit-details-marker { display: none; }
  .project > summary:has(.project__thumb) { grid-template-columns: 100px minmax(0, 1fr) auto; }
  .project__thumb-link { display: block; border-radius: .35rem; cursor: zoom-in; }
  .project__thumb { width: 100px; height: 72px; object-fit: contain; background: #fff; border-radius: .35rem; }
  @media (width < 600px) {
    .project > summary:has(.project__thumb) { grid-template-columns: 64px minmax(0, 1fr) auto; gap: .75rem; }
    .project__thumb { width: 64px; height: 52px; }
  }
  .project__title { font-size: var(--step-0); font-weight: 600; }
  .project__meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
  .project__chev { width: 20px; height: 20px; color: var(--muted); transition: transform .25s; }
  .project[open] .project__chev { transform: rotate(45deg); color: var(--accent); }
  .project__body {
    padding: 0 clamp(1rem, 2.5vw, 1.5rem) clamp(1.25rem, 2.5vw, 1.75rem);
    color: var(--muted); display: grid; gap: .85rem; max-width: 85ch;
  }
  .project__body h4 { color: var(--text); margin-top: .5rem; }
  .project__gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .75rem; margin-block: .25rem .5rem; }
  .project__image { display: grid; align-items: center; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: .35rem; cursor: zoom-in; }
  .project__image:hover { border-color: var(--accent); }
  .project__image img { width: auto; max-width: 100%; height: auto; justify-self: center; }
  .project__body ul { display: grid; gap: .45rem; }
  .project__body li { position: relative; padding-left: 1.2rem; }
  .project__body li::before { content: ""; position: absolute; left: 0; top: .6em; width: .45rem; height: .45rem; background: var(--accent); border-radius: 1px; }
  .project__empty { padding: 2rem; background: var(--panel); color: var(--muted); text-align: center; }

  /* ---------- media / photos ---------- */
  .photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .75rem; }
  .photos a { display: block; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in; }
  .photos img {
    width: 100%; height: 100%; min-height: 200px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    filter: saturate(.85); transition: filter .3s, transform .3s;
  }
  .photos img:hover { filter: none; transform: scale(1.015); }

  body.photo-open { overflow: hidden; }
  .photo-viewer {
    width: min(85vw, calc(85dvh * var(--photo-ratio, 1.5)), var(--photo-width, 85vw));
    max-width: 85vw; max-height: 85dvh; margin: auto; padding: 0;
    border: 0; background: transparent; overflow: visible;
  }
  .photo-viewer::backdrop { background: rgba(0, 0, 0, .82); animation: photo-backdrop-in .3s ease both; }
  .photo-viewer.is-closing::backdrop { animation: photo-backdrop-out .3s ease both; }
  .photo-viewer__image { display: block; width: 100%; height: auto; transform-origin: top left; border-radius: var(--radius-sm); }
  .photo-viewer form { position: absolute; top: .75rem; right: .75rem; animation: photo-control-in .3s ease both; }
  .photo-viewer.is-closing form { visibility: hidden; }
  .photo-viewer__close {
    display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem;
    color: #fff; background: rgba(0, 0, 0, .7); border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px; font-size: .85rem; cursor: pointer;
  }
  .photo-viewer__close:hover { background: #000; }
  .photo-viewer__close svg { width: 18px; height: 18px; }
  @keyframes photo-backdrop-in { from { background: transparent; } to { background: rgba(0, 0, 0, .82); } }
  @keyframes photo-backdrop-out { from { background: rgba(0, 0, 0, .82); } to { background: transparent; } }
  @keyframes photo-control-in { from { opacity: 0; } to { opacity: 1; } }

  .video {
    position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--line); background: var(--panel-2);
  }
  .video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
  .video__play {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55));
  }
  .video__play span {
    display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); transition: transform .2s;
  }
  .video__play:hover span { transform: scale(1.08); }

  /* ---------- accordion (vacancies) ---------- */
  .vacancy { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
  .vacancy + .vacancy { margin-top: .75rem; }
  .vacancy > summary {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center;
    padding: 1.15rem 1.35rem; cursor: pointer; list-style: none;
  }
  .vacancy > summary::-webkit-details-marker { display: none; }
  .vacancy__title { font-weight: 600; }
  .vacancy__sub { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
  .vacancy__plus {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
    border: 1px solid var(--line); color: var(--accent); transition: transform .25s, background-color .2s;
  }
  .vacancy[open] .vacancy__plus { transform: rotate(45deg); background: var(--accent-soft); }
  .vacancy__body { padding: 0 1.35rem 1.5rem; color: var(--muted); display: grid; gap: 1rem; }
  .vacancy__body h4 { color: var(--text); }
  .vacancy__body ul { display: grid; gap: .45rem; }
  .vacancy__body li { position: relative; padding-left: 1.2rem; }
  .vacancy__body li::before { content: ""; position: absolute; left: 0; top: .6em; width: .45rem; height: .45rem; background: var(--accent); border-radius: 1px; }

  /* ---------- spec table ---------- */
  .specs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .specs > div { display: grid; grid-template-columns: minmax(0, .55fr) minmax(0, 1fr); gap: 1rem; background: var(--panel); padding: .85rem 1.15rem; }
  .specs dt { color: var(--muted); font-size: .88rem; }
  .specs dd { font-size: .92rem; }
  @media (width < 560px) { .specs > div { grid-template-columns: 1fr; gap: .2rem; } }

  /* ---------- call to action ---------- */
  .cta {
    position: relative; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: linear-gradient(140deg, var(--panel-2), var(--panel));
    padding: clamp(1.75rem, 5vw, 3.5rem);
    display: grid; gap: 1.5rem; align-items: center;
    grid-template-columns: minmax(0, 1.4fr) auto;
  }
  .cta::after {
    content: ""; position: absolute; right: -120px; bottom: -160px; width: 420px; height: 420px;
    background: radial-gradient(circle, var(--accent-soft), transparent 65%);
    pointer-events: none;
  }
  .cta > * { position: relative; }
  .cta p { color: var(--muted); margin-top: .7rem; max-width: 55ch; }
  .cta__actions { display: flex; flex-wrap: wrap; gap: .7rem; }
  @media (width < 860px) { .cta { grid-template-columns: 1fr; } }

  /* ---------- contacts ---------- */
  .contact-grid { display: grid; gap: clamp(1rem, 3vw, 2rem); grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; }
  @media (width < 900px) { .contact-grid { grid-template-columns: 1fr; } }

  .info-list { display: grid; gap: 1.1rem; }
  .info-list dt { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
  .info-list dd a:hover { color: var(--accent); }

  .form { display: grid; gap: 1rem; }
  .field { display: grid; gap: .4rem; }
  .field label { font-size: .82rem; color: var(--muted); }
  .field input, .field textarea, .field select {
    width: 100%; padding: .8rem 1rem; background: var(--bg-soft);
    border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text);
    transition: border-color .18s, background-color .18s;
  }
  .field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a1b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px 16px;
    padding-right: 2.4rem;
  }
  .field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); background: var(--panel); }
  .field textarea { min-height: 140px; resize: vertical; }
  .form__note { font-size: .8rem; color: var(--muted); }
  .form__row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
  @media (width < 560px) { .form__row { grid-template-columns: 1fr; } }

  /* ---------- footer ---------- */
  .site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding-block: clamp(2.5rem, 5vw, 4rem) 1.5rem; }
  .footer-grid {
    display: grid; gap: clamp(1.5rem, 4vw, 3rem);
    grid-template-columns: minmax(0, 1.8fr) minmax(110px, .65fr) minmax(0, 1fr) minmax(0, 1.1fr);
  }
  @media (width < 980px) { .footer-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
  @media (width < 620px) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }
  .site-footer h4 { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .9rem; font-weight: 500; }
  .site-footer li + li { margin-top: .45rem; }
  .site-footer a { color: var(--muted); font-size: .92rem; }
  .site-footer a:hover { color: var(--accent); }
  .site-footer p { color: var(--muted); font-size: .92rem; }
  .footer-bottom {
    display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between;
    margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.25rem; border-top: 1px solid var(--line);
    font-size: .82rem; color: var(--muted);
  }
  .footer-bottom .mono { font-family: var(--font-mono); }

  /* ---------- reveal ---------- */
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
  .reveal.is-visible { opacity: 1; transform: none; }
  .reveal[data-delay="1"] { transition-delay: .08s; }
  .reveal[data-delay="2"] { transition-delay: .16s; }
  .reveal[data-delay="3"] { transition-delay: .24s; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    *:not(.cube-scene__model), *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }
}

@layer utilities {
  .mono { font-family: var(--font-mono); }
  .muted { color: var(--muted); }
  .accent { color: var(--accent); }
  .center { text-align: center; }
  .mt-l { margin-top: clamp(2rem, 5vw, 3.5rem); }
  .nowrap { white-space: nowrap; }
  .visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

@media print {
  .site-header, .site-footer, .hero::before, .hero::after, .filters, .cta { display: none !important; }
  body { background: #fff; color: #000; }
  .project { break-inside: avoid; }
}
