* { box-sizing: border-box; }

:root {
  --bg: #FAFAFA;
  --ink: #0A0A0A;
  --body: #4A4A4A;
  --muted: #6B6B6B;
  --label: #8A8A8A;
  --hairline: #E0E0E0;
  --warm: #F1F0ED;
  --hint: #B0B0B0;
  --pad-x: clamp(22px, 5vw, 64px);
  --pad-y: clamp(56px, 10vh, 120px);
  --col-gap: clamp(28px, 5vw, 80px);
  --tl-indent: clamp(28px, 4vw, 56px);
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --serif: 'Cormorant Garamond', serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: clip;
}
p { margin: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--muted); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.5); } }
@keyframes ring { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes wordIn { from { opacity: 0; transform: translateY(105%) rotate(2deg); filter: blur(4px); } to { opacity: 1; transform: translateY(0) rotate(0deg); filter: blur(0); } }

.container { max-width: 1200px; margin: 0 auto; }
.label { margin: 0 0 16px; font-size: 13px; color: var(--label); }
.label--flat { margin: 0; }
.label--work { margin-bottom: clamp(28px, 5vh, 48px); }
.label--contact { margin-bottom: 26px; }
.serif-lead {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.2;
  text-wrap: pretty;
}
.clip { overflow: hidden; }
[data-sticky] { align-self: start; }

/* Intro curtain */
.intro {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink); color: var(--bg);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--pad-x);
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
}
.intro[hidden] { display: none; }
.intro-label { margin-bottom: 18px; font-size: 13px; color: var(--label); }
.intro-text {
  font-weight: 300; font-size: clamp(40px, 8vw, 120px);
  line-height: 1; letter-spacing: -0.045em; min-height: 1em;
}
.intro-caret {
  display: inline-block; width: 0.05em; height: 0.85em;
  background: var(--bg); vertical-align: -0.08em; margin-left: 0.08em;
  animation: caret 0.9s steps(1) infinite;
}
.intro-track { position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: rgba(250, 250, 250, 0.12); }
.intro-bar { height: 100%; width: 0%; background: var(--bg); transition: width 0.3s ease; }

/* Header */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(20px, 5vw, 64px);
  font-size: 13px;
  mix-blend-mode: difference; color: #FFFFFF;
}
.site-header a { color: inherit; transition: color 0.2s; }
.site-header a:hover { color: var(--muted); }
.site-nav { display: flex; gap: clamp(14px, 3vw, 30px); }
.nav-toggle {
  display: none; align-items: center; gap: 8px;
  background: none; border: 1px solid currentColor; color: inherit; font: inherit;
  padding: 8px 14px; cursor: pointer; position: relative; z-index: 95;
}
.mobile-nav {
  display: none; position: fixed; inset: 0; z-index: 80;
  flex-direction: column; justify-content: center; align-items: flex-start;
  gap: 28px; padding: 0 28px;
  background: var(--ink);
  font-size: 28px; font-weight: 300; letter-spacing: -0.02em;
}
.mobile-nav a { color: var(--bg); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  min-height: 100vh;
}
.hero-dark, .hero-light {
  padding: clamp(100px, 16vh, 160px) var(--pad-x) clamp(40px, 7vh, 72px);
}
.hero-dark {
  position: relative; min-height: 60vh; overflow: hidden;
  background: var(--ink); color: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  animation: reveal 1.2s cubic-bezier(0.77, 0, 0.18, 1) both;
}
.grid-deco {
  position: absolute; inset: 0; pointer-events: none;
  background-size: 64px 64px;
}
.grid-deco--hero {
  background-image: linear-gradient(rgba(250, 250, 250, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(250, 250, 250, 0.06) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at 30% 40%, black 30%, transparent 80%);
}
.grid-deco--notes {
  background-image: linear-gradient(rgba(250, 250, 250, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(250, 250, 250, 0.05) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 10%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 50%, black 10%, transparent 70%);
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.9; }
.hero-spot {
  position: absolute; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 250, 250, 0.09), transparent 62%);
  pointer-events: none; transition: transform 0.2s ease-out;
}
.hero-dark-top { position: relative; display: flex; flex-direction: column; gap: 22px; animation: fadeUp 0.8s 0.5s ease both; }
.hero-status {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 10px 16px; font-size: 13px; color: var(--label);
}
.hero-status-open { display: inline-flex; align-items: center; gap: 8px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg); animation: pulse 2.4s ease-in-out infinite; }
.hero-current { display: flex; align-items: center; gap: 14px; }
.hero-logo-tile { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(250, 250, 250, 0.18); }
.hero-logo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-current-label { font-size: 13px; color: var(--label); }
.hero-current-role { margin-top: 2px; font-size: 15px; }
.hero-dark-bottom { position: relative; display: flex; flex-direction: column; gap: clamp(20px, 3vh, 32px); animation: fadeUp 0.9s 0.6s ease both; }
.hero-statement {
  font-weight: 300; font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.15; letter-spacing: -0.03em; max-width: 22ch; text-wrap: pretty;
}
.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px; padding-top: 24px; border-top: 1px solid rgba(250, 250, 250, 0.18);
}
.stat-num { font-size: 28px; font-weight: 300; letter-spacing: -0.03em; }
.stat-label { margin-top: 4px; font-size: 13px; color: var(--label); }

.hero-light { display: flex; flex-direction: column; justify-content: flex-end; }
.hero-title {
  margin: 0; font-weight: 300; font-size: clamp(40px, 6vw, 92px);
  line-height: 1; letter-spacing: -0.04em;
  animation: fadeUp 0.9s 0.4s ease both;
}
.hero-word-wrap { display: inline-flex; align-items: baseline; gap: 0.25em; color: var(--muted); }
.hero-word-mask {
  position: relative; display: inline-block; min-width: 8ch; overflow: hidden;
  vertical-align: bottom; line-height: 1.1; margin-bottom: -0.1em;
}
.hero-word {
  font-family: var(--serif); font-style: italic; color: var(--ink);
  display: inline-block;
  animation: wordIn 0.8s var(--ease-out) both;
}
.hero-sub {
  margin-top: 30px; font-size: 16px; line-height: 1.7; color: var(--body); max-width: 46ch;
  animation: fadeUp 0.9s 0.55s ease both;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; animation: fadeUp 0.9s 0.65s ease both; }
.btn {
  white-space: nowrap; font-size: 13px; padding: 14px 24px;
  background: var(--ink); color: var(--bg); transition: background 0.25s;
}
.btn:hover { background: var(--body); color: var(--bg); }

/* Ticker */
.ticker {
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding: 16px 0; overflow: hidden; white-space: nowrap;
}
.ticker-row { display: inline-flex; animation: drift 40s linear infinite; }
.ticker-row span { font-size: 13px; letter-spacing: 0.06em; color: var(--muted); white-space: pre; }

/* About */
.about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--col-gap);
  max-width: 1200px; margin: 0 auto;
  padding: clamp(64px, 12vh, 140px) var(--pad-x);
}
.about-body {
  display: flex; flex-direction: column; gap: 18px;
  font-size: 16px; line-height: 1.75; color: var(--body);
  padding-top: clamp(0px, 3vw, 40px);
}

/* Experience */
.work { background: var(--warm); padding: var(--pad-y) var(--pad-x); }
.timeline { position: relative; padding-left: var(--tl-indent); }
.tl-line {
  position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px;
  background: var(--ink); opacity: 0.3;
  transform-origin: top; transform: scaleY(0);
  transition: transform 2.6s var(--ease-out);
}
.tl-entries { display: flex; flex-direction: column; gap: clamp(40px, 7vh, 72px); }
.tl-entry {
  position: relative; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 20px 40px; align-items: start; padding: 8px 0;
}
.tl-dot {
  position: absolute; left: calc(-1 * var(--tl-indent) + 1px); top: 14px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--ink);
  transform: scale(0); transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tl-ring {
  position: absolute; left: calc(-1 * var(--tl-indent) - 5px); top: 8px;
  width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--ink);
  animation: ring 2.4s ease-out infinite;
}
.tl-meta { display: flex; flex-direction: column; gap: 18px; }
.tl-dates { font-size: 13px; color: var(--label); }
.tl-logo {
  background-size: contain; background-repeat: no-repeat; background-position: left center;
  max-width: 100%;
}
.tl-logo:hover { transform: scale(1.05) !important; transition: transform 0.5s var(--ease-out) !important; }
.tl-logo--teya { height: 52px; width: 52px; border-radius: 12px; background-image: url(logos/teya.png); }
.tl-logo--inesc { height: 44px; width: 170px; background-image: url(logos/inesctec.png); }
.tl-main { grid-column: span 2; min-width: 0; }
.tl-role { font-weight: 300; font-size: clamp(26px, 3vw, 40px); line-height: 1.1; letter-spacing: -0.03em; }
.tl-org { margin: 6px 0 16px; font-size: 15px; font-weight: 500; }
.tl-body { font-size: 15px; line-height: 1.7; color: var(--body); max-width: 56ch; }
.tl-rule { height: 1px; background: var(--ink); opacity: 0.2; margin-top: 22px; transform-origin: left; }

/* Education */
.education { padding: var(--pad-y) var(--pad-x); border-top: 1px solid var(--hairline); }
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--col-gap); align-items: start;
}
.serif-lead--edu { margin-bottom: 28px; max-width: 18ch; }
.edu-logo { height: 84px; width: auto; max-width: 100%; display: block; }
.edu-main {
  grid-column: span 2; min-width: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(24px, 3vw, 40px);
}
.edu-head { grid-column: 1 / -1; padding-bottom: 24px; border-bottom: 1px solid var(--hairline); }
.edu-degree { font-weight: 300; font-size: clamp(24px, 2.6vw, 36px); line-height: 1.05; letter-spacing: -0.03em; }
.edu-school { margin-top: 8px; font-size: 15px; font-weight: 500; }
.edu-grade { font-size: clamp(32px, 3.4vw, 48px); font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.edu-grade span { font-size: 0.5em; color: var(--label); }
.edu-fact-label { font-size: 13px; color: var(--label); }
.edu-fact-label--below { margin-top: 8px; }
.edu-link { display: inline-block; margin-top: 12px; font-size: 13px; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.edu-link span { display: inline-block; transition: transform 0.3s var(--ease-out); }
.edu-link:hover span { transform: translateX(4px); }
.edu-fact { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--body); }

/* Lessons deck */
.notes { background: var(--ink); color: var(--bg); padding: var(--pad-y) var(--pad-x); position: relative; overflow: hidden; }
.notes-inner { position: relative; }
.notes-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.notes-sub { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--label); }
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--col-gap); align-items: center; margin-top: 36px;
}
.notes-intro { display: flex; flex-direction: column; gap: 18px; }
.notes-title { font-weight: 300; font-size: clamp(24px, 2.6vw, 36px); line-height: 1.15; letter-spacing: -0.03em; max-width: 22ch; text-wrap: pretty; }
.notes-hint { font-size: 14px; color: var(--label); }
.deck-dots { display: flex; gap: 6px; }
.deck-dots span { height: 2px; width: 22px; background: var(--bg); opacity: 0.25; transition: opacity 0.4s; }
.deck-dots span.is-active { opacity: 1; }
.deck-stack { position: relative; height: 280px; cursor: pointer; perspective: 1200px; min-width: 0; outline: none; }
.deck-stack:focus-visible { outline: 1px solid rgba(250, 250, 250, 0.4); outline-offset: 8px; }
.card {
  position: absolute; left: 50%; top: 50%; width: min(320px, 88%);
  padding: 24px 26px; background: var(--bg); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) translate(0px, 44px) rotate(1deg) scale(0.88);
  opacity: 0;
  transition: transform 0.7s var(--ease-out), opacity 0.7s;
  user-select: none;
}
.card-tag { margin-bottom: 12px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--label); }
.card-text { font-size: 17px; line-height: 1.5; letter-spacing: -0.01em; }

/* Contact */
.contact { padding: clamp(64px, 12vh, 150px) var(--pad-x); }
.contact-title {
  margin: 0 0 40px; font-weight: 300; font-size: clamp(34px, 5.6vw, 84px);
  line-height: 1.02; letter-spacing: -0.04em; max-width: 20ch; text-wrap: pretty;
}
.contact-title span { font-family: var(--serif); font-style: italic; color: var(--muted); }
.contact-mail {
  display: inline-block; font-size: clamp(17px, 2vw, 26px); font-weight: 300;
  border-bottom: 1px solid var(--ink); padding-bottom: 4px; word-break: break-word;
}
.contact-foot {
  display: flex; flex-wrap: wrap; gap: 24px; margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--hairline); font-size: 13px;
}
.contact-foot a { color: var(--muted); }
.contact-foot a:hover { color: var(--ink); }
.contact-foot span { margin-left: auto; color: var(--hint); }

/* Breakpoints */
@media (max-width: 720px) {
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  /* spec sets this unconditionally at ≤720px, but that leaves #FAFAFA text invisible
     over the light sections — so only drop the blend while the overlay is open */
  .site-header.is-open { mix-blend-mode: normal; color: var(--bg); }
  .mobile-nav[data-open="1"] { display: flex; }
  .hero-canvas, .hero-spot { display: none; }
  .deck-stack { height: 340px; }
}
@media (max-width: 420px) {
  .deck-stack { height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-canvas, .hero-spot { display: none; }
  .ticker-row, .hero-dark, .hero-dark-top, .hero-dark-bottom, .hero-title, .hero-sub,
  .hero-actions, .hero-word, .pulse-dot, .tl-ring { animation: none; }
  .tl-line, .tl-dot { transform: none; transition: none; }
  .card { transition: none; }
}
