/* ==========================================================
   brunoballve.com — design system + shared components
   (nav from direction A, cursor + footer from direction C)
   ========================================================== */
:root {
  --ink: oklch(0.15 0.004 70);
  --ink-2: oklch(0.21 0.005 70);
  --ink-3: oklch(0.27 0.005 70);
  --paper: oklch(0.972 0.004 85);
  --paper-2: oklch(0.93 0.005 85);
  --slab: oklch(0.84 0.004 80);          /* footer slab */
  --mute: oklch(0.5 0.006 70);           /* secondary text on light */
  --mute-d: oklch(0.68 0.006 70);        /* secondary text on dark */
  --soft-d: oklch(0.82 0.004 80);        /* body text on dark */
  --line: rgb(22 21 19 / 0.1);
  --line-d: rgb(255 255 255 / 0.12);
  --accent: #ff2c00;                     /* racing red */

  --f-sans: "Geist", system-ui, sans-serif;
  --f-serif: "DM Serif Display", Georgia, serif;
  --f-mono: "Geist Mono", ui-monospace, monospace;

  --gut: clamp(1rem, 3vw, 2.5rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --slides-left: clamp(0px, 14vw, 240px); /* dark band left of the hero images */
}
@media (max-width: 700px) { :root { --slides-left: 0px; } }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html.lenis, html.lenis body { height: auto; }
body {
  background: var(--ink); color: var(--paper);
  font: 400 clamp(1rem, 0.95rem + 0.2vw, 1.125rem)/1.5 var(--f-sans);
  letter-spacing: -0.01em; overflow-x: hidden;
}
body.is-loading { overflow: hidden; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

[id] { scroll-margin-top: 5.5rem; } /* native anchor jumps stop below the fixed nav */
.is-dark { background: var(--ink); color: var(--paper); }
.is-light { background: var(--paper); color: var(--ink); }
.eyebrow { font: 400 0.75rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--mute); }
.is-dark .eyebrow { color: var(--mute-d); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* split-text masks: padding leaves room for descenders (p, g, j) */
.nw { white-space: nowrap; } /* date ranges: each end on one line (Core.when) */
.ch, .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.ch > span, .w > span { display: inline-block; }

/* ---------- Nav (direction A) ---------- */
:root { --logo-w: clamp(46px, 4vw, 58px); }
.nav {
  position: fixed; inset: 0 0 auto; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: var(--gut); color: #fff; mix-blend-mode: difference;
}
/* the logo: its own fixed link above the nav, so it stays red instead of inverting with it;
   .nav__mark keeps its place in the nav row (same box), so the links line up with it */
.brand { position: fixed; z-index: 61; left: var(--gut); top: var(--gut); display: block; width: var(--logo-w); }
.brand img { width: 100%; height: auto; transition: transform 0.4s var(--ease); }
.brand:hover img { transform: scale(1.06); }
.nav__mark { width: var(--logo-w); aspect-ratio: 777 / 393; flex: none; }
.nav__links { display: flex; gap: 2rem; font-size: 0.9rem; }
.nav__links a, .nav__cta { position: relative; }
.nav__links a::after, .nav__cta::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 0.5s var(--ease);
}
.nav__links a:hover::after, .nav__cta:hover::after, .nav__links a[aria-current]::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { font-size: 0.9rem; }
@media (max-width: 700px) { .nav__links { gap: 1.1rem; } .nav__opt { display: none; } }

/* ---------- Cursor (direction C): trailing dot that inverts what it covers ---------- */
/* only the dot: the system cursor is hidden wherever the dot is running (mouse devices) */
.has-cursor, .has-cursor * { cursor: none !important; }
.cursor {
  position: fixed; z-index: 110; left: 0; top: 0; pointer-events: none; /* above the loader too */
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  transition: width 0.5s var(--ease), height 0.5s var(--ease), margin 0.5s var(--ease), border-radius 0.5s var(--ease),
    background-color 0.3s, box-shadow 0.5s var(--ease), opacity 0.3s;
}
.cursor.is-link { width: 40px; height: 40px; margin: -20px 0 0 -20px; background: #fff; mix-blend-mode: difference; }
.cursor.is-big { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: #fff; mix-blend-mode: difference; }
.cursor__label { font: 500 0.6rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: #000; opacity: 0; transition: opacity 0.2s; white-space: nowrap; }
.cursor.is-big .cursor__label { opacity: 1; transition-delay: 0.12s; }
/* image mode: the cursor becomes a preview of the project you're pointing at */
.cursor__media { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; opacity: 0; transition: opacity 0.3s var(--ease); }
.cursor__media img { transform: scale(1.2); transition: transform 0.8s var(--ease); }
.cursor.is-img { width: 260px; height: 190px; margin: -95px 0 0 28px; border-radius: 8px; background: var(--ink-2); box-shadow: 0 28px 60px -24px rgb(0 0 0 / 0.55); }
.cursor.is-img.is-flip { margin-left: -288px; }
.cursor.is-img .cursor__media { opacity: 1; }
.cursor.is-img .cursor__media img { transform: scale(1); }
.cursor.is-img .cursor__label { opacity: 0; }
.cursor.is-out { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Smart links (names / keywords in text) ---------- */
.smart { background: linear-gradient(color-mix(in oklch, currentColor 38%, transparent), color-mix(in oklch, currentColor 38%, transparent)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 0.04em; transition: color 0.3s var(--ease); }
.smart:hover { color: var(--accent); background-image: linear-gradient(currentColor, currentColor); }
.smart__arrow { display: inline-block; margin-left: 0.12em; font-family: var(--f-sans); font-style: normal; font-size: 0.68em; vertical-align: 0.38em; transition: transform 0.4s var(--ease); }
.smart:hover .smart__arrow { transform: translate(2px, -2px); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.9rem; font-size: 0.85rem; padding: 0.7rem 1rem; border-radius: 4px; background: var(--ink); color: var(--paper); transition: background 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s; }
.btn span { border-left: 1px solid var(--line-d); padding-left: 0.9rem; }
.btn:hover { background: var(--accent); color: var(--ink); }
.btn--ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost span { border-color: var(--line); }
.is-dark .btn--ghost { box-shadow: inset 0 0 0 1px var(--line-d); }
.is-dark .btn--ghost span { border-color: var(--line-d); }
.btn--light { background: var(--paper); color: var(--ink); }
.btn--light span { border-color: var(--line); }
.btn--ghost:hover, .btn--light:hover { background: var(--accent); color: var(--ink); box-shadow: none; }

/* ---------- Footer (direction C) ---------- */
.foot { background: var(--slab); color: var(--ink); padding: clamp(3rem, 6vw, 4rem) var(--gut) 0; overflow: hidden; }
.foot__top { display: grid; grid-template-columns: 1.4fr auto 1fr; gap: 2rem; align-items: start; }
.foot__label { font-size: 0.8rem; opacity: 0.55; margin-bottom: 0.4rem; }
.foot__mail { display: inline-block; font-size: clamp(1.3rem, 2.6vw, 2.2rem); letter-spacing: -0.03em; font-weight: 500;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.6s var(--ease); }
.foot__mail:hover { background-size: 100% 1px; }
.foot__sub { margin-top: 0.4rem; font-size: 0.9rem; opacity: 0.7; }
.foot__star { width: clamp(60px, 7vw, 100px); color: var(--accent); }
.foot__cols { display: flex; gap: 3rem; justify-content: end; font-size: 0.9rem; }
.foot__cols div { display: grid; gap: 0.15rem; align-content: start; }
.foot__cols a { width: fit-content; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.5s var(--ease); }
.foot__cols a:hover { background-size: 100% 1px; }
.foot__legal { display: flex; justify-content: space-between; gap: 1rem; margin-top: clamp(3rem, 6vw, 5rem); font-size: 0.8rem; opacity: 0.6; }
/* sized from the available width so "Bruno Ballvé" runs edge to edge at any screen size */
.foot__word { font-size: min(calc((100vw - 2 * var(--gut)) / 5.3), 24rem); font-weight: 500; letter-spacing: -0.065em; line-height: 0.78; white-space: nowrap; margin: 1rem 0 0 -0.04em; padding-bottom: 0.03em; }
@media (max-width: 800px) { .foot__top { grid-template-columns: 1fr; } .foot__cols { justify-content: start; } }

/* ---------- Placeholder for photos not added yet ---------- */
.ph {
  position: relative; width: 100%; height: 100%; min-height: 200px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.35rem; padding: 1rem; overflow: hidden;
  background-color: color-mix(in oklch, currentColor 5%, transparent);
  background-image:
    linear-gradient(color-mix(in oklch, currentColor 9%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, currentColor 9%, transparent) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  border: 1px dashed color-mix(in oklch, currentColor 28%, transparent);
  font: 500 0.68rem/1.35 var(--f-mono); letter-spacing: 0.05em; text-transform: uppercase; text-align: left;
}
.ph::before { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; translate: -50% -50%; opacity: 0.4;
  background: linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat, linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; }
.ph__path { opacity: 0.55; text-transform: none; letter-spacing: 0; word-break: break-all; }
figure > .ph { height: auto; aspect-ratio: 4 / 3; }

/* Teaser for a project whose visuals aren't ready yet: reads as a design choice, not a missing file */
.teaser { position: relative; width: 100%; height: 100%; min-height: 220px; display: grid; align-content: space-between; gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.75rem); background: var(--ink); color: var(--paper); overflow: hidden; }
.teaser::before { content: ""; position: absolute; inset: 0; opacity: 0.5; pointer-events: none;
  background-image: linear-gradient(var(--line-d) 1px, transparent 1px), linear-gradient(90deg, var(--line-d) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(70% 70% at 70% 30%, #000, transparent); -webkit-mask-image: radial-gradient(70% 70% at 70% 30%, #000, transparent); }
.teaser::after { content: ""; position: absolute; right: clamp(1rem, 2.5vw, 1.75rem); top: clamp(1rem, 2.5vw, 1.75rem); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.teaser__code { position: relative; font-size: clamp(3rem, 9vw, 8rem); font-weight: 500; line-height: 0.85; letter-spacing: -0.05em; }
.teaser__txt { position: relative; font: 400 0.72rem/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute-d); }
figure > .teaser { aspect-ratio: 4 / 3; height: auto; }
.card__img .teaser::after { display: none; } /* the card already shows a "coming soon" badge there */
.pj-cover > .teaser { height: 100%; aspect-ratio: auto; align-content: end; }
.pj-cover > .teaser .teaser__code { font-size: clamp(5rem, 22vw, 22rem); }
.soon-badge { position: absolute; z-index: 3; top: 0.75rem; right: 0.75rem; font: 500 0.65rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.4rem 0.55rem; border-radius: 2px; background: var(--ink); color: var(--paper); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
