/* ============================================================
   Cristian Caroppo — Portfolio · CCRB FAB
   Design system: dark racing, giallo GS Parmense, zero framework
   ============================================================ */

:root {
  --bg: #07090c;
  --bg-2: #0b0e14;
  --panel: rgba(15, 19, 27, 0.82);
  --panel-solid: #10141c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f6;
  --muted: #9aa3b5;
  --accent: #dcf532;
  --accent-warm: #ffac2f;
  --accent-ink: #10130a;
  --radius: 18px;
  --radius-s: 12px;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1200px;
}

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

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

body {
  font-family: var(--font-display);
  background:
    radial-gradient(1200px 800px at 78% -10%, rgba(220, 245, 50, 0.05), transparent 60%),
    radial-gradient(900px 700px at 8% 30%, rgba(90, 120, 255, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: var(--accent); color: var(--accent-ink); }

img { display: block; max-width: 100%; height: auto; }

img[data-lightbox] { cursor: zoom-in; }

a { color: inherit; text-decoration: none; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- sfondo 3D + grana ---------- */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}

body.no-gl #scene { display: none; }
body.no-gl {
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 64px),
    radial-gradient(1200px 800px at 78% -10%, rgba(220, 245, 50, 0.06), transparent 60%),
    linear-gradient(#07090c, #0b0e14);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 30;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='2'/%3E%3C/filter%3E%3Crect%20width='180'%20height='180'%20filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- progress bar ---------- */

.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- header ---------- */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  transition: background 0.4s ease, border-color 0.4s ease, padding 0.4s ease;
  border-bottom: 1px solid transparent;
}

.header.scrolled {
  background: rgba(7, 9, 12, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding-block: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}

.brand-mark {
  background: linear-gradient(90deg, var(--text), #c8cede);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-fab {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  color: var(--accent);
  border: 1px solid rgba(220, 245, 50, 0.35);
  padding: 0.18em 0.5em 0.14em 0.6em;
  border-radius: 6px;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2.1rem);
}

.nav a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  padding: 0.3em 0;
  transition: color 0.25s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.3s ease;
}

.nav a:hover, .nav a.active { color: var(--text); }
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }

.nav a.nav-cta {
  color: var(--accent-ink);
  background: var(--accent);
  padding: 0.55em 1.1em;
  border-radius: 999px;
  font-weight: 700;
}
.nav a.nav-cta::after { display: none; }
.nav a.nav-cta:hover { background: #eaff5e; color: var(--accent-ink); }

.burger {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
  z-index: 70;
}
.burger span {
  width: 26px; height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
body.menu-open .burger span:first-child { transform: translateY(4px) rotate(45deg); }
body.menu-open .burger span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ---------- hero ---------- */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(5rem, 10vh, 8rem) clamp(1.2rem, 6vw, 5rem) 4rem;
  max-width: var(--max);
  margin-inline: auto;
  position: relative;
}

.kicker {
  color: var(--accent);
}

.hero-title {
  font-size: clamp(3.2rem, 12.5vw, 9.6rem);
  line-height: 0.88;
  font-weight: 800;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin: 0.32em 0 0.22em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-title .line { display: block; }

.hero-title .outline {
  margin-top: -0.015em;
  color: rgba(238, 240, 246, 0.06);
  -webkit-text-stroke: 1.25px rgba(238, 240, 246, 0.85);
}

@supports not (-webkit-text-stroke: 1px white) {
  .hero-title .outline { color: var(--accent); }
}

.hero-sub {
  font-size: clamp(1.02rem, 1.6vw, 1.3rem);
  color: var(--muted);
  max-width: 46ch;
}
.hero-sub strong { color: var(--accent); font-weight: 700; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.1rem;
}

.hero-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.4rem;
  padding: 0;
}
.hero-chips li,
.chips li {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45em 0.95em;
  color: var(--muted);
  background: rgba(10, 13, 18, 0.5);
}

.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: clamp(1.2rem, 6vw, 5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
}
.scroll-line {
  width: 56px; height: 1px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
}
.scroll-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-100%);
  animation: scrollLine 2.2s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateX(-100%); }
  55% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ---------- bottoni ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.85em 1.7em;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover {
  background: #eaff5e;
  transform: translateY(-2px);
  box-shadow: 0 10px 34px rgba(220, 245, 50, 0.25);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(10, 13, 18, 0.4);
}
.btn-ghost:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-big {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  padding: 1em 2.2em;
}

/* ---------- marquee ---------- */

.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: rgba(9, 12, 17, 0.6);
  padding: 0.85rem 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- sezioni ---------- */

.section {
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(4.5rem, 10vw, 7.5rem) clamp(1.2rem, 6vw, 5rem);
  scroll-margin-top: 4.5rem;
}

.section-head { margin-bottom: clamp(2.2rem, 5vw, 3.6rem); }

.section-head .kicker::before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 0.85rem;
  transform: translateY(-1px);
}

.section-head h2 {
  font-size: clamp(2.1rem, 5.4vw, 3.8rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-top: 0.7rem;
}

.section-head h2 em {
  font-style: normal;
  background: linear-gradient(92deg, var(--accent), var(--accent-warm));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-head .lead {
  margin-top: 1.3rem;
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
}
.section-head .lead strong { color: var(--text); }

/* ---------- chi sono ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.6rem, 4vw, 3.5rem);
  align-items: start;
}

.about-text p {
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.14rem);
}
.about-text strong { color: var(--text); }

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
  padding: 0;
}

.about-photo img,
.feature-photo img,
.card-photo img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  width: 100%;
}

.about-photo, .feature-photo, .card-photo { position: relative; }

figcaption.mono, .masonry figcaption {
  color: var(--muted);
  margin-top: 0.7rem;
}

/* ---------- ciclismo ---------- */

.feature-photo { margin-bottom: 1.4rem; }
.feature-photo img {
  max-height: 640px;
  object-fit: cover;
  object-position: center 30%;
}

.cycling-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(1.2rem, 3vw, 2rem);
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.tv-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.tv-block blockquote {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.4;
  border-left: 3px solid var(--accent);
  padding-left: 1.1rem;
}
.tv-block strong { color: var(--accent); }

.tv-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.tv-photos img {
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.tv-photos img:hover { transform: translateY(-3px); border-color: var(--line-strong); }

/* timeline */

.timeline {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3.5vw, 2.4rem);
}

.timeline-title { color: var(--accent); margin-bottom: 1.4rem; }

.timeline ol { list-style: none; padding: 0; }

.timeline li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.2rem;
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--line);
  align-items: baseline;
}
.timeline li:last-child { border-bottom: 0; }

.tl-date { color: var(--accent); white-space: nowrap; }

.tl-date::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.6rem;
  transform: translateY(-2px);
}
.tl-text { color: var(--muted); }
.tl-text strong { color: var(--text); }

/* ---------- officina ---------- */

.masonry {
  columns: 3 300px;
  column-gap: 1rem;
}

.masonry figure {
  break-inside: avoid;
  margin: 0 0 1rem;
  position: relative;
  border-radius: var(--radius-s);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-solid);
}

.masonry img {
  width: 100%;
  cursor: zoom-in;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.masonry figure:hover img { transform: scale(1.035); }

.masonry figcaption {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 2rem 0.9rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(180deg, transparent, rgba(4, 6, 9, 0.85));
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.masonry figure:hover figcaption { opacity: 1; }

@media (hover: none) {
  .masonry figcaption { opacity: 1; padding-top: 1.4rem; }
}

/* ---------- digitale ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2.5vw, 1.6rem);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.5rem;
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(220, 245, 50, 0.4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.card figure {
  border-radius: var(--radius-s);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 1.1rem;
  aspect-ratio: 16 / 10;
  background: var(--bg-2);
}

.card figure img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover figure img { transform: scale(1.04); }

.card h3 {
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}

.card p { color: var(--muted); font-size: 0.98rem; }
.card p strong { color: var(--text); }

.wireframe-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background:
    radial-gradient(400px 200px at 50% 120%, rgba(220, 245, 50, 0.12), transparent 70%),
    var(--bg-2);
}
.wireframe-figure svg { width: 100%; height: 100%; }

/* ---------- design ---------- */

.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.5vw, 1.6rem);
  align-items: stretch;
}

.design-grid figure {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.design-grid img {
  border-radius: var(--radius-s);
  width: 100%;
  flex: 1;
  object-fit: cover;
  cursor: zoom-in;
}

.design-logo img.invertible {
  filter: invert(1);
  mix-blend-mode: screen;
  object-fit: contain;
  background: transparent;
}

/* ---------- contatti ---------- */

.contact { text-align: left; }

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
  margin-top: 0.5rem;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.socials a {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.55em 1.1em;
  color: var(--muted);
  background: rgba(10, 13, 18, 0.5);
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.socials a:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.contact-loc { color: var(--muted); }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 2.2rem clamp(1.2rem, 6vw, 5rem) 2.6rem;
  max-width: none;
  background: rgba(7, 9, 12, 0.85);
}

.footer p { font-size: 0.92rem; color: var(--muted); }
.footer strong { color: var(--accent); }
.footer-note { margin-top: 0.5rem; font-size: 0.64rem; }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 6, 9, 0.93);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 4.5rem;
}

.lightbox[hidden] { display: none; }

.lightbox figure {
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.lightbox img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.lightbox figcaption { color: var(--muted); text-align: center; }

.lightbox button {
  position: absolute;
  background: rgba(15, 19, 27, 0.7);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  width: 46px; height: 46px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.lightbox button:hover {
  border-color: var(--accent);
  background: rgba(220, 245, 50, 0.12);
  transform: scale(1.06);
}

.lb-close { top: 1.2rem; right: 1.2rem; }
.lb-prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1.2rem; top: 50%; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) scale(1.06); }
.lb-next:hover { transform: translateY(-50%) scale(1.06); }

/* ---------- reveal on scroll ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--d, 0s);
}

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */

.only-desktop { display: inline; }

@media (max-width: 900px) {
  .about-grid,
  .cycling-grid,
  .cards,
  .design-grid { grid-template-columns: 1fr; }

  .about-photo { max-width: 480px; }

  .nav {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 11, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    z-index: 60;
  }

  body.menu-open .nav {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .nav a { font-size: 1rem; }
  .burger { display: flex; }

  .only-desktop { display: none; }

  .lightbox { padding: 3.5rem 0.8rem; }
  .lb-prev { left: 0.6rem; bottom: 1rem; top: auto; transform: none; }
  .lb-next { right: 0.6rem; bottom: 1rem; top: auto; transform: none; }
  .lb-prev:hover, .lb-next:hover { transform: scale(1.06); }
}

@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 0.2rem; }
  .tv-photos { grid-template-columns: repeat(3, 1fr); }
  .masonry { columns: 2 150px; }
}

/* ---------- accessibilità / reduced motion ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none; }
  .scroll-line::after { animation: none; }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .masonry img, .card figure img { transition: none; }
}
