/* ==========================================================================
   Brian Potosi — CV / Portfolio stylesheet
   Vanilla CSS, mobile-first. Design system lives in :root custom properties.
   Contents:
     1. Custom properties + reset
     2. Base typography & selection
     3. Utilities (container, glass, gradient text, skip link, sr-only)
     4. Buttons
     5. Header / navigation
     6. Hero (canvas, typewriter, CTA, social)
     7. Sections (eyebrow / title)
     8. Chi sono
     9. Competenze (chips)
    10. Esperienza (timeline)
    11. Progetti (cards)
    12. Formazione e lingue
    13. Contatti
    14. Footer
    15. Scroll-reveal animation
    16. Reduced motion
    17. Print (Ctrl+P -> clean CV PDF)
   ========================================================================== */

/* 1. Custom properties + reset
   -------------------------------------------------------------------------- */
:root {
  /* Palette: deep navy near-black base, violet -> cyan accent gradient */
  --bg-0: #07080f;
  --bg-1: #0b0d1a;
  --bg-raise: #10132210;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --gradient: linear-gradient(135deg, var(--violet), var(--cyan));
  --gradient-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(34, 211, 238, 0.16));

  --text: #eceef8;
  --muted: #a4abc2;

  /* Typography */
  --font-heading: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Layout + shape */
  --container: 1100px;
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 68px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --speed: 0.45s;

  /* Elevation */
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.45);
  --glow: 0 0 24px rgba(139, 92, 246, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg-0);
  /* Ambient violet/cyan glows behind everything */
  background-image:
    radial-gradient(42rem 30rem at 85% -5%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(38rem 28rem at -10% 30%, rgba(34, 211, 238, 0.08), transparent 60%),
    radial-gradient(46rem 34rem at 60% 110%, rgba(139, 92, 246, 0.09), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--cyan);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(139, 92, 246, 0.45);
  color: #fff;
}

/* Visible, consistent keyboard focus */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 2. Base typography scale helpers
   -------------------------------------------------------------------------- */
.section-title {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 700;
}

/* 3. Utilities
   -------------------------------------------------------------------------- */
.container {
  width: min(var(--container), 92%);
  margin-inline: auto;
}

.section {
  padding-block: clamp(4.5rem, 10vw, 7rem);
  scroll-margin-top: var(--header-h);
}

/* Alternate sections get a slightly raised background band */
.section-alt {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0));
  border-block: 1px solid rgba(255, 255, 255, 0.05);
}

.section-eyebrow {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 0.6rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}

/* Glassmorphism surface */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Skip link: hidden until focused */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Screen-reader only */
.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;
}

.print-role {
  display: none;
}

/* 4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: transform var(--speed) var(--ease-out), box-shadow var(--speed) var(--ease-out),
    background-color var(--speed) var(--ease-out), border-color var(--speed) var(--ease-out);
}

.btn-primary {
  background: var(--gradient);
  color: #07080f;
  border: 1px solid transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: var(--glow);
}

.btn:active {
  transform: translateY(0);
}

/* 5. Header / navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 8, 15, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--speed) var(--ease-out), background-color var(--speed) var(--ease-out);
}

.site-header.scrolled {
  border-bottom-color: var(--border);
  background: rgba(7, 8, 15, 0.88);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--gradient);
  color: #07080f;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
}

/* Hamburger (mobile only) */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.3s var(--ease-out), opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(4) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile dropdown panel */
.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 0.75rem 4% 1.25rem;
  background: rgba(9, 10, 20, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), visibility 0.25s;
}

body.nav-open .site-nav {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-list {
  display: grid;
  gap: 0.15rem;
}

.nav-link {
  display: block;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--font-heading);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--text);
  background: var(--gradient-soft);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.nav-cta {
  margin-top: 0.4rem;
  text-align: center;
  color: #07080f;
  background: var(--gradient);
}

.nav-cta:hover,
.nav-cta.active {
  color: #07080f;
  background: var(--gradient);
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.35);
}

/* Desktop: inline horizontal nav */
@media (min-width: 860px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    padding: 0;
    background: transparent;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .nav-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.45rem 0.85rem;
    font-size: 0.93rem;
  }

  .nav-cta {
    margin: 0 0 0 0.5rem;
    border: 1px solid transparent;
  }
}

/* 6. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100svh - var(--header-h));
  padding-block: 4rem 5rem;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero-eyebrow {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.hero-name {
  font-size: clamp(2.8rem, 9vw, 5.2rem);
  font-weight: 700;
  margin-bottom: 0.35em;
}

.hero-role {
  min-height: 2.2em;
  margin-bottom: 1rem;
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 3.4vw, 1.6rem);
  font-weight: 500;
  color: var(--text);
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 3px;
  vertical-align: -0.2em;
  background: var(--cyan);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.hero-tagline {
  max-width: 34rem;
  margin-inline: auto;
  margin-bottom: 2.2rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.hero-social {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
}

.hero-social a {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out),
    box-shadow 0.25s ease;
}

.hero-social a:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.18);
}

/* Scroll-down hint at the bottom edge of the hero */
.scroll-hint {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  animation: bob 2.4s ease-in-out infinite;
}

.scroll-hint:hover {
  color: var(--cyan);
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(7px);
  }
}

/* 7. Sections (extra rhythm between eyebrow and title) handled above.
   -------------------------------------------------------------------------- */

/* 8. Chi sono
   -------------------------------------------------------------------------- */
.about-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  margin-top: 1.5rem;
}

.about-text p {
  color: var(--muted);
  max-width: 56ch;
}

.about-facts {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.8rem;
  padding: 1.4rem 1.5rem;
  border-left: 2px solid;
  border-image: var(--gradient) 1;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.fact {
  display: grid;
  gap: 0.1rem;
}

.fact dt {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.fact dd {
  margin: 0;
  color: var(--text);
}

.about-photo {
  margin: 0;
  justify-self: center;
  width: min(320px, 80%);
}

.photo-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.6rem;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: var(--gradient-soft);
  border: 1px dashed var(--border-strong);
}

.photo-placeholder span {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.photo-placeholder figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 860px) {
  .about-grid {
    grid-template-columns: 1.4fr 1fr;
    gap: 3.5rem;
  }

  .about-photo {
    justify-self: end;
  }
}

/* 9. Competenze
   -------------------------------------------------------------------------- */
.skills-grid {
  display: grid;
  gap: 1.4rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.skills-group {
  padding: 1.6rem;
  transition: transform var(--speed) var(--ease-out), border-color var(--speed) ease,
    box-shadow var(--speed) ease;
}

.skills-group:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: var(--shadow-soft), var(--glow);
}

.skills-group h3 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  padding: 0.38rem 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease-out);
}

.chip:hover {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.22);
  transform: translateY(-1px);
}

/* 10. Esperienza — vertical timeline
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  margin-top: 1.8rem;
  padding-left: 2rem;
  display: grid;
  gap: 2rem;
}

/* The vertical rail */
.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 7px;
  width: 2px;
  background: linear-gradient(180deg, var(--violet), var(--cyan));
  opacity: 0.55;
  border-radius: 2px;
}

.timeline-item {
  position: relative;
}

/* The dot on the rail */
.timeline-item::before {
  content: "";
  position: absolute;
  top: 10px;
  left: -2rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-0);
  border: 3px solid var(--violet);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

.timeline-card {
  padding: 1.5rem 1.7rem;
  transition: transform var(--speed) var(--ease-out), border-color var(--speed) ease;
}

.timeline-card:hover {
  transform: translateX(4px);
  border-color: var(--border-strong);
}

.timeline-date {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}

.timeline-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.15rem;
}

.timeline-org {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.7rem;
}

.timeline-card > p:not(.timeline-date):not(.timeline-org) {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

@media (min-width: 860px) {
  .timeline {
    padding-left: 2.4rem;
    gap: 2.4rem;
  }
}

/* 11. Progetti — card grid with gradient border on hover
   -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  gap: 1.4rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.6rem;
  border: 1px solid transparent;
  transition: transform var(--speed) var(--ease-out), box-shadow var(--speed) ease;
}

/* Gradient border drawn with the two-layer background trick */
@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-5px);
    background:
      linear-gradient(var(--bg-1), var(--bg-1)) padding-box,
      var(--gradient) border-box;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft), 0 14px 40px rgba(139, 92, 246, 0.22);
  }
}

.project-kicker {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
  margin-bottom: 0.4rem;
}

.project-card h3 {
  font-size: 1.25rem;
}

.project-card > p:not(.project-kicker) {
  color: var(--muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.project-links {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.9rem;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--cyan);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.project-links a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-links svg {
  transition: transform 0.2s var(--ease-out);
}

.project-links a:hover svg {
  transform: translate(2px, -2px);
}

/* Shared small tech tags (timeline + projects) */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-row li {
  padding: 0.22rem 0.7rem;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* 12. Formazione e lingue
   -------------------------------------------------------------------------- */
.edu-grid {
  display: grid;
  gap: 2.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 860px) {
  .edu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 3.5rem;
  }
}

.edu-heading {
  font-size: 1.15rem;
  padding-bottom: 0.7rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}

.edu-list {
  display: grid;
  gap: 1.4rem;
}

.edu-item {
  position: relative;
  padding-left: 1.4rem;
}

.edu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient);
}

.edu-date {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--violet);
  margin-bottom: 0.2rem;
}

.edu-item h4 {
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}

.edu-org {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.lang-list {
  display: grid;
  gap: 1.4rem;
}

.lang-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.lang-name {
  font-family: var(--font-heading);
  font-weight: 600;
}

.lang-level {
  color: var(--muted);
  font-size: 0.85rem;
}

.lang-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.lang-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
}

/* 13. Contatti
   -------------------------------------------------------------------------- */
.contact-inner {
  text-align: center;
}

.contact-text {
  max-width: 36rem;
  margin-inline: auto;
  color: var(--muted);
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .contact-actions {
    flex-direction: row;
    justify-content: center;
  }

  .contact-social {
    margin-left: 0.5rem;
  }
}

/* 14. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner p {
  margin: 0;
}

.to-top {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 500;
}

.to-top:hover {
  color: var(--cyan);
}

/* 15. Scroll-reveal
   -------------------------------------------------------------------------- */
/* Only hide content when JS is available (html.js), otherwise everything shows. */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Small stagger for siblings revealed together (grids, timeline) */
.js .reveal.is-visible:nth-child(2) {
  --reveal-delay: 0.08s;
}

.js .reveal.is-visible:nth-child(3) {
  --reveal-delay: 0.16s;
}

.js .reveal.is-visible:nth-child(4) {
  --reveal-delay: 0.24s;
}

/* 16. Reduced motion: everything visible, no movement
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .cursor {
    animation: none;
  }

  .scroll-hint {
    animation: none;
  }
}

/* 17. Print — Ctrl+P produces a clean black-on-white CV
   -------------------------------------------------------------------------- */
@media print {
  :root {
    --bg-0: #ffffff;
    --bg-1: #ffffff;
    --surface: #ffffff;
    --surface-strong: #f2f2f2;
    --border: #cccccc;
    --border-strong: #999999;
    --text: #111111;
    --muted: #444444;
    --violet: #6d3fd4;
    --cyan: #0e7490;
    --shadow-soft: none;
    --glow: none;
    --gradient: none;
    --gradient-soft: none;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11.5pt;
    line-height: 1.5;
  }

  /* Hide screen-only chrome */
  .site-header,
  .hero-canvas,
  .scroll-hint,
  .hero-cta,
  .cursor,
  .typewriter-line,
  .skip-link,
  .to-top,
  .project-links,
  .contact-actions .btn {
    display: none !important;
  }

  .print-role {
    display: inline;
    font-weight: 600;
  }

  /* Solid, ink-friendly hero */
  .hero {
    min-height: auto;
    padding-block: 0 1.5rem;
  }

  .hero-name,
  .gradient-text,
  .section-eyebrow,
  .project-kicker {
    color: #111 !important;
    background: none !important;
    -webkit-background-clip: initial;
    background-clip: initial;
  }

  .hero-name {
    font-size: 26pt;
  }

  .hero-social {
    display: none;
  }

  /* Sections stack compactly, no page breaks inside cards */
  .section {
    padding-block: 1.1rem;
    scroll-margin-top: 0;
  }

  .section-alt {
    background: none;
    border: 0;
  }

  .glass,
  .skills-group,
  .timeline-card,
  .project-card {
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #fff;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  /* Flatten layout grids for print */
  .about-grid,
  .skills-grid,
  .projects-grid,
  .edu-grid {
    display: block;
  }

  .about-photo,
  .photo-placeholder {
    display: none;
  }

  .skills-group {
    margin-bottom: 0.7rem;
    padding: 0.7rem 1rem;
    border: 0;
    border-left: 2px solid #999;
    border-radius: 0;
  }

  .chips {
    gap: 0.3rem;
  }

  .chip,
  .tag-row li {
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    padding: 0.1rem 0.5rem;
    font-size: 8.5pt;
  }

  .timeline {
    padding-left: 1.2rem;
    gap: 0.9rem;
  }

  .timeline::before,
  .timeline-item::before {
    display: none;
  }

  .timeline-card {
    border: 0;
    border-top: 1px solid #ddd;
    border-radius: 0;
    padding: 0.6rem 0 0.3rem;
  }

  .timeline-card:hover {
    transform: none;
  }

  .lang-meter {
    border: 1px solid #ccc;
    background: #fff;
    height: 7px;
  }

  .lang-fill {
    background: #555;
  }

  /* Surface the URLs that matter when printing */
  #contatti a[href^="mailto"]::after {
    content: " — " attr(href);
    font-size: 9.5pt;
    color: #444;
  }

  .edu-item::before {
    background: #555;
  }

  .site-footer {
    border-top: 1px solid #ddd;
    color: #555;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}
