/* ============================================================
   Andrea Cappa — portfolio
   Light, minimal, Swiss-leaning. Mobile-first.
   ============================================================ */

:root {
  --bg: #fafaf8;
  --bg-alt: #f1f1ec;
  --ink: #16181d;
  --ink-soft: #50545e;
  --ink-faint: #8a8f99;
  --accent: #2547f4;
  --accent-soft: #e6eafd;
  --line: #e2e2db;
  --radius: 14px;
  --max: 1120px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --font: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Inter, system-ui,
    -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }

/* ============ NAV ============ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.nav-name {
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
  font-size: 0.92rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }

.nav-cta {
  color: #fff !important;
  background: var(--ink);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--accent); }

/* Hide middle links on small screens, keep CTA */
@media (max-width: 640px) {
  .nav-links a:not(.nav-cta) { display: none; }
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: calc(4rem + 5svh) var(--pad) 4rem;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* gradient fallback / base */
.hero {
  background:
    radial-gradient(60% 50% at 75% 40%, var(--accent-soft) 0%, transparent 70%),
    var(--bg);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}

.hero-greet {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  color: var(--accent);
  margin-bottom: 1.1rem;
  min-height: 1.4em;
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -0.12em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hero-title {
  font-size: clamp(2.3rem, 6.5vw, 4.6rem);
  max-width: 21ch;
}
.hero-title em {
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--accent);
  letter-spacing: -0.015em;
}

/* career route ticker */
.route {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(0.15rem, 0.8vw, 0.6rem);
  margin-top: 1.6rem;
  font-size: clamp(0.6rem, 1.6vw, 0.82rem);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
}
.route-arrow { color: var(--line); }
.route-city {
  transition: color 0.45s, text-shadow 0.45s;
}
.route-city.lit {
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.hero-sub {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 54ch;
}

.hero-ctas {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: transform 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); }

.btn-ghost {
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fff 65%, transparent);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 400px) {
  .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
  }
  .hero-ctas { gap: 0.35rem; }
}

/* floating city labels on the globe */
.globe-label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -130%);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--ink-soft);
  background: color-mix(in srgb, #fff 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.globe-label strong { color: var(--accent); font-weight: 700; }
@media (max-width: 900px) {
  .globe-label { display: none; }
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 1;
  text-decoration: none;
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  letter-spacing: 0.04em;
  white-space: nowrap;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-scroll { animation: none; }
}

.br-desktop { display: none; }
@media (min-width: 900px) { .br-desktop { display: inline; } }

/* ============ STATS ============ */
.stats {
  border-block: 1px solid var(--line);
  background: #fff;
}

.stats-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}

.stat {
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--pad);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat:nth-child(2n) { border-right: none; }
.stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }

@media (min-width: 820px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stat:nth-child(-n + 2) { border-bottom: none; }
  .stat:nth-child(2n) { border-right: 1px solid var(--line); }
  .stat:last-child { border-right: none; }
}

.stat-num {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ============ LOGO MARQUEE ============ */
.logos {
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.logos-caption {
  text-align: center;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 1.75rem;
  padding: 0 var(--pad);
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
}
.marquee-track.animating {
  animation: marquee 120s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track img {
  height: clamp(22px, 3vw, 32px);
  width: auto;
  margin-right: clamp(2.5rem, 5vw, 4.5rem);
  filter: brightness(0);
  opacity: 0.55;
  transition: opacity 0.25s;
}
.marquee-track img:hover { opacity: 0.85; }
.marquee-track img.lg { height: clamp(34px, 4.4vw, 48px); }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee-track img[aria-hidden="true"] { /* hidden from screen readers */ }
@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 var(--pad);
  }
  .marquee-track.animating { animation: none; }
  .marquee { mask-image: none; -webkit-mask-image: none; }
  .marquee-track img[aria-hidden="true"] { display: none; }
}

/* ============ SECTIONS ============ */
.section {
  padding: clamp(4rem, 9vw, 7rem) var(--pad);
}
.section-alt { background: var(--bg-alt); }

.section-head {
  max-width: var(--max);
  margin: 0 auto clamp(2.5rem, 5vw, 4rem);
}
.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
}
.section-head p {
  margin-top: 0.6rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  max-width: 56ch;
}

/* ============ TIMELINE ============ */
.timeline {
  list-style: none;
  max-width: var(--max);
  margin: 0 auto;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--line);
}

.t-item {
  position: relative;
  padding: 0 0 clamp(2.25rem, 4vw, 3.25rem) 2.25rem;
}
.t-item:last-child { padding-bottom: 0; }
.t-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.t-meta {
  display: flex;
  gap: 0.35rem 0.6rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}
.t-date { font-weight: 600; color: var(--accent); }
.t-loc {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.t-break {
  display: block;
  width: 100%;
}
.t-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.t-body h3 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
}
.t-co { color: var(--ink-soft); font-weight: 600; }

.t-desc {
  color: var(--ink-faint);
  font-size: 0.92rem;
  margin: 0.2rem 0 0.7rem;
}

.t-body ul {
  list-style: none;
  display: grid;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.97rem;
  max-width: 72ch;
}
.t-body ul li {
  padding-left: 1.1rem;
  position: relative;
}
.t-body ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

@media (min-width: 900px) {
  .timeline::before { left: 11rem; }
  .t-item {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 3.5rem;
    padding-left: 0;
  }
  .t-item::before { left: 10.65rem; }
  .t-meta {
    flex-direction: column;
    gap: 0.1rem;
    text-align: right;
    align-items: flex-end;
  }
  .t-break { display: none; }
}

/* ============ ALMA MATER ============ */
.alma {
  max-width: var(--max);
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line);
}
.alma-kicker {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: var(--accent);
  font-size: 1.02rem;
  margin-bottom: 1.25rem;
}
.alma-grid {
  display: grid;
  gap: 1.5rem 3rem;
  grid-template-columns: 1fr;
}
@media (min-width: 680px) { .alma-grid { grid-template-columns: 1fr 1fr; } }
.alma-item h3 {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  letter-spacing: -0.01em;
}
.alma-item p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}
.alma-loc {
  color: var(--ink-faint) !important;
  font-size: 0.85rem !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============ PROJECT CARDS ============ */
.cards {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 680px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 16px 40px -20px rgba(22, 24, 29, 0.18);
}
.card:nth-child(2n):hover {
  transform: translateY(-4px) rotate(0.4deg);
}

.card-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  margin-bottom: 0.6rem;
}
.card p {
  color: var(--ink-soft);
  font-size: 0.97rem;
}

/* expandable detail */
.card-detail {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.4s ease;
}
.card.is-expanded .card-detail {
  grid-template-rows: 1fr;
}
.card-detail-inner {
  min-height: 0;
}
.detail-block {
  padding-top: 1.1rem;
}
.detail-block h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.detail-block p {
  font-size: 0.94rem;
  color: var(--ink-soft);
}
.card-detail-inner .chips {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.card-detail-inner .chips li {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
}

.card-toggle {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.5rem 0;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}
.card-toggle:hover { color: var(--ink); }
.card-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card.is-expanded .card-toggle { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .card-detail { transition: none; }
  .card:not(.is-expanded) .card-detail { display: none; }
}

/* ============ SKILLS ============ */
.skills-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 2.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 820px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }

.skill-col h3 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--ink);
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chips li {
  font-size: 0.88rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  transition: border-color 0.2s, color 0.2s;
}
.chips li:hover { border-color: var(--accent); color: var(--accent); }

.skill-note {
  margin-top: 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

/* ============ ABOUT ============ */
.about {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 820px) {
  .about { grid-template-columns: minmax(260px, 380px) 1fr; }
}

.about-photo {
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  box-shadow: 0 24px 60px -28px rgba(22, 24, 29, 0.35);
}

.about-text h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  margin-bottom: 1.25rem;
}
.about-text p {
  color: var(--ink-soft);
  margin-bottom: 1rem;
  max-width: 60ch;
}
.about-pitch {
  color: var(--ink) !important;
  font-size: 1.08rem;
}
.about-text .hero-ctas { margin-top: 1.75rem; }

/* ============ FOOTER ============ */
.footer {
  padding: 2.5rem var(--pad);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.88rem;
  color: var(--ink-faint);
}
.footer-note {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  margin-top: 0.2rem;
}
.footer-songs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.footer-songs a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
  transition: color 0.2s, border-color 0.2s;
}
.footer-songs a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ REVEAL ANIMATIONS ============ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
