/* ============================================
   FREDUX PORTFOLIO - Sage & Sand
   Mobile-first, accessibile, riposante
   ============================================ */

/* ---------- Tokens ---------- */
:root {
  /* Sage & sand light */
  --bg: #f6f4ee;
  --bg-soft: #efece3;
  --surface: #fbfaf6;
  --surface-2: #f1eee5;
  --ink: #2d3a33;
  --ink-soft: #54635a;
  --muted: #7d8a80;
  --line: #e2ddd0;
  --sage: #7c9885;
  --sage-deep: #5e7a68;
  --sand: #d9c7a8;
  --sand-deep: #c2a878;
  --accent: var(--sage-deep);
  --glow: rgba(124, 152, 133, 0.28);
  --glow-2: rgba(217, 199, 168, 0.4);

  --shadow-sm: 0 1px 3px rgba(45, 58, 51, 0.06);
  --shadow-md: 0 8px 30px rgba(45, 58, 51, 0.08);
  --shadow-lg: 0 20px 60px rgba(45, 58, 51, 0.12);

  --radius: 18px;
  --radius-lg: 28px;
  --maxw: 1120px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #1a201c;
  --bg-soft: #161b18;
  --surface: #222a25;
  --surface-2: #2a332d;
  --ink: #e8ece7;
  --ink-soft: #b3bdb5;
  --muted: #889089;
  --line: #313b34;
  --sage: #8fae98;
  --sage-deep: #a3c0aa;
  --sand: #d9c7a8;
  --sand-deep: #cbb287;
  --accent: var(--sage);
  --glow: rgba(143, 174, 152, 0.22);
  --glow-2: rgba(203, 178, 135, 0.14);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* Dettagli di brand anche fuori dal layout: selezione e scrollbar */
::selection { background: color-mix(in srgb, var(--sage) 35%, transparent); color: var(--ink); }
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--sage) 55%, var(--line)) transparent; }

/* Titoli bilanciati: niente parole orfane a capo */
h1, h2, h3 { text-wrap: balance; }

.section { padding: 84px 0; }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 10px; z-index: 200; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; border-radius: 6px; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--sand-deep));
  z-index: 120; transition: width 0.1s linear;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  /* saturate() dà l'effetto "liquid glass": i colori sotto la barra
     restano vivi invece di sbiadire dietro al blur */
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }

.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 1.15rem; }
.brand-mark { color: var(--accent); font-size: 1.1rem; transition: transform 0.5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(180deg); }
.brand-name { font-family: var(--font-display); letter-spacing: -0.01em; }

.nav-links { display: none; gap: 30px; }
.nav-links a {
  font-size: 0.94rem; color: var(--ink-soft); position: relative; padding: 4px 0;
  transition: color 0.2s var(--ease);
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px;
  background: var(--accent); transition: width 0.3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.lang-toggle {
  position: relative;
  display: grid; grid-template-columns: repeat(2, 38px);
  align-items: center;
  height: 38px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.lang-toggle:hover { border-color: var(--sage); }
.lang-knob {
  position: absolute; top: 3px; left: 3px;
  width: 38px; height: calc(100% - 6px);
  background: var(--accent); border-radius: 999px;
  box-shadow: 0 1px 4px rgba(45, 58, 51, 0.18);
  transition: transform 0.45s var(--ease), background 0.3s var(--ease);
  z-index: 0; pointer-events: none;
}
.lang-toggle[data-active="en"] .lang-knob { transform: translateX(38px); }
.lang-opt {
  position: relative; z-index: 1;
  display: grid; place-items: center; height: 100%;
  color: var(--muted);
  transition: color 0.3s var(--ease);
  pointer-events: none; /* the whole button handles the tap */
  user-select: none;
}
.lang-toggle[data-active="it"] .lang-opt[data-lang="it"],
.lang-toggle[data-active="en"] .lang-opt[data-lang="en"] {
  color: #fbfaf6;
}
[data-theme="dark"] .lang-toggle[data-active="it"] .lang-opt[data-lang="it"],
[data-theme="dark"] .lang-toggle[data-active="en"] .lang-opt[data-lang="en"] {
  color: #16201a;
}
.lang-toggle:active { transform: scale(0.97); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-soft);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.theme-toggle:hover { border-color: var(--sage); color: var(--ink); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Sound toggle: speaker con onde quando attivo, barrato quando muto */
.sound-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-soft);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.sound-toggle:hover { border-color: var(--sage); color: var(--ink); }
.sound-toggle .snd-wave,
.sound-toggle .snd-mute {
  transition: opacity 0.25s var(--ease);
}
.sound-toggle[data-on="true"] .snd-mute { opacity: 0; }
.sound-toggle[data-on="false"] .snd-wave { opacity: 0; }
.sound-toggle[data-on="false"] { color: var(--muted); }
/* Pulse delle onde quando si (ri)attiva il suono */
.sound-toggle.is-pinging .snd-wave-1 { animation: sndWave 0.5s var(--ease); }
.sound-toggle.is-pinging .snd-wave-2 { animation: sndWave 0.5s var(--ease) 0.12s; }
@keyframes sndWave {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.menu-toggle {
  width: 42px; height: 42px; display: grid; place-content: center; gap: 5px;
  border-radius: 12px; border: 1px solid var(--line);
}
.menu-toggle span {
  display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu drawer */
.nav-links.open {
  display: flex; flex-direction: column; gap: 0;
  position: absolute; top: 66px; left: 0; right: 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 8px 22px 18px; box-shadow: var(--shadow-md);
  animation: drawer 0.3s var(--ease);
}
.nav-links.open a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.nav-links.open a:last-child { border-bottom: none; }
@keyframes drawer { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Buttons ---------- */
.btn {
  --mx: 0px; --my: 0px; --lift: 0px;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  transform: translate3d(var(--mx), calc(var(--my) + var(--lift)), 0);
  transition: transform 0.5s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
  will-change: transform;
}
.btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at var(--bx, 50%) var(--by, 50%), rgba(255,255,255,0.18), transparent 60%);
  opacity: 0; transition: opacity 0.35s var(--ease); pointer-events: none;
}
.btn:hover::before { opacity: 1; }
.btn > * { position: relative; z-index: 1; }
.btn-primary { background: var(--accent); color: #fbfaf6; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .btn-primary { color: #16201a; }
.btn-primary:hover { box-shadow: var(--shadow-md); --lift: -2px; }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--sage); background: var(--surface); --lift: -2px; }
.btn-lg { padding: 16px 34px; font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 64px 0 56px; overflow: hidden; }
.hero-inner { position: relative; z-index: 2; }

/* Badge di disponibilità: segnale di stato, trend "open to work" ma sobrio */
.avail-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; margin-bottom: 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--ink-soft);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}
.avail-badge:hover { border-color: var(--sage); color: var(--ink); transform: translateY(-1px); }
.avail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.avail-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: inherit;
  animation: availPing 2.4s var(--ease) infinite;
}
@keyframes availPing {
  0%   { transform: scale(1); opacity: 0.7; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

.hero-eyebrow {
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 22px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.4rem, 9vw, 5rem); line-height: 1.04; letter-spacing: -0.02em;
  margin-bottom: 26px;
}
.hero-title .line { display: block; }
.hero-title .accent { color: var(--accent); font-style: italic; }

.hero-lead {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem); color: var(--ink-soft);
  max-width: 540px; margin-bottom: 34px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px; }

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  gap: 28px 36px;
}
.meta-item { display: flex; flex-direction: column; min-width: 0; }
.meta-num { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--ink); line-height: 1; }
.meta-label { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }

/* Mobile: 3 colonne uguali, font più compatto per stare in una riga sola */
@media (max-width: 599px) {
  .hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 14px;
  }
  .meta-num { font-size: 1.7rem; }
  .meta-label { font-size: 0.74rem; line-height: 1.3; }
}

/* Aurora ambientale: due masse di colore (sage + sand) che derivano
   lentissime una contro l'altra. Centri spinti fuori schermo, così in
   pagina entra solo il falloff morbido: atmosfera, non decorazione. */
.hero-aurora {
  position: absolute; inset: 0;
  z-index: 1; pointer-events: none;
  overflow: hidden;
}
.hero-aurora::before,
.hero-aurora::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  /* Il blur dissolve il banding a 8 bit del gradiente: nessuna "riga"
     visibile dove il falloff scala tra le tonalità sul fondo scuro. */
  filter: blur(60px);
  will-change: transform;
}
.hero-aurora::before {
  top: -55%; right: -40%;
  width: 120vw; height: 105vw;
  max-width: 1200px; max-height: 1050px;
  background: radial-gradient(ellipse at center, var(--glow) 0%, transparent 72%);
  animation: auroraA 26s ease-in-out infinite alternate;
}
.hero-aurora::after {
  bottom: -70%; left: -45%;
  width: 100vw; height: 90vw;
  max-width: 980px; max-height: 900px;
  background: radial-gradient(ellipse at center, var(--glow-2) 0%, transparent 70%);
  animation: auroraB 34s ease-in-out infinite alternate;
}
@keyframes auroraA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-32px, 22px, 0) scale(1.06); }
}
@keyframes auroraB {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(40px, -26px, 0) scale(1.08); }
}

/* Reactive dot grid that lights up around the cursor.
   Shared by hero and contact - canvas keeps perf cheap even with a few
   hundred dots redrawn per frame. */
.dot-grid {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.dot-grid.is-ready { opacity: 1; }
/* Skip the canvas entirely on touch / reduced-motion - it brings nothing there */
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .dot-grid { display: none; }
}

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 18px 0; overflow: hidden; background: var(--bg-soft);
}
.marquee-track {
  display: flex; white-space: nowrap; width: max-content;
  animation: scroll 32s linear infinite;
  font-family: var(--font-display); font-size: 1.3rem; color: var(--ink-soft);
}
/* margin-right (instead of gap) keeps the seamless loop math exact:
   every item carries its own 28px right-spacing, so 50% lands precisely
   on the first item of the second copy. */
.marquee-track > span { margin-right: 28px; }
.marquee-track span:nth-child(even) { color: var(--sand-deep); }
@keyframes scroll { to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ---------- Section heads ---------- */
.section-tag {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.1; letter-spacing: -0.02em;
  color: var(--ink);
}
.section-head { margin-bottom: 44px; max-width: 640px; }

/* ---------- About ---------- */
.about-inner { display: grid; gap: 40px; }
.about-photo { display: flex; justify-content: center; position: relative; }
/* Soft sage halo behind the portrait - visible only on bigger viewports */
.about-photo::before {
  content: ''; position: absolute; inset: -24px;
  background: radial-gradient(circle at 40% 40%, var(--glow) 0%, transparent 65%);
  filter: blur(28px);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
}
.photo-frame {
  width: 240px; height: 290px; border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--sage) 0%, var(--sand) 100%);
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
  z-index: 1;
}
.photo-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.7s var(--ease), filter 0.5s var(--ease);
}
.photo-frame:hover .photo-img { transform: scale(1.04); }
/* Subtle inner ring to anchor the image in the frame */
.photo-frame::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.about-text p { color: var(--ink-soft); margin-bottom: 18px; max-width: 560px; }
.about-list { display: grid; gap: 12px; margin-top: 26px; }
.about-list li {
  position: relative; padding-left: 28px; color: var(--ink); font-weight: 500;
}
.about-list li::before {
  content: '✦'; position: absolute; left: 0; color: var(--accent);
}

/* ---------- Work ---------- */
.work-grid { display: grid; gap: 24px; }
.work-card {
  --rx: 0deg; --ry: 0deg; --ty: 0px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translate3d(0, var(--ty), 0);
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.work-card:hover { box-shadow: var(--shadow-lg); border-color: var(--sage); --ty: -6px; }
.work-card .work-thumb, .work-card .work-body { transform: translateZ(0); }
.work-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), rgba(255,255,255,0.22), transparent 55%);
  opacity: 0; transition: opacity 0.35s var(--ease); pointer-events: none;
}
/* Spotlight only when the cursor is actually inside the thumb area,
   set by JS via the .is-spot-active class. Disappears smoothly otherwise. */
.work-thumb.is-spot-active::after { opacity: 1; }
.work-card:hover .work-logo { transform: scale(1.04); }
.work-logo { transition: transform 0.5s var(--ease); }
.work-thumb {
  height: 180px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--surface-2), var(--bg-soft));
  position: relative; overflow: hidden;
}
.work-card[data-accent="1"] .work-thumb { background: linear-gradient(135deg, #d7e3da, #c3d4c8); }
.work-card[data-accent="2"] .work-thumb { background: linear-gradient(135deg, #e6dcc6, #d9c7a8); }
.work-card[data-accent="3"] .work-thumb { background: linear-gradient(135deg, #cfddd6, #dfcfae); }
[data-theme="dark"] .work-card[data-accent="1"] .work-thumb { background: linear-gradient(135deg, #2e3b32, #26312a); }
[data-theme="dark"] .work-card[data-accent="2"] .work-thumb { background: linear-gradient(135deg, #38362b, #2c2a22); }
[data-theme="dark"] .work-card[data-accent="3"] .work-thumb { background: linear-gradient(135deg, #2b3a33, #322f25); }
.work-logo {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
  color: var(--ink); opacity: 0.55; letter-spacing: -0.01em;
}

/* ---------- Brand logos (real SVGs, monochrome via currentColor) ---------- */
.brand-logo { display: inline-flex; line-height: 0; }
.work-logo svg,
.cs-cover-logo svg {
  display: block; height: auto; fill: currentColor;
}
.work-logo svg { width: clamp(140px, 42vw, 190px); }
.cs-cover-logo svg { width: clamp(200px, 46vw, 320px); }
/* Logos read a touch stronger than the decorative text names */
.work-logo:has(svg) { opacity: 0.7; }
.cs-cover-logo:has(svg) { opacity: 0.62; }

.work-body { padding: 26px 24px 28px; }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.work-tags span {
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft);
}
.work-body h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; margin-bottom: 10px; }
.work-body p { color: var(--ink-soft); font-size: 0.96rem; margin-bottom: 18px; }
.work-link { font-weight: 600; font-size: 0.92rem; color: var(--accent); transition: gap 0.2s; }
.work-card:hover .work-link { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Expertise ---------- */
.exp-grid { display: grid; gap: 18px; }
.exp-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.exp-card:hover { transform: translateY(-4px); border-color: var(--sage); }
.exp-icon {
  font-size: 1.8rem; color: var(--accent); margin-bottom: 16px;
  width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--surface-2); border-radius: 16px;
}
.exp-card h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; margin-bottom: 8px; }
.exp-card p { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-inner { max-width: 620px; margin: 0 auto; }
.contact .section-tag { display: inline-block; }
.contact-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.08; letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.contact-lead { color: var(--ink-soft); font-size: 1.1rem; margin-bottom: 32px; }
.socials {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 12px; margin-top: 36px;
}
.social-pill {
  --mx: 0px; --my: 0px; --lift: 0px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 0.95rem; color: var(--ink);
  transform: translate3d(var(--mx), calc(var(--my) + var(--lift)), 0);
  transition: transform 0.5s var(--ease), border-color 0.3s var(--ease),
              background 0.3s var(--ease), color 0.3s var(--ease);
  will-change: transform;
}
.social-pill svg {
  width: 20px; height: 20px; flex-shrink: 0;
  color: var(--ink-soft);
  shape-rendering: geometricPrecision;
  transform: translateZ(0); /* steady GPU layer, avoids fuzzy edges */
  transition: color 0.3s var(--ease);
}
.social-pill:hover {
  border-color: var(--sage); background: var(--surface-2);
  color: var(--accent); --lift: -2px;
}
.social-pill:hover svg { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; }
.footer-inner {
  display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center;
  font-size: 0.86rem; color: var(--muted);
}
.footer-copy { white-space: nowrap; }
.footer-quote {
  margin: 0;
  display: flex; align-items: baseline;
  justify-content: center; gap: 8px;
  flex-wrap: nowrap;
  min-width: 0; max-width: 100%;
  animation: quoteIn 0.9s var(--ease) both;
}
.footer-quote .quote-text {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.4;
  white-space: nowrap;
}
.footer-quote .quote-by {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Narrow screens: let the quote wrap so nothing gets cut off */
@media (max-width: 639px) {
  .footer-quote { flex-wrap: wrap; }
  .footer-quote .quote-text { white-space: normal; }
}
@keyframes quoteIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .footer-quote { animation: none; }
}

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============================================
   RESPONSIVE - tablet & desktop
   ============================================ */
@media (min-width: 600px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .exp-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 860px) {
  .section { padding: 110px 0; }
  .nav-links { display: flex; }
  .menu-toggle { display: none; }
  .hero { padding: 90px 0 80px; }
  .about-inner { grid-template-columns: 360px 1fr; gap: 80px; align-items: center; }
  .photo-frame { width: 360px; height: 440px; }
  .work-grid { grid-template-columns: repeat(3, 1fr); }

  /* Bento grid: 4 card su griglia 3x2 asimmetrica.
     La prima e l'ultima "respirano" di più (span 2), le altre restano compatte.
     Per aggiungere una card basta appendere un .exp-card: le regole nth-child
     valgono solo per il layout a 4. */
  .exp-grid { grid-template-columns: repeat(3, 1fr); }
  .exp-card:nth-child(1),
  .exp-card:nth-child(4) { grid-column: span 2; }
  .exp-card:nth-child(1) h3,
  .exp-card:nth-child(4) h3 { font-size: 1.5rem; }
  .exp-card:nth-child(1),
  .exp-card:nth-child(4) { padding: 38px 34px; }
}

@media (min-width: 1024px) {
  .container { padding: 0 32px; }
  .footer-inner { flex-direction: row-reverse; justify-content: space-between; gap: 24px; text-align: left; }
  .footer-quote { justify-content: flex-end; text-align: right; }
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Smooth scroll anchor offset under sticky header */
section[id] { scroll-margin-top: 80px; }

/* Custom cursor - dot + ring with theme-aware blend modes
   Light theme uses multiply + ink (darkens the area beneath -> always visible
   on cream and on medium-luminance sage buttons).
   Dark theme uses difference + white (the classic auto-inverting cursor).
   Different math, same goal: keep contrast high against any background. */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 0.3s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
  will-change: transform;
}
.cursor-dot.is-active,
.cursor-ring.is-active { opacity: 1; }

.cursor-dot {
  width: 7px; height: 7px;
  margin-left: -3.5px; margin-top: -3.5px;
  background: #2d3a33;
}
.cursor-ring {
  width: 36px; height: 36px;
  margin-left: -18px; margin-top: -18px;
  border: 1.5px solid #2d3a33;
}
/* Hover state on interactives: ring grows + fills slightly */
.cursor-ring.is-hover { background: rgba(45, 58, 51, 0.10); }
/* Click feedback: ring fills more */
.cursor-ring.is-click { background: rgba(45, 58, 51, 0.28); }

/* Dark theme: flip to difference + white */
[data-theme="dark"] .cursor-dot,
[data-theme="dark"] .cursor-ring { mix-blend-mode: difference; }
[data-theme="dark"] .cursor-dot { background: #ffffff; }
[data-theme="dark"] .cursor-ring { border-color: #ffffff; }
[data-theme="dark"] .cursor-ring.is-hover { background: rgba(255, 255, 255, 0.10); }
[data-theme="dark"] .cursor-ring.is-click { background: rgba(255, 255, 255, 0.28); }

/* Hide the OS cursor while the custom cursor is active */
html.has-custom-cursor,
html.has-custom-cursor * { cursor: none !important; }

/* Disable on touch / coarse pointer / reduced motion */
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-dot, .cursor-ring { display: none; }
  html.has-custom-cursor,
  html.has-custom-cursor * { cursor: auto !important; }
}

/* Subtle grain texture to remove "flat" feel */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  z-index: 90; opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] body::after { opacity: 0.08; mix-blend-mode: overlay; }

/* Brand becomes magnetic too */
.brand {
  --mx: 0px; --my: 0px;
  transform: translate3d(var(--mx), var(--my), 0);
  transition: transform 0.5s var(--ease);
}

/* Nav underline: open from center, more refined */
.nav-links a::after {
  left: 50%; right: 50%; width: auto;
  transition: left 0.3s var(--ease), right 0.3s var(--ease);
}
.nav-links a:hover::after { left: 0; right: 0; width: auto; }

/* Hero title - word-by-word reveal (used on home hero AND on case study hero) */
.hero-title .word,
.cs-title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em);
  filter: blur(6px);
  animation: wordIn 0.9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}
@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Subtle scale on metric numbers when counted in */
.meta-num { transition: color 0.3s var(--ease); }
.meta-num.counted { color: var(--accent); animation: numPulse 0.45s var(--ease); }
@keyframes numPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* View Transitions (Chrome/Edge) for theme toggle */
@supports (view-transition-name: root) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.5s;
    animation-timing-function: var(--ease);
  }
}

/* Section title - micro shimmer on enter */
.section-title.visible { animation: titleIn 0.9s var(--ease) both; }
@keyframes titleIn {
  from { opacity: 0; transform: translateY(20px); letter-spacing: -0.04em; }
  to   { opacity: 1; transform: none; letter-spacing: -0.02em; }
}

/* Exp card icon: gentle float on hover */
.exp-card { transition: transform 0.4s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease); }
.exp-card .exp-icon { transition: transform 0.5s var(--ease), background 0.3s var(--ease); }
.exp-card:hover .exp-icon { transform: translateY(-3px) rotate(-6deg); background: color-mix(in srgb, var(--sage) 22%, var(--surface-2)); }

/* Work card link arrow glides on hover */
.work-link { display: inline-flex; align-items: center; gap: 6px; transition: gap 0.3s var(--ease), color 0.2s var(--ease); }
.work-card:hover .work-link { gap: 12px; }

/* Marquee gradient fade on edges */
.marquee { position: relative; }
.marquee::before, .marquee::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 80px; pointer-events: none; z-index: 2;
}
.marquee::before { left: 0; background: linear-gradient(to right, var(--bg-soft), transparent); }
.marquee::after  { right: 0; background: linear-gradient(to left,  var(--bg-soft), transparent); }

/* ============================================
   CASE STUDY PAGE
   ============================================ */

/* Card lavori ora è un <a> - toglie underline e mantiene il colore inerit */
a.work-card { text-decoration: none; color: inherit; display: block; }
a.work-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.cs-page { padding-bottom: 96px; }

.cs-back {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 28px 0 8px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: gap 0.3s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.cs-back:hover { gap: 14px; color: var(--ink); border-color: var(--sage); }
.cs-back-arrow { color: var(--accent); }

/* Hero */
.cs-hero { padding: 32px 0 40px; position: relative; }
.cs-num-badge {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 3.4rem); line-height: 1;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink-soft);
  text-stroke: 1px var(--ink-soft);
  opacity: 0.55;
  margin-bottom: 28px;
}
.cs-hero .cs-eyebrow {
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 22px;
}
.cs-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1.05; letter-spacing: -0.02em;
  margin-bottom: 22px;
  color: var(--ink);
}
.cs-tagline {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 720px;
  line-height: 1.5;
  margin-bottom: 26px;
}
.cs-tags-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 36px;
}
.cs-tag-chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.cs-tag-chip:hover { border-color: var(--sage); color: var(--accent); }
.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 32px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.cs-meta > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cs-meta dt {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin: 0;
}
.cs-meta dd { margin: 0; font-size: 0.95rem; color: var(--ink); font-weight: 500; line-height: 1.4; }

/* Cover with animated mesh blobs */
.cs-cover {
  height: 340px; margin: 28px 0 64px;
  display: grid; place-items: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface-2), var(--bg-soft));
  position: relative; overflow: hidden;
  isolation: isolate;
}
.cs-cover[data-accent="1"] { background: linear-gradient(135deg, #d7e3da, #c3d4c8); }
.cs-cover[data-accent="2"] { background: linear-gradient(135deg, #e6dcc6, #d9c7a8); }
.cs-cover[data-accent="3"] { background: linear-gradient(135deg, #cfddd6, #dfcfae); }
[data-theme="dark"] .cs-cover[data-accent="1"] { background: linear-gradient(135deg, #2e3b32, #26312a); }
[data-theme="dark"] .cs-cover[data-accent="2"] { background: linear-gradient(135deg, #38362b, #2c2a22); }
[data-theme="dark"] .cs-cover[data-accent="3"] { background: linear-gradient(135deg, #2b3a33, #322f25); }
.cs-cover-blob {
  position: absolute; pointer-events: none;
  border-radius: 50%;
  filter: blur(48px);
  z-index: 0;
}
.cs-cover-blob-a {
  width: 60%; height: 100%;
  top: -25%; left: -10%;
  background: rgba(255, 255, 255, 0.35);
  animation: blobA 14s ease-in-out infinite;
}
.cs-cover-blob-b {
  width: 50%; height: 90%;
  bottom: -30%; right: -10%;
  background: rgba(255, 255, 255, 0.22);
  animation: blobB 18s ease-in-out infinite;
}
[data-theme="dark"] .cs-cover-blob-a { background: rgba(143, 174, 152, 0.28); }
[data-theme="dark"] .cs-cover-blob-b { background: rgba(217, 199, 168, 0.20); }
@keyframes blobA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(20%, 15%) scale(1.15); }
}
@keyframes blobB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-15%, -10%) scale(0.9); }
}
@media (prefers-reduced-motion: reduce) {
  .cs-cover-blob-a, .cs-cover-blob-b { animation: none; }
}

/* ============================================
   FREDUX 2026 — editorial design practice
   A sharper, more personal layer over the original system.
   ============================================ */

:root {
  --bg: #f3f0e8;
  --bg-soft: #e9e4d8;
  --surface: #faf8f2;
  --surface-2: #e7e1d4;
  --ink: #111815;
  --ink-soft: #3f4a44;
  --muted: #646e67;
  --line: #cfc9bc;
  --sage: #8aa182;
  --sage-deep: #223a2f;
  --sand: #e7d5aa;
  --sand-deep: #9e7a32;
  --acid: #c8f454;
  --coral: #ff735c;
  --accent: #223a2f;
  --accent-text: #365600;
  --accent-ui: #365600;
  --glow: rgba(200, 244, 84, 0.24);
  --glow-2: rgba(255, 115, 92, 0.16);
  --shadow-sm: 0 2px 0 rgba(17, 24, 21, 0.12);
  --shadow-md: 0 14px 40px rgba(17, 24, 21, 0.10);
  --shadow-lg: 0 24px 70px rgba(17, 24, 21, 0.16);
  --radius: 8px;
  --radius-lg: 14px;
  --maxw: 1240px;
}

[data-theme="dark"] {
  --bg: #0d1210;
  --bg-soft: #111814;
  --surface: #151d19;
  --surface-2: #1a241f;
  --ink: #f0eee6;
  --ink-soft: #bdc6bf;
  --muted: #849087;
  --line: #2b3730;
  --sage: #a8bea2;
  --sage-deep: #d7e8d4;
  --sand: #e5d19e;
  --sand-deep: #e4bf67;
  --acid: #d0fb5d;
  --coral: #ff806c;
  --accent: #d0fb5d;
  --accent-text: #d0fb5d;
  --accent-ui: #d0fb5d;
  --glow: rgba(208, 251, 93, 0.18);
  --glow-2: rgba(255, 128, 108, 0.12);
}

body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 25%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 20%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
  /* A real page inset keeps the sticky navigation at the same distance from
     the viewport before and after it becomes sticky. */
  --nav-edge-gap: 12px;
  --nav-shell-height: 62px;
  padding-top: var(--nav-edge-gap);
}

.section { padding: clamp(96px, 12vw, 168px) 0; }

.site-header {
  top: var(--nav-edge-gap);
  margin: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  isolation: isolate;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 24%, transparent),
    0 8px 24px rgba(17, 24, 21, 0.07);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 28%, transparent),
    0 12px 34px rgba(17, 24, 21, 0.16);
}
.nav-inner { position: relative; z-index: 1; height: 60px; }

/* Liquid-glass layer kept separate from the sticky element. The rounded
   clip prevents Safari from painting a rectangular backdrop around the pill. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header,
  .site-header.scrolled { background: transparent; }

  .site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    clip-path: inset(0 round 999px);
    background:
      linear-gradient(115deg,
        color-mix(in srgb, white 14%, transparent),
        transparent 34%,
        color-mix(in srgb, var(--accent) 5%, transparent) 72%,
        color-mix(in srgb, white 9%, transparent)),
      color-mix(in srgb, var(--bg) 58%, transparent);
    backdrop-filter: blur(20px) saturate(1.45) contrast(1.04);
    -webkit-backdrop-filter: blur(20px) saturate(1.45) contrast(1.04);
    transform: translateZ(0);
    transition: background 0.3s var(--ease);
  }

  .site-header.scrolled::before {
    background:
      linear-gradient(115deg,
        color-mix(in srgb, white 16%, transparent),
        transparent 34%,
        color-mix(in srgb, var(--accent) 6%, transparent) 72%,
        color-mix(in srgb, white 10%, transparent)),
      color-mix(in srgb, var(--bg) 68%, transparent);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .site-header.scrolled { background: var(--bg); }
  .site-header::before { display: none; }
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding-bottom: 2px;
  color: #111815;
  background: var(--acid);
  border: 1px solid color-mix(in srgb, var(--ink) 72%, transparent);
  border-radius: 50%;
  line-height: 1;
  transform: translateY(-1px);
}
.brand:hover .brand-mark { transform: translateY(-1px) rotate(180deg); }
.brand-name { font-size: 1.18rem; }

.hero {
  /* The hero starts at the actual viewport edge and passes behind the sticky
     header. This keeps its grid and aurora continuous around the navbar. */
  min-height: 100svh;
  display: grid;
  align-items: center;
  margin-top: calc(0px - var(--nav-shell-height) - var(--nav-edge-gap));
  padding: calc(clamp(54px, 8vw, 112px) + var(--nav-shell-height) + var(--nav-edge-gap)) 0 72px;
}
.hero::after {
  content: 'FREDUX / DESIGN PRACTICE / 2026';
  position: absolute;
  left: 22px;
  bottom: 16px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.hero-inner {
  display: grid;
  gap: 54px;
  align-items: center;
}
.hero-copy { position: relative; z-index: 3; }
.hero-title {
  font-size: clamp(3.4rem, 13vw, 8.6rem);
  line-height: 0.83;
  letter-spacing: -0.065em;
  max-width: 880px;
  margin-bottom: 34px;
}
.hero-title .accent {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-ui);
  text-decoration-thickness: 0.16em;
  text-underline-offset: -0.05em;
  text-decoration-skip-ink: none;
}
.hero-eyebrow { color: var(--ink-soft); }
.hero-lead { max-width: 610px; font-size: clamp(1.08rem, 2vw, 1.32rem); }
.avail-badge {
  border-color: color-mix(in srgb, var(--ink) 72%, transparent);
  background: var(--acid);
  color: #111815;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--ink) 82%, transparent);
}
.avail-dot { background: #111815; }
.hero-meta {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  max-width: 640px;
}
.meta-num { font-family: var(--font-display); font-size: 1.8rem; }

.hero-portrait {
  position: relative;
  width: min(100%, 520px);
  justify-self: center;
  isolation: isolate;
}
.portrait-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--ink);
  border-radius: 48% 48% 18px 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(208,251,93,.58), transparent 36%),
    var(--surface-2);
  box-shadow: 12px 12px 0 var(--acid), 13px 13px 0 var(--ink);
}
.portrait-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 62%, rgba(13,18,16,.24));
  pointer-events: none;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  filter: saturate(.78) contrast(1.05);
  transform: scale(1.025);
}
.portrait-orbit {
  position: absolute;
  inset: -24px;
  z-index: -1;
  border: 1px dashed var(--muted);
  border-radius: 50%;
  animation: orbitSpin 28s linear infinite;
}
.portrait-orbit span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--bg);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .08em;
  animation: orbitCounterSpin 28s linear infinite;
}
.portrait-orbit span:nth-child(1) { left: 4%; top: 18%; }
.portrait-orbit span:nth-child(2) { right: 1%; top: 36%; }
.portrait-orbit span:nth-child(3) { left: 18%; bottom: -2%; }
.portrait-note {
  position: absolute;
  z-index: 4;
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: 5px 5px 0 var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity .28s var(--ease),
    visibility .28s var(--ease),
    transform .38s var(--ease);
}
.portrait-note-top {
  top: 12%;
  left: -24px;
  max-width: 220px;
  padding: 14px 16px;
  transform: translate3d(-18px, 8px, 0) rotate(-4deg) scale(.96);
}
.portrait-note-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.portrait-note-top strong { font-size: .9rem; line-height: 1.25; }
.portrait-note-bottom {
  right: -22px;
  bottom: 10%;
  display: flex;
  gap: 7px;
  padding: 9px 12px;
  background: var(--coral);
  color: #111815;
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .08em;
  transform: translate3d(18px, 8px, 0) rotate(4deg) scale(.96);
}
@media (hover: hover) and (pointer: fine) {
  .hero-portrait:hover .portrait-note {
    opacity: 1;
    visibility: visible;
  }
  .hero-portrait:hover .portrait-note-top {
    transform: translate3d(0, 0, 0) rotate(-2deg) scale(1);
  }
  .hero-portrait:hover .portrait-note-bottom {
    transform: translate3d(0, 0, 0) rotate(2deg) scale(1);
  }
}
@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes orbitCounterSpin { to { transform: rotate(-360deg); } }

.marquee {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  transform: rotate(-1deg) scale(1.02);
}
.marquee-track span:nth-child(4n + 1) { color: var(--accent-text); }

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: .72rem;
  letter-spacing: .16em;
}
.section-tag::before { content: '✦'; color: var(--accent); }
.section-title { font-size: clamp(2.6rem, 7vw, 5.8rem); line-height: .98; letter-spacing: -.045em; }

.about { background: color-mix(in srgb, var(--surface) 88%, transparent); }
.about-inner { align-items: stretch; }
.method-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid var(--ink);
  background: var(--acid);
  color: #111815;
  box-shadow: 9px 9px 0 var(--ink);
  transform: rotate(-1deg);
}
.method-kicker {
  margin-bottom: 34px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.method-list { display: grid; gap: 0; }
.method-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 15px 0;
  border-top: 1px solid rgba(17,24,21,.45);
}
.method-list li span { font-size: .66rem; font-weight: 800; }
.method-list li strong { font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 1.65rem); line-height: 1.08; }
.method-foot { margin-top: auto; padding-top: 32px; font-size: .88rem; font-weight: 600; }
.about-text p:not(.section-tag) { font-size: 1.06rem; }

.work-grid { gap: 18px; }
.work-card {
  position: relative;
  border-color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 18%, transparent);
  overflow: visible;
}
.work-card:hover { border-color: var(--ink); box-shadow: 9px 9px 0 var(--acid); }
.work-index {
  position: absolute;
  top: -13px;
  right: 14px;
  z-index: 5;
  min-width: 42px;
  padding: 5px 8px;
  border: 1px solid var(--ink);
  background: var(--surface);
  font-family: var(--font-display);
  text-align: center;
  transform: rotate(3deg);
}
.work-thumb { position: relative; overflow: hidden; }
.work-thumb::before,
.cs-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 34%, transparent 0 8%, rgba(255,255,255,.26) 8.3% 8.8%, transparent 9.1%),
    repeating-linear-gradient(125deg, transparent 0 18px, rgba(17,24,21,.07) 19px 20px);
}
.work-logo { position: relative; z-index: 2; }
.work-body h3 { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1; }
.work-link { color: var(--ink); font-weight: 750; }

.exp-grid { gap: 1px; background: var(--ink); border: 1px solid var(--ink); }
.exp-card {
  min-height: 250px;
  border: 0;
  border-radius: 0;
  padding: 30px;
  background: var(--surface);
}
.exp-card:hover { transform: none; border-color: transparent; background: var(--acid); color: #111815; }
.exp-card:hover p { color: #27312c; }
.exp-icon { font-size: 2.4rem; }

.contact { padding-bottom: 72px; }
.contact-inner {
  max-width: 980px;
  padding: clamp(42px, 8vw, 94px);
  border: 1px solid #111815;
  background: #111815;
  color: #f3f0e8;
  box-shadow: 12px 12px 0 var(--acid);
}
.contact-title { font-size: clamp(3.2rem, 10vw, 8rem); line-height: .82; letter-spacing: -.06em; }
.contact-lead { color: #c3cbc5; }
.contact .section-tag,
.contact .section-tag::before { color: #d0fb5d; }
.contact .social-pill {
  border-color: #f3f0e8;
  background: #f3f0e8;
  color: #111815;
}
.contact .social-pill svg { color: #3f4a44; }
.contact .social-pill:hover {
  background: #d0fb5d;
  border-color: #d0fb5d;
  color: #111815;
}
.contact .social-pill:hover svg { color: #111815; }

.site-footer { border-top-color: var(--ink); }
.footer-copy { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }

/* Case studies — less presentation deck, more editorial story. */
.cs-back { border-radius: 999px; }
.cs-hero { padding-top: 64px; }
.cs-title { font-size: clamp(3.2rem, 10vw, 7.8rem); line-height: .86; letter-spacing: -.055em; max-width: 980px; }
.cs-tagline { max-width: 800px; font-size: clamp(1.12rem, 2vw, 1.5rem); }
.cs-num-badge { color: var(--accent); opacity: 1; }
.cs-meta { border-color: var(--ink); }
.cs-cover { border: 1px solid var(--ink); border-radius: var(--radius); box-shadow: 9px 9px 0 var(--ink); }
.cs-content { max-width: 840px; }
.cs-section { padding: clamp(44px, 7vw, 76px) 0; }
.cs-section h2 { font-size: clamp(2rem, 5vw, 3.8rem); letter-spacing: -.035em; }
.cs-section p { font-size: clamp(1.04rem, 1.7vw, 1.2rem); line-height: 1.78; }
.cs-pull-quote { border-color: var(--ink); }
.cs-pull-quote::before { color: var(--accent-text); }
.cs-pull-quote p { font-size: clamp(1.9rem, 5vw, 3.7rem); line-height: 1.05; }
.cs-gallery { gap: 10px; }
.cs-gallery-item { border-color: var(--ink); border-radius: var(--radius); }
.cs-device-screen {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.cs-device-screen::before {
  content: attr(data-label);
  position: relative;
  z-index: 3;
  padding: 8px 11px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.artifact-line { position: absolute; z-index: 2; height: 1px; background: currentColor; opacity: .4; transform-origin: left center; }
.artifact-line-a { width: 75%; transform: rotate(26deg); }
.artifact-line-b { width: 62%; transform: rotate(-31deg); }
.artifact-node { position: absolute; z-index: 2; width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; opacity: .6; }
.artifact-node-a { left: 12%; top: 16%; }
.artifact-node-b { right: 10%; bottom: 12%; }
.cs-gallery-caption { font-style: normal; letter-spacing: .04em; }
.cs-takeaways li { border-color: var(--ink); border-radius: 0; }

/* Visual QA fixes — marquee, portrait hover and project cards. */
.marquee {
  border-color: #111815;
  background: #111815;
  color: #f3f0e8;
}
.marquee-track { color: #f3f0e8; }
.marquee-track span:nth-child(even),
.marquee-track span:nth-child(4n + 1) { color: var(--accent-text); }

.portrait-note-top {
  top: auto;
  bottom: 24%;
  left: -28px;
}

.work-card {
  border-radius: 8px;
  overflow: hidden;
}
.work-index {
  top: 14px;
  right: 14px;
  border-radius: 4px;
  box-shadow: none;
  transform: none;
}
.work-thumb,
.work-body { border-radius: 0; }

.work-thumb::before,
.work-thumb::after,
.cs-cover::before { display: none; }

.avail-badge {
  cursor: default;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--acid);
}
.avail-badge:hover {
  background: var(--acid);
  color: #111815;
  border-color: #111815;
}
.avail-badge .avail-dot,
.avail-badge:hover .avail-dot { background: currentColor; }

@media (min-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1.16fr) minmax(330px, .84fr); gap: 54px; }
  .hero-title { font-size: clamp(5rem, 8.8vw, 8.5rem); }
  .about-inner { grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr); gap: clamp(64px, 9vw, 130px); }
  .work-grid { grid-template-columns: repeat(12, 1fr); }
  .work-card:nth-child(1) { grid-column: span 7; }
  .work-card:nth-child(2) { grid-column: span 5; }
  .work-card:nth-child(3) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
  }
  .work-card:nth-child(3) .work-thumb { min-height: 100%; }
  .exp-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 859px) {
  .hero-portrait { width: min(82%, 460px); }
  .portrait-note-top { left: -12%; }
  .portrait-note-bottom { right: -12%; }
}

@media (max-width: 599px) {
  body { --nav-edge-gap: 8px; }
  .site-header { margin-inline: 8px; }
  .nav-inner { padding-inline: 14px; }
  .brand-name { display: none; }
  .hero-title { font-size: clamp(3.45rem, 17vw, 5.6rem); }
  .hero-portrait { width: 84%; }
  .portrait-note-top { left: -8%; max-width: 175px; }
  .portrait-note-bottom { right: -8%; }
  .portrait-orbit { inset: -16px; }
  .method-card { box-shadow: 6px 6px 0 var(--ink); }
  .contact-inner { box-shadow: 7px 7px 0 var(--acid); }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-orbit,
  .portrait-orbit span { animation: none; }
}
.cs-cover-logo {
  font-family: var(--font-display); font-size: clamp(2.4rem, 7vw, 4rem); font-weight: 500;
  color: var(--ink); opacity: 0.5; letter-spacing: -0.01em;
  position: relative; z-index: 1;
}

/* Content */
.cs-content { max-width: 760px; margin: 0 auto; }
.cs-section { padding: 28px 0; }
.cs-section + .cs-section { border-top: 1px solid var(--line); }
.cs-section h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--ink);
}
.cs-section p {
  font-size: 1.05rem; line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.cs-section p:last-child { margin-bottom: 0; }

/* Process - vertical timeline */
.cs-process {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 32px;
  position: relative;
}
.cs-process::before {
  content: ''; position: absolute;
  left: 22px; top: 22px; bottom: 22px;
  width: 1px;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--sage) 40%, transparent) 0%,
    var(--line) 100%);
  z-index: 0;
}
.cs-process li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  align-items: start;
  position: relative;
}
.cs-step-num {
  position: relative; z-index: 1;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  letter-spacing: 0;
}
.cs-process h3 {
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
  padding-top: 10px;
}
.cs-process p { font-size: 0.98rem; line-height: 1.6; margin: 0; }

/* Metrics block */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
.cs-metric { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cs-metric-num {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1;
  color: var(--accent);
}
.cs-metric-label {
  font-size: 0.82rem; color: var(--muted);
  line-height: 1.35;
}

/* Pull quote - editorial breather between sections */
.cs-pull-quote {
  margin: 72px 0;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  position: relative;
}
.cs-pull-quote::before {
  content: '\201C';
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 500; line-height: 1;
  color: var(--accent);
  opacity: 0.55;
}
.cs-pull-quote p {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.45;
  color: var(--ink);
  max-width: 680px;
  margin: 16px auto 0;
}

/* Gallery - placeholder device frames */
.cs-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin: 18px 0 14px;
}
.cs-gallery-item {
  margin: 0;
  display: flex; flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
  aspect-ratio: 4 / 3;
}
.cs-gallery-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.cs-device-chrome {
  flex: 0 0 auto;
  height: 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px;
}
.cs-device-chrome span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
}
.cs-device-screen {
  flex: 1 1 auto;
  background: linear-gradient(135deg, var(--surface-2), var(--bg-soft));
  position: relative;
}
.cs-gallery-item[data-accent="1"] .cs-device-screen { background: linear-gradient(135deg, #d7e3da, #c3d4c8); }
.cs-gallery-item[data-accent="2"] .cs-device-screen { background: linear-gradient(135deg, #e6dcc6, #d9c7a8); }
.cs-gallery-item[data-accent="3"] .cs-device-screen { background: linear-gradient(135deg, #cfddd6, #dfcfae); }
[data-theme="dark"] .cs-gallery-item[data-accent="1"] .cs-device-screen { background: linear-gradient(135deg, #2e3b32, #26312a); }
[data-theme="dark"] .cs-gallery-item[data-accent="2"] .cs-device-screen { background: linear-gradient(135deg, #38362b, #2c2a22); }
[data-theme="dark"] .cs-gallery-item[data-accent="3"] .cs-device-screen { background: linear-gradient(135deg, #2b3a33, #322f25); }
.cs-gallery-caption {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 0;
  font-style: italic;
}

/* Takeaways - scannable bullet learnings */
.cs-takeaways {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px;
}
.cs-takeaways li {
  position: relative;
  padding: 14px 16px 14px 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.98rem; line-height: 1.5;
  color: var(--ink);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.cs-takeaways li::before {
  content: '✦';
  position: absolute;
  left: 18px; top: 14px;
  color: var(--accent);
  font-size: 0.9rem;
}
.cs-takeaways li:hover { border-color: var(--sage); transform: translateX(2px); }

/* Case study navigation (prev / next) at the bottom */
.cs-next-section { padding: 80px 0 0; }
.cs-nav-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
}
.cs-nav-item {
  display: flex; flex-direction: column;
  min-width: 0;
}
.cs-nav-eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.cs-nav-card.work-card { width: 100%; max-width: none; }

/* Single card - centered, comfortable width */
.cs-nav-grid[data-count="1"] .cs-nav-item {
  width: 100%;
  max-width: 480px;
}

/* Two cards - side by side, close together */
.cs-nav-grid[data-count="2"] .cs-nav-item {
  flex: 1 1 260px;
  max-width: 360px;
}

/* Stack on mobile when both cards exist */
@media (max-width: 599px) {
  .cs-nav-grid[data-count="2"] .cs-nav-item {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* Mobile adjustments */
@media (max-width: 599px) {
  .cs-meta { grid-template-columns: repeat(2, 1fr); gap: 18px 18px; }
  .cs-metrics { grid-template-columns: 1fr; gap: 18px; padding: 22px; }
  .cs-cover { height: 240px; }
  .cs-process { gap: 24px; }
  .cs-process::before { left: 18px; }
  .cs-process li { grid-template-columns: 40px 1fr; gap: 14px; }
  .cs-step-num { width: 36px; height: 36px; font-size: 0.78rem; }
  .cs-process h3 { padding-top: 6px; }
  .cs-pull-quote { margin: 48px 0; padding: 32px 0; }
  .cs-gallery { grid-template-columns: 1fr; gap: 14px; }
  .cs-gallery-item { aspect-ratio: 16 / 10; }
  .cs-num-badge { font-size: 2rem; margin-bottom: 22px; }
}

/* Reduced motion - kill the lively bits */
@media (prefers-reduced-motion: reduce) {
  .hero-title .word { animation: none; opacity: 1; transform: none; filter: none; }
  .marquee-track { animation: none; }
  .hero-aurora::before, .hero-aurora::after { animation: none; }
  .avail-dot::after { animation: none; }
  .section-title.visible { animation: none; }
  body::after { display: none; }
}

/* Final case-study specificity layer (kept after the renderer's base styles). */
.cs-title {
  max-width: 980px;
  font-size: clamp(3.2rem, 10vw, 7.8rem);
  line-height: .86;
  letter-spacing: -.055em;
}
.cs-tagline { max-width: 800px; font-size: clamp(1.12rem, 2vw, 1.5rem); }
.cs-meta { border-color: var(--ink); }
.cs-cover { border-color: var(--ink); border-radius: var(--radius); box-shadow: 9px 9px 0 var(--ink); }
.cs-content { max-width: 840px; }
.cs-section { padding: clamp(44px, 7vw, 76px) 0; }
.cs-section h2 { font-size: clamp(2rem, 5vw, 3.8rem); letter-spacing: -.035em; }
.cs-section p { font-size: clamp(1.04rem, 1.7vw, 1.2rem); line-height: 1.78; }
.cs-pull-quote { border-color: var(--ink); }
.cs-pull-quote p { font-size: clamp(1.9rem, 5vw, 3.7rem); line-height: 1.05; }
.cs-gallery-item { border-color: var(--ink); border-radius: var(--radius); }
.cs-device-screen { position: relative; overflow: hidden; display: grid; place-items: center; }
.cs-device-screen::before {
  content: attr(data-label);
  position: relative;
  z-index: 3;
  padding: 8px 11px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.artifact-line { position: absolute; z-index: 2; height: 1px; background: currentColor; opacity: .4; transform-origin: left center; }
.artifact-line-a { width: 75%; transform: rotate(26deg); }
.artifact-line-b { width: 62%; transform: rotate(-31deg); }
.artifact-node { position: absolute; z-index: 2; width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; opacity: .6; }
.artifact-node-a { left: 12%; top: 16%; }
.artifact-node-b { right: 10%; bottom: 12%; }
.cs-gallery-caption { font-style: normal; letter-spacing: .04em; }
.cs-takeaways li { border-color: var(--ink); border-radius: 0; }
