:root {
  --bg: #fdfdfd;
  --ink: #111;
  --red: #b00d12;
  --gutter: clamp(18px, 3.6vw, 64px);
  --small: clamp(10.5px, 0.82vw, 15px);
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Fixed chrome (logo, nav, side copy, footer) ---------- */

.top {
  position: fixed;
  z-index: 10;
  top: clamp(14px, 4.1vh, 52px);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.top a, .top button { pointer-events: auto; }

/* logo.png has white padding: the link is the crop box around its ink (x 88–1231, y 105–237 of 1320 × 362) */
.logo {
  display: block;
  width: clamp(130px, 11.5vw, 210px);
  aspect-ratio: 1144 / 133;
  overflow: hidden;
}
.logo img {
  display: block;
  width: 115.385%;
  margin: -9.178% 0 0 -7.692%;
  mix-blend-mode: multiply;
}

.nav { display: flex; gap: clamp(22px, 3.3vw, 62px); }
.nav button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--small);
  font-weight: 400;
  letter-spacing: 0.02em;
  position: relative;
  cursor: pointer;
}
.nav button::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s ease;
}
.nav button:hover::after, .nav button:focus-visible::after { transform: scaleX(1); transform-origin: left; }

.services {
  inset: auto;
  top: calc(clamp(14px, 4.1vh, 52px) + 34px);
  right: var(--gutter);
  margin: 0;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 14px;
  background: rgba(253, 253, 253, .5);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 20px 50px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .85);
  font-size: var(--small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1), overlay .4s allow-discrete, display .4s allow-discrete;
}
.services:popover-open { opacity: 1; transform: none; }
@starting-style { .services:popover-open { opacity: 0; transform: translateY(-8px) scale(.96); } }
.services ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.services li {
  display: flex; align-items: center; gap: 12px; white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1);
}
.services:popover-open li { opacity: 1; transform: none; }
@starting-style { .services:popover-open li { opacity: 0; transform: translateY(6px); } }
.services:popover-open li:nth-child(1) { transition-delay: .06s; }
.services:popover-open li:nth-child(2) { transition-delay: .1s; }
.services:popover-open li:nth-child(3) { transition-delay: .14s; }
.services:popover-open li:nth-child(4) { transition-delay: .18s; }
.services:popover-open li:nth-child(5) { transition-delay: .22s; }
@media (prefers-reduced-motion: reduce) {
  .services, .services li, .services:popover-open, .services:popover-open li { transform: none; }
}
.services svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side {
  position: fixed;
  z-index: 10;
  top: 39.4%;
  right: var(--gutter);
  margin: 0;
  text-align: right;
  font-size: calc(var(--small) * 0.96);
  line-height: 1.5;
  letter-spacing: 0.11em;
  pointer-events: none;
}

.scroll-hint {
  position: fixed;
  z-index: 10;
  left: var(--gutter);
  bottom: clamp(18px, 6vh, 72px);
  margin: 0;
  font-size: calc(var(--small) * 0.96);
  line-height: 1.5;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.contact {
  position: fixed;
  z-index: 10;
  right: var(--gutter);
  bottom: clamp(18px, 6vh, 72px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-style: normal;
  font-size: calc(var(--small) * 0.96);
  line-height: 1.5;
  letter-spacing: 0.06em;
  gap: 0.35em;
}
.contact a { display: flex; align-items: flex-start; gap: 0.7em; text-align: right; }
.contact a:hover { color: var(--red); }
.contact svg {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.125em;
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 3D stage ---------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  perspective-origin: 50% 50%;
  touch-action: none;
  cursor: grab;
}
.stage.is-dragging { cursor: grabbing; }
.stage.is-knot-hover { cursor: pointer; }

.scene {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.knot {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.stage.is-focus .knot { opacity: .12; }


.shadow {
  position: absolute;
  left: -100px;
  top: -100px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .3), rgba(0, 0, 0, .08) 60%, transparent);
  filter: blur(6px);
  pointer-events: none;
}

/* ---------- Cards ---------- */

.card {
  position: absolute;
  left: -300px;
  top: -225px;
  width: 600px;
  height: 450px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  transform-style: preserve-3d;
  will-change: transform, filter, opacity;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.card > span, .face {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
}
.slab { background: #ebebea; }
.slab:nth-child(1) { transform: translateZ(-6px); }
.slab:nth-child(2) { transform: translateZ(-12px); }
.slab:nth-child(3) { transform: translateZ(-18px); background: #d6d6d5; }
.face { object-fit: cover; transform: translateZ(0.5px); }
.card:focus-visible .face { box-shadow: 0 0 0 6px var(--red); }

/* ---------- Focus caption ---------- */

.caption {
  position: fixed;
  z-index: 11;
  left: 50%;
  top: 0;            /* set from script.js: just under the focused card */
  margin: 0;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
  text-align: center;
  white-space: nowrap;
  font-size: calc(var(--small) * .9);
  letter-spacing: .06em;
}
.caption.is-on { opacity: .5; transform: translate(-50%, 0); }

/* ---------- Small screens ---------- */

@media (max-width: 767px) {
  .side { display: none; }
  .contact { font-size: 9px; letter-spacing: 0.04em; gap: 0.25em; }
}
