/* ==========================================================================
   Nuno Spinola — Portfolio
   Recreation of the Semplice 7 site (nunorspinola.com) in plain HTML/CSS.
   Desktop grid: 1280px content, 12 columns, 32px gutter, 80px side margin.
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face { font-family: "Switzer"; src: url("/assets/fonts/Switzer-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("/assets/fonts/Switzer-Semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("/assets/fonts/CabinetGrotesk-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("/assets/fonts/CabinetGrotesk-Extrabold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --focus: #9dbdf8;   /* keyboard focus ring */
  --ink: #191919;
  --muted: #595959;
  --line: #eeeeee;
  --panel: #f1f1f1;
  --available: #00884d;
  --bg: #ffffff;      /* surface of buttons and other floating controls */
  --page: #f5f5f7;    /* page background */
  --card: #ffffff;    /* References / Experience cards */
  --toggle-bg: #f1f1f1;
  --icon-circle: #ffffff; /* logo circles on the grey page (About) */
  --icon-filter: none;
  color-scheme: light;

  --font-body: "Switzer", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cabinet Grotesk", "Switzer", "Helvetica Neue", Arial, sans-serif;

  --max: 1280px;
  --side: 80px;
  --gap: 32px;
  --nav-h: 88px;
  --section-space: 160px;

  /* type scale (desktop) */
  --t-hero: 64px;
  --t-title: 40px;
  --t-label: 32px;
  --t-lead: 28px;
  --t-list: 24px;
  --t-body: 20px;
  --t-small: 16px;
  --t-meta: 14px;
}

/* Dark theme: chosen via the toggle (data-theme) or, without JS, the system setting */
:root[data-theme="dark"] {
  --focus: #4f82e3;
  --ink: #ededed;
  --muted: #a3a3a3;
  --line: #333333;
  --panel: #1e1e1e;
  --available: #22c55e;
  --bg: #121212;
  --page: #121212;
  --card: #1e1e1e;
  --toggle-bg: #262626;
  --icon-circle: #1b1b1b;
  --icon-filter: invert(1);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --focus: #4f82e3;
    --ink: #ededed;
    --muted: #a3a3a3;
    --line: #333333;
    --panel: #1e1e1e;
    --available: #22c55e;
    --bg: #121212;
    --page: #121212;
    --card: #1e1e1e;
    --toggle-bg: #262626;
    --icon-circle: #1b1b1b;
    --icon-filter: invert(1);
    color-scheme: dark;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }  /* safety net: the page never scrolls sideways */
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}
img, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 1px; }
/* text links get a softly rounded ring; pills and circles keep their own radius */
.nav__logo:focus-visible, .nav__links a:focus-visible, .arrow-link:focus-visible, p a:not(.btn):focus-visible, li a:not(.btn):focus-visible { border-radius: 4px; }
/* skip link: hidden until focused */
.skip-link { position: fixed; left: 16px; top: 12px; z-index: 100; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: 15px; line-height: 1; transform: translateY(-200%); transition: transform .2s ease; }
.skip-link:focus { transform: none; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--max) + var(--side) * 2); margin: 0 auto; padding: 0 var(--side); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.section { padding-top: var(--section-space); }
.section--first { padding-top: 110px; }
main { padding-bottom: 200px; }

/* Column helpers (desktop) */
.c-1-4  { grid-column: 1 / span 4; }
.c-1-2  { grid-column: 1 / span 2; }
.c-1-7  { grid-column: 1 / span 7; }
.c-1-9  { grid-column: 1 / span 9; }
.c-3-5  { grid-column: 3 / span 5; }
.c-8-5  { grid-column: 8 / span 5; }
.c-3-6  { grid-column: 3 / span 6; }
.c-3-7  { grid-column: 3 / span 7; }
.c-3-8  { grid-column: 3 / span 8; }
.c-5-8  { grid-column: 5 / span 8; }
.c-1-5  { grid-column: 1 / span 5; }
.c-7-6  { grid-column: 7 / span 6; }
.c-5-6  { grid-column: 5 / span 6; }
.c-9-4  { grid-column: 9 / span 4; }
.c-10-3 { grid-column: 10 / span 3; }
.c-3-2  { grid-column: 3 / span 2; }
.c-full { grid-column: 1 / -1; }

/* ---------- Typography ---------- */
.t-hero  { font-family: var(--font-display); font-weight: 700; font-size: var(--t-hero); line-height: 1; letter-spacing: 0; }
.t-title { font-family: var(--font-display); font-weight: 700; font-size: var(--t-title); line-height: 1; }
.t-label { font-family: var(--font-display); font-weight: 700; font-size: var(--t-label); line-height: 1.6; margin-top: -9px; }
.t-lead  { font-size: var(--t-lead); line-height: 1.3; }
.t-lead--tight { line-height: 1.2; }
.t-list  { font-size: var(--t-list); line-height: 1.3; }
.t-body  { font-size: var(--t-body); line-height: 1.3; }
.t-meta  { font-size: var(--t-meta); line-height: 1.6; }
.muted   { color: var(--muted); }
.ink     { color: var(--ink); }
.strong  { font-weight: 600; }

.stack > * + * { margin-top: 24px; }
.stack-lg > * + * { margin-top: 32px; }

/* ---------- Text link with arrow ("Let's talk →") ---------- */
.arrow-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: var(--t-small); line-height: 1; letter-spacing: .3px; color: var(--ink);
}
.arrow-link img { width: 20px; height: 20px; transition: transform .25s ease; }
.arrow-link:hover img { transform: translateX(4px); }
.cta { margin-top: 32px; }  /* text → button, same on every page */
.cta--row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h); background: transparent;
  transition: transform .3s ease;
}
/* Frosted header: the blur sits on a pseudo layer, not on .nav itself. A backdrop-filter on .nav would make it the
   containing block for the fixed full-screen mobile menu inside it and squeeze that menu into the bar. */
.nav::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: color-mix(in srgb, var(--page) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nav::before { background: var(--page); } }
.nav.is-hidden { transform: translateY(-100%); }
.nav.is-hidden:focus-within, .nav-pending .nav:focus-within { transform: none; opacity: 1; pointer-events: auto; }
.nav .container { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav__logo { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1; letter-spacing: -0.2px; }
/* Desktop: the logo shows only "N"; the rest of the name slides open on hover or keyboard focus.
   The text stays in the page, so screen readers always hear "Nuno Spinola". */
.nav__logo { display: inline-flex; white-space: nowrap; }
.nav__logo-rest { display: grid; grid-template-columns: 1fr; }
.nav__logo-rest > span { min-width: 0; overflow: hidden; }
@media (min-width: 768px) {
  /* closing (mouse leaves): a little quicker than opening, 0.22s, with a smooth ease-out so it doesn't snap */
  .nav__logo-rest { grid-template-columns: 0fr; opacity: 0; transition: grid-template-columns .22s cubic-bezier(.4, 0, .2, 1), opacity .16s ease .04s; }
  /* opening (hover / focus): 0.27s */
  .nav__logo:hover .nav__logo-rest, .nav__logo:focus-visible .nav__logo-rest { grid-template-columns: 1fr; opacity: 1;
    transition: grid-template-columns .27s cubic-bezier(.2, .7, .2, 1), opacity .17s ease; }
}
@media (prefers-reduced-motion: reduce) { .nav__logo-rest, .nav__logo:hover .nav__logo-rest, .nav__logo:focus-visible .nav__logo-rest { transition: none; } }
.nav__links { display: flex; gap: 24px; }
.nav__links a { font-weight: 600; font-size: 20px; line-height: 1; transition: opacity .2s; }
.nav__links a:hover { opacity: .6; }
.nav__links a[aria-current="page"] { opacity: 1; }
.nav__toggle { display: none; width: 44px; height: 44px; position: relative; border-radius: 50%; background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .1); transition: transform .25s ease, box-shadow .25s ease; }
.nav__toggle:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 18px rgba(0, 0, 0, .14); }
:root[data-theme="dark"] .nav__toggle { background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .5); }
.nav__toggle span { position: absolute; left: 13px; right: 13px; height: 2px; background: var(--ink); transition: transform .3s, top .3s, opacity .2s; }
.nav__toggle span:nth-child(1) { top: 15px; }
.nav__toggle span:nth-child(2) { top: 21px; }
.nav__toggle span:nth-child(3) { top: 27px; }
.nav-open .nav__toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav__toggle span:nth-child(3) { top: 21px; transform: rotate(-45deg); }
.page { padding-top: var(--nav-h); }

/* ---------- Home hero ---------- */
.hero {
  min-height: calc(100vh - var(--nav-h)); min-height: calc(100svh - var(--nav-h)); position: relative;
  /* desktop: centre the hero copy in the full viewport (bottom padding = nav height offsets the fixed nav above) */
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 0; padding-bottom: var(--nav-h);
}
.hero__lead { margin-top: 24px; }
.hero__status { margin-top: 32px; display: flex; align-items: center; gap: 4px; font-size: var(--t-meta); line-height: 1.6; color: var(--muted); }
.hero__status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--available); margin-right: 3px; flex: none; animation: status-pulse 2s ease-out infinite; }
@keyframes status-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 136, 77, .45); }
  70%  { box-shadow: 0 0 0 6px rgba(0, 136, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 136, 77, 0); }
}

/* ---------- Project block (title left, copy right, media below) ---------- */
.project__copy > .t-body { margin-top: 24px; }
.project .cta { margin-top: 32px; }
.project__media { margin-top: 36px; }
.project .chips + .cta { margin-top: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.chip { padding: 12px 16px; border: 1px solid var(--line); border-radius: 100px; font-size: var(--t-meta); line-height: 12px; color: var(--muted); }

/* ---------- Buttons ----------
   Primary pill: ink fill, page-colored label, 48px, lifts on hover.
   Secondary pill (.btn--shadow): same size as primary, page-colored with a thin gray outline, no shadow at rest;
   on hover it lifts with a soft shadow and takes a very light gray tint (4% ink), slightly deeper while pressed (7%). */
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-weight: 600; line-height: 1; letter-spacing: .2px; white-space: nowrap;
  transition: transform .25s ease, box-shadow .25s ease, background-color .3s ease, color .3s ease; }
.btn--primary { height: 48px; padding: 0 24px; font-size: 16px; background: var(--ink); color: var(--bg); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -6px rgba(0, 0, 0, .3); }
.btn--shadow { height: 48px; padding: 0 24px; box-sizing: border-box; font-size: 16px; background: var(--bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--ink) 13%, transparent); }
.btn--shadow:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .22); background-color: color-mix(in srgb, var(--ink) 4%, var(--bg)); }
.btn--shadow:active { background-color: color-mix(in srgb, var(--ink) 7%, var(--bg)); }
.btn:active { transform: translateY(0); transition-duration: .1s; }
:root[data-theme="dark"] .btn--primary:hover { box-shadow: 0 10px 22px -6px rgba(0, 0, 0, .8); }
:root[data-theme="dark"] .btn--shadow:hover { box-shadow: 0 10px 22px -6px rgba(0, 0, 0, .8); }

/* ---------- Media ---------- */
.media { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--panel); }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }

/* Slider */
.slider { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--panel); touch-action: pan-y; }
.slider__track { display: flex; height: 100%; transition: transform .6s cubic-bezier(.65, 0, .35, 1); will-change: transform; }
.slider__slide { flex: 0 0 100%; height: 100%; }
.slider__slide img, .slider__slide video { width: 100%; height: 100%; object-fit: cover; }
.slider__btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; display: grid; place-items: center; opacity: .8; transition: opacity .2s;
}
.slider__btn:hover { opacity: 1; }
.slider__btn svg { width: 28px; height: 28px; }
.slider__btn--prev { left: 13px; }
.slider__btn--next { right: 13px; }
/* gallery arrow styles, per slider via data-btn: shadow circle (circle) or outline circle (ring) */
.slider__btn--circle, .slider__btn--ring { width: 44px; height: 44px; border-radius: 50%; opacity: 1; transition: background-color .2s, box-shadow .25s, margin-top .25s; }
.slider__btn--circle { background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .1); }
.slider__btn--circle:hover { margin-top: -2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 18px rgba(0, 0, 0, .14); }
.slider__btn--ring { border: 1px solid rgba(89, 89, 89, .45); background: rgba(255, 255, 255, .55); }
.slider__btn--ring:hover { background: rgba(255, 255, 255, .9); }
.slider__btn--circle svg, .slider__btn--ring svg { width: 20px; height: 20px; }

/* ---------- References ---------- */
.refs { row-gap: 40px; }
.refs figure, .refs blockquote { margin: 0; }
.ref__quote { font-size: var(--t-lead); line-height: 1.3; }
.ref__by { margin-top: 8px; font-size: var(--t-meta); line-height: 1.43; color: var(--muted); }
.ref__by a { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.ref__by a:hover { text-decoration-thickness: 2px; }
/* References as cards (home): a row that scrolls sideways, first card lined up with the content column,
   later cards run to the edge of the window. Prev / next buttons sit bottom right. */
.refs-section { --refs-inset: max(var(--side), calc((100% - var(--max)) / 2)); }
/* position: relative keeps absolutely positioned bits inside the cards (e.g. the screen-reader "(opens in new tab)" text)
   clipped by the row; without it they escaped and made the whole page scroll sideways on phones */
.refs-track { position: relative; display: flex; gap: 24px; margin-top: 24px; padding: 8px var(--refs-inset) 24px; scroll-padding-inline: var(--refs-inset);
  overflow-x: auto; scroll-snap-type: x proximity; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; }
.refs-track::-webkit-scrollbar { display: none; }
.refs-track:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
/* cards are keyboard focus stops (js/main.js); same ring as the rest of the site, drawn just inside the card
   so the scrolling row can't clip it at its edges */
:is(.ref-card, .home-card):focus-visible { outline: 4px solid var(--focus); outline-offset: -4px; }
.ref-card { flex: 0 0 min(400px, 80vw); min-height: 440px; margin: 0; padding: 40px; box-sizing: border-box; border-radius: 28px;
  display: flex; flex-direction: column; scroll-snap-align: start; background: var(--card);
  transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s ease; }
@media (hover: hover) { .ref-card:hover { transform: scale(1.015); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .18); } }
.ref-card__quote { margin: 0; font-size: 22px; line-height: 1.35; font-weight: 500; }
.ref-card__by { margin-top: auto; padding-top: 32px; font-size: 15px; line-height: 1.43; color: var(--muted); }
.ref-card__by a { display: block; margin-bottom: 2px; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.ref-card__by a:hover { text-decoration-thickness: 2px; }
.refs-nav { display: flex; justify-content: flex-end; gap: 16px; margin-top: 16px; }
.refs-nav[hidden] { display: none; }
.refs-nav__btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: var(--card); color: var(--ink); cursor: pointer; transition: background-color .2s, opacity .2s; }
.refs-nav__btn:hover:not(:disabled) { background: var(--line); }
.refs-nav__btn:disabled { opacity: .35; cursor: default; }
.refs-nav__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Experience cards (home): same card as References; logo, company, role, dates, description */
/* logo on a 56px circle, same treatment as the About page (the SVGs have wide built-in padding, so the image is drawn larger than the circle) */
.job-card__icon { position: relative; display: grid; place-items: center; width: 40px; height: 56px; } /* plain logo, no circle; the box hugs the ~38px logo so it lines up with the text */
.job-card__icon img { position: absolute; width: 110px; height: 110px; max-width: none; filter: var(--icon-filter); }
.job-card__org { margin-top: 24px; font-size: 15px; line-height: 1.43; font-weight: 600; color: var(--muted); }
.job-card__role { margin-top: 4px; font-family: var(--font-display); font-size: 26px; line-height: 1.15; font-weight: 700; }
.job-card__when { margin-top: 8px; font-size: 15px; line-height: 1.43; color: var(--muted); }
.job-card__desc { margin-top: 20px; font-size: 18px; line-height: 1.45; color: var(--muted); }
/* Skills (home): one wrapping row of pills; the first two are solid */
.skill-pills { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; }
.skill-pill { display: inline-flex; align-items: center; height: 44px; padding: 0 22px; box-sizing: border-box; border: 1px solid var(--ink); border-radius: 999px;
  font-size: 17px; line-height: 1; white-space: nowrap; color: var(--ink); }
.skill-pill--head { background: var(--ink); color: var(--page); }
@media (max-width: 767.98px) {
  .skill-pills { gap: 8px; margin-top: 24px; }
  .skill-pill { height: 40px; padding: 0 16px; font-size: 15px; }
}
/* Past life (home) */
.past__text { margin-top: 24px; }
.past__text + .past__text { margin-top: 16px; }
/* Large content cards (home: I’m Nuno, Past life): same surface and corners as the other cards, roomy padding */
.home-card { padding: 64px; border-radius: 28px; background: var(--card); }
.home-card .me-section__card { border-radius: 20px; }
/* in the sideways row each large card is as wide as the content column; the next one peeks in from the right */
/* this row has no heading above it: drop the track’s heading margin and pull up by its 8px hover padding so the gap matches the other sections */
.home-cards .refs-track { margin-top: -8px; }
#work, #about { scroll-margin-top: calc(var(--nav-h) + 24px); }
.refs-track > .home-card { flex: 0 0 100%; box-sizing: border-box; scroll-snap-align: start;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s ease; }
/* same hover as the smaller cards, scaled down so the large card doesn't grow too much */
@media (hover: hover) { .refs-track > .home-card:hover { transform: scale(1.006); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .18); } }
@media (prefers-reduced-motion: reduce) { .refs-track > .home-card { transition: none; } .refs-track > .home-card:hover { transform: none; } }
@media (max-width: 1169.98px) { .home-card { padding: 48px; } }
@media (max-width: 767.98px) { .home-card { padding: 24px; border-radius: 24px; } .home-card .me-section__card { border-radius: 16px; } }
/* TEST (desktop): I’m Nuno photo fills the card from top to bottom on the right and fades into the card on its left */
@media (min-width: 768px) {
  .me-section--bleed { position: relative; overflow: hidden; min-height: 600px; }
  .me-section--bleed .ff-demo__stage { position: absolute; top: 0; right: 0; bottom: 0; width: 52%; margin: 0; display: block; }
  .me-section--bleed .me-section__card { position: absolute; inset: 0; max-width: none; border-radius: 0; background: none; }
  .me-section--bleed .me-section__photo { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: 50% 25%;
    translate: 8% 0; /* the left arm ends ~8% short of the photo’s right edge; this brings it to the card edge */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 45%); mask-image: linear-gradient(to right, transparent, #000 45%); }
}
/* First card in the Experience and References rows: inverted (dark card in light mode, light card in dark mode) */
.refs-track > .ref-card:first-child { background: var(--ink); color: var(--page); }
.refs-track > .ref-card:first-child :is(.job-card__org, .job-card__when, .job-card__desc, .ref-card__by) { color: color-mix(in srgb, var(--page) 72%, var(--ink)); }
.refs-track > .ref-card:first-child .ref-card__by a { color: var(--page); }
.refs-track > .ref-card:first-child .job-card__icon img { filter: invert(1); }
:root[data-theme="dark"] .refs-track > .ref-card:first-child .job-card__icon img { filter: none; }
@media (prefers-reduced-motion: reduce) { .refs-track { scroll-behavior: auto; } .ref-card { transition: none; } .ref-card:hover { transform: none; } }
@media (max-width: 767.98px) {
  .refs-track { gap: 12px; margin-top: 16px; }
  .ref-card { min-height: 380px; padding: 28px; border-radius: 24px; }
  .ref-card__quote { font-size: 20px; }
  .job-card__role { font-size: 22px; }
  .job-card__desc { font-size: 16px; }
}

/* ---------- Intro (I'm Nuno) ---------- */
.intro__photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.intro__more { margin-top: 44px; }
/* I’m Nuno (home): Following Flights layout, copy left, portrait centred in the right 8 columns */
.me-section__grid { align-items: start; }
/* portrait as a card: no inset, same 28px corners as the References / Experience cards, cropped to a 4:5 portrait */
.me-section__card { width: 100%; max-width: 440px; overflow: hidden; border-radius: 28px; background: var(--card); }
.me-section__photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; }
.me-section__cta { margin-top: 32px; }
/* phones: the shared demo layout adds 40px top padding; drop it here so the gap matches the other sections */
@media (max-width: 767.98px) { .me-section__card { max-width: none; border-radius: 24px; } }

/* ---------- About ---------- */
.about-hero { align-items: center; padding-top: 92px; }
.about-hero .t-title { margin-bottom: 4px; }
.about-hero__more { margin-top: 36px; }
.about-hero__photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }

.skills li { font-size: var(--t-lead); line-height: 1.3; }

.jobs { row-gap: 56px; }
.job { display: contents; }
.job__icon { grid-column: 3 / span 2; align-self: start; display: grid; place-items: center; }
/* subtle circle behind each company logo (max 96px) */
.job__icon::before { content: ""; grid-area: 1 / 1; width: 96px; height: 96px; border-radius: 50%; background: var(--icon-circle); transition: background-color .3s ease; }
.job__icon img { grid-area: 1 / 1; position: relative; width: 100%; max-width: 187px; height: auto; aspect-ratio: 1; }
.job__body { grid-column: 5 / span 6; }
.job__org { font-size: 20px; line-height: 1.2; color: var(--muted); }
.job__role { font-family: var(--font-display); font-weight: 700; font-size: var(--t-title); line-height: 1.6; }
.job__when { font-size: 18px; line-height: 1.6; }
.job__desc { margin-top: 8px; font-size: 16px; line-height: 1.36; color: var(--muted); }
.dot-sep { padding: 0 10px; }

.past p + p { margin-top: 24px; }

/* ---------- Contact ---------- */

/* ---------- Case study (Doze) ---------- */
.case-intro { padding-top: 69px; }
.case-intro .t-title { line-height: 1; }
.case-media { margin-top: 136px; }
.case-section { padding-top: 136px; }
.case-section + .case-media, .case-section > .case-media { margin-top: 0; }
.case-block > * + * { margin-top: 28px; }
.case-block h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-label); line-height: 1.6; margin-bottom: -4px; }
.case-block .bullets li { font-size: var(--t-list); line-height: 1.3; }
.case-block .bullets li + li { margin-top: 16px; }
.case-block .group { font-size: var(--t-list); line-height: 1.3; }
.case-block .group + .group { margin-top: 32px; }
.case-block .group__title { font-weight: 600; color: var(--ink); }
.case-block .group li { color: var(--muted); }
.case-figure { margin-top: 56px; }

/* Personas (AirNav Radar) */
.c-5-4 { grid-column: 5 / span 4; }
.personas { margin-top: 56px; }
.persona > * + * { margin-top: 16px; }
.persona h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-list); line-height: 1.3; }
.persona p, .persona li { font-size: var(--t-body); line-height: 1.4; color: var(--muted); }
.persona img { margin-top: 32px; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--panel); }

/* Before/after compare: old design under, new design clipped from the divider rightwards */
.compare {
  --pos: 50%;
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--panel);
  cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare .compare__after { clip-path: inset(0 0 0 var(--pos)); }
.compare__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #595959; pointer-events: none; }
.compare__handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: #595959; color: #fff;
}
.compare__handle svg { width: 22px; height: 22px; }
.compare__tag {
  position: absolute; top: 16px; padding: 6px 12px; border-radius: 100px;
  background: rgba(25, 25, 25, .6); color: #fff; font-size: var(--t-meta); line-height: 1.2; pointer-events: none;
}
.compare__tag--before { left: 16px; }
.compare__tag--after { right: 16px; }
.compare__range { position: absolute; inset: auto 0 0 0; width: 100%; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.compare:has(.compare__range:focus-visible) { outline: 4px solid var(--focus); outline-offset: 2px; }

/* ---------- Closing CTA ---------- */
.closing { padding-top: 260px; }
.closing .t-title { line-height: 1; }

/* ---------- Theme ---------- */
.arrow-link img, .job__icon img { filter: var(--icon-filter); }
.nav { transition: transform .4s ease, background-color .3s ease, opacity .6s ease; }
/* during the home intro the header waits, then fades down after the hero content */
.nav-pending .nav { opacity: 0; transform: translateY(-16px); pointer-events: none; animation: nav-failsafe 0s 9s forwards; }
@keyframes nav-failsafe { to { opacity: 1; transform: none; pointer-events: auto; } }

.theme-toggle {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  height: 56px; min-width: 56px; padding: 0 14px; box-sizing: border-box; border-radius: 999px;
  display: flex; align-items: center; justify-content: flex-end;
  background: var(--bg); color: var(--ink);
  /* same surface, shadow and hover lift as the demo play/pause buttons */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .1);
  transition: background-color .3s ease, color .3s ease, transform .25s ease, box-shadow .25s ease;
}
.theme-toggle__icons { display: grid; place-items: center; flex: none; }
/* keyboard shortcut hint: collapsed to nothing, slides out to the left on hover / keyboard focus */
.theme-toggle__hint { display: flex; align-items: center; gap: 3px; max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap;
  transition: max-width .3s ease, margin-right .3s ease, opacity .2s ease; }
.theme-toggle__hint kbd { min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; display: grid; place-items: center;
  border-radius: 6px; background: var(--panel); color: var(--muted); font: 600 12px / 1 var(--font-body); }
@media (hover: hover) {
  .theme-toggle:hover .theme-toggle__hint { max-width: 140px; margin-right: 10px; opacity: 1; }
}
.theme-toggle:focus-visible .theme-toggle__hint { max-width: 140px; margin-right: 10px; opacity: 1; }
:root[data-theme="dark"] .theme-toggle__hint kbd { background: #2c2c2c; }
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 18px rgba(0, 0, 0, .14); }
.theme-toggle:active { transform: translateY(0); transition-duration: .1s; }
:root[data-theme="dark"] .theme-toggle { background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .theme-toggle:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 18px rgba(0, 0, 0, .6); }
/* Contact dock: bottom-left pills on the same surface, shadow and hover lift as the theme toggle */
.contact-dock { position: fixed; left: 24px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.dock-btn {
  height: 56px; min-width: 56px; padding: 0 17px; box-sizing: border-box; border-radius: 999px;
  display: inline-flex; align-items: center;
  font-weight: 600; font-size: 16px; line-height: 1; letter-spacing: .2px; white-space: nowrap;
  background: var(--bg); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 10px rgba(0, 0, 0, .1);
  transition: background-color .3s ease, color .3s ease, transform .25s ease, box-shadow .25s ease;
}
.dock-btn svg { width: 22px; height: 22px; flex: none; }
/* label: collapsed to an icon-only circle, slides out on hover / keyboard focus (same motion as the theme toggle hint) */
.dock-btn__label { display: block; max-width: 0; overflow: hidden; opacity: 0;
  transition: max-width .3s ease, margin-left .3s ease, opacity .2s ease; }
@media (hover: hover) {
  .dock-btn:hover .dock-btn__label { max-width: 260px; margin-left: 10px; opacity: 1; }
}
.dock-btn:focus-visible .dock-btn__label { max-width: 260px; margin-left: 10px; opacity: 1; }
.dock-btn:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 18px rgba(0, 0, 0, .14); }
.dock-btn:active { transform: translateY(0); transition-duration: .1s; }
:root[data-theme="dark"] .dock-btn { background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .dock-btn:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 18px rgba(0, 0, 0, .6); }
/* home intro: dock waits with the header */
.nav-pending .contact-dock { opacity: 0; pointer-events: none; }
.contact-dock { transition: opacity .6s ease; }

.theme-toggle__icons svg { width: 28px; height: 28px; grid-area: 1 / 1; transition: opacity .3s ease, transform .4s ease; }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg) scale(.6); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: none; }

/* ---------- Intro (home page) ---------- */
.intro { display: none; }
.intro-play body { overflow: hidden; }
.intro-play .intro {
  position: fixed; inset: 0; z-index: 100;
  /* name sits on the same left edge as the page content, vertically centred */
  display: flex; align-items: center;
  padding: 0 max(var(--side), calc((100% - var(--max)) / 2));
  background: var(--bg); color: var(--ink); cursor: pointer;
  transition: opacity 1s ease, transform 1.1s cubic-bezier(.65, 0, .35, 1);
  /* failsafe: never block the page if the script doesn't run */
  animation: intro-failsafe 0s 8s forwards;
}
.intro__text {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 6vw, 88px); line-height: 1; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; white-space: nowrap;
  transition: opacity .6s ease, transform .7s cubic-bezier(.65, 0, .35, 1);
}
.intro__caret {
  width: .06em; height: .9em; margin-left: .08em; background: currentColor;
  animation: caret-blink 1s steps(1) infinite;
}
.intro.is-leaving { opacity: 0; transform: translateY(-40px); pointer-events: none; }
.intro.is-leaving .intro__text { opacity: 0; transform: translateY(-32px); }
.intro.is-typing .intro__caret { animation: none; }
@keyframes caret-blink { 50% { opacity: 0; } }
@keyframes intro-failsafe { to { visibility: hidden; pointer-events: none; } }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .slider__track { transition: none; }
  .hero__status::before { animation: none; }
  body, .theme-toggle, .theme-toggle svg, .theme-toggle__hint { transition: none; }
}

/* ==========================================================================
   Tablet
   ========================================================================== */
@media (max-width: 1169.98px) {
  :root { --side: 48px; --gap: 24px; --section-space: 128px; --t-hero: 56px; --t-title: 36px; --t-label: 28px; --t-lead: 24px; --t-list: 21px; --t-body: 18px; }
  .hero { display: block; padding-top: 129px; padding-bottom: 120px; }
  .c-3-5, .c-8-5 { grid-column: 3 / span 10; }
  .job__icon { grid-column: 3 / span 2; }
  .job__body { grid-column: 5 / span 8; }
  .c-1-4 { grid-column: 1 / span 4; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 767.98px) {
  :root { --side: 20px; --gap: 16px; --nav-h: 60px; --section-space: 96px; --t-hero: 40px; --t-title: 32px; --t-label: 32px; --t-lead: 20px; --t-list: 18px; --t-body: 16px; }

  [class*="c-"] { grid-column: 1 / -1; }
  .grid > * + * { margin-top: 20px; }
  .refs > * + *, .jobs > * + * { margin-top: 0; }

  .nav__logo { font-size: 22px; }
  .theme-toggle { right: 16px; bottom: 16px; height: 48px; min-width: 48px; padding: 0 12px; }
  .theme-toggle__icons svg { width: 24px; height: 24px; }
  /* phone: icon-only circles, same size as the toggle */
  .contact-dock { display: none; }  /* phones: no floating contact buttons over the content; Contact is in the menu */
  .dock-btn { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .dock-btn__label { display: none; }
  .nav__toggle { display: block; }
  /* Full-screen menu sits behind the logo/close button (z-index -1 inside the nav).
     80px bottom padding lifts the centred links 40px above the middle of the screen. */
  .nav__links {
    position: fixed; inset: 0; z-index: -1; background: var(--page);
    flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 28px; padding: 0 var(--side) 80px;
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
  }
  .nav__links a { font-family: var(--font-display); font-weight: 700; font-size: 30px; }
  .nav-open .nav__links { opacity: 1; visibility: visible; }
  .nav-open .nav { transform: none; }

  /* phones: the hero is only as tall as its content, so the first project follows at the normal section gap */
  .hero { min-height: 0; padding-top: 96px; padding-bottom: var(--section-space); }
  .hero .t-hero { line-height: 1; }
  .t-hero br, .t-lead br { display: none; }
  .hero__lead { margin-top: 20px; line-height: 1.2; }

  .section--first { padding-top: 56px; }
  .project__copy { margin-top: 20px; }
  .project__media { margin-top: 36px; }
  .t-label { margin-top: 0; line-height: 1.2; }
  .slider__btn { width: 36px; height: 36px; }
  .slider__btn svg { width: 20px; height: 20px; }
  .slider__btn--prev { left: 4px; }
  .slider__btn--next { right: 4px; }

  .refs { row-gap: 40px; }
  .ref__quote { font-size: 20px; }

  .about-hero { padding-top: 40px; }
  .about-hero .t-title { margin-bottom: 12px; }

  .jobs { row-gap: 48px; }
  .job__icon { display: none; }
  .job__body { grid-column: 1 / -1; }
  .job__org { font-size: 16px; }
  .job__role { font-size: 24px; line-height: 1.5; }
  .job__when { font-size: 15px; }
  .job__desc { font-size: 13px; }

  .case-intro { padding-top: 48px; }
  .case-media { margin-top: 64px; }
  .case-section { padding-top: 80px; }
  .case-figure { margin-top: 40px; }
  .case-block h2 { font-size: 24px; line-height: 1.3; }
  .personas { margin-top: 40px; }
  .personas > * + * { margin-top: 56px; }
  .compare__handle { width: 36px; height: 36px; }
  .compare__tag { top: 10px; padding: 4px 10px; font-size: 12px; }
  .compare__tag--before { left: 10px; }
  .compare__tag--after { right: 10px; }
  .closing { padding-top: 160px; }
  main { padding-bottom: 120px; }
}

/* ---------- Spacing utilities ---------- */
.mt-16 { margin-top: 16px; }
.mt-44 { margin-top: 44px; }

/* "Email copied" toast: shown when an email link is clicked (js/main.js), in case no mail app opens */
.toast { position: fixed; left: 50%; bottom: 32px; z-index: 70; translate: -50% 12px; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; line-height: 1.2; opacity: 0; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .2s ease, translate .25s ease; }
.toast.is-visible { opacity: 1; translate: -50% 0; }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s ease; translate: -50% 0; } }
