:root {
  --orange: #ff6c00;
  --blue: #2e79b2;
  --ink: #1c2226;
  --paper: #fbfbfa;
  --line: rgba(28, 34, 38, 0.08);
  --matrix-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='150'%3E%3Ctext x='10' y='18' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.15)'%3E0%3C/text%3E%3Ctext x='10' y='38' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.6)'%3E1%3C/text%3E%3Ctext x='10' y='58' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.35)'%3E/%3C/text%3E%3Ctext x='10' y='78' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.2)'%3E0%3C/text%3E%3Ctext x='10' y='98' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.12)'%3E1%3C/text%3E%3Ctext x='10' y='118' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.07)'%3E/%3C/text%3E%3Ctext x='10' y='138' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.04)'%3E0%3C/text%3E%3Ctext x='50' y='18' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.05)'%3E1%3C/text%3E%3Ctext x='50' y='38' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.08)'%3E/%3C/text%3E%3Ctext x='50' y='58' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.14)'%3E0%3C/text%3E%3Ctext x='50' y='78' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.25)'%3E1%3C/text%3E%3Ctext x='50' y='98' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.6)'%3E/%3C/text%3E%3Ctext x='50' y='118' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.3)'%3E0%3C/text%3E%3Ctext x='50' y='138' font-family='monospace' font-size='14' fill='rgba(46,121,178,0.15)'%3E1%3C/text%3E%3Ctext x='90' y='18' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.3)'%3E/%3C/text%3E%3Ctext x='90' y='38' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.15)'%3E0%3C/text%3E%3Ctext x='90' y='58' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.08)'%3E1%3C/text%3E%3Ctext x='90' y='78' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.05)'%3E/%3C/text%3E%3Ctext x='90' y='98' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.08)'%3E0%3C/text%3E%3Ctext x='90' y='118' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.15)'%3E1%3C/text%3E%3Ctext x='90' y='138' font-family='monospace' font-size='14' fill='rgba(255,108,0,0.5)'%3E/%3C/text%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

h1, h2, h3, .navbar-brand {
  font-weight: 400;
  letter-spacing: 0.03em;
}

a { color: var(--blue); text-decoration: none; }

/* ---------- utility: matrix-style digital rain pattern ---------- */
.matrix-pattern {
  background-image: var(--matrix-tile);
  background-repeat: repeat;
  background-size: 120px 150px;
  animation: matrixRain 9s linear infinite;
}

.thin-divider {
  height: 1px;
  width: 72px;
  margin: 0.75rem auto;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  border: none;
  opacity: 0.8;
}

.thin-divider.wide { width: 100%; max-width: 100%; opacity: 0.25; }

/* ---------- navbar (overlay sulla hero, trasparente finché non si scorre) ---------- */
.navbar-dc {
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.navbar-dc .navbar-brand img { height: 28px; }

.navbar-dc .navbar-brand,
.navbar-dc .nav-link {
  color: #f4f4f2;
  transition: color 0.25s ease;
}

.navbar-dc .nav-link {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 1rem !important;
}

.navbar-dc .nav-link:hover { color: var(--orange); }

.navbar-dc .navbar-toggler {
  border-color: rgba(244, 244, 242, 0.5);
}

.navbar-dc .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(244,244,242,0.9)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.navbar-dc.scrolled {
  background: rgba(251, 251, 250, 0.94);
  backdrop-filter: blur(6px);
  border-bottom-color: var(--line);
  box-shadow: 0 4px 20px -14px rgba(28, 34, 38, 0.35);
}

.navbar-dc.scrolled .navbar-brand,
.navbar-dc.scrolled .nav-link {
  color: var(--ink);
}

.navbar-dc.scrolled .nav-link:hover { color: var(--orange); }

.navbar-dc.scrolled .navbar-toggler {
  border-color: var(--line);
}

.navbar-dc.scrolled .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(28,34,38,0.85)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.25rem 3rem;
  background: linear-gradient(180deg, rgba(15, 20, 24, 0.86), rgba(15, 20, 24, 0.93)),
              url('../img/bg-masthead.jpg') center center / cover no-repeat;
  color: #f4f4f2;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--matrix-tile);
  background-repeat: repeat;
  background-size: 120px 150px;
  opacity: 0.85;
  animation: matrixRain 6s linear infinite;
  pointer-events: none;
}

.hero-logo {
  width: min(128px, 34vw);
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeDown 1s ease forwards 0.15s;
}

.hero-typewriter {
  width: 100%;
  max-width: 960px;
  font-size: clamp(0.95rem, 2.4vw, 1.6rem);
  line-height: 1.9;
  letter-spacing: 0.04em;
  font-weight: 300;
  text-align: justify;
  text-justify: inter-word;
  position: relative;
  z-index: 1;
}

.hero-typewriter > span { display: inline; }

.hero-word {
  display: inline-block;
  white-space: pre;
  opacity: 0;
}

.hero-word.is-visible { opacity: 1; }

.hero-word.orange { color: var(--orange); }
.hero-word.blue { color: var(--blue); }

.hero-word::after {
  content: "";
  display: inline-block;
  width: 0.09em;
}

.hero-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--orange);
  margin-left: 2px;
  vertical-align: -0.15em;
  animation: blink 0.85s steps(1) infinite;
}

.hero-cursor.hidden { display: none; }

.hero-tagline {
  margin-top: 2.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(244, 244, 242, 0.55);
  opacity: 0;
}

.hero-tagline.is-visible {
  animation: fadeUp 0.9s ease forwards;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(244, 244, 242, 0.6);
  font-size: 1.4rem;
  opacity: 0;
  animation: fadeIn 1s ease forwards 2.6s, bounce 2s ease-in-out infinite 3.6s;
  cursor: pointer;
}

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease var(--reveal-delay, 0s), transform 0.7s ease var(--reveal-delay, 0s);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- sections ---------- */
section { padding: 4.5rem 0; }

.section-label {
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.5rem;
}

.about-lead {
  max-width: 680px;
  margin: 0 auto 2.75rem;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--ink);
}

.about-scope {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.about-scope-title {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--blue);
  text-align: center;
  margin-bottom: 1.5rem;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-list li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
  line-height: 1.75;
  font-weight: 300;
  color: rgba(28, 34, 38, 0.75);
}

.about-list li:last-child { border-bottom: 1px solid var(--line); }

.about-list-cat {
  display: inline-block;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--orange);
  margin-right: 0.4rem;
}

.about-list li:nth-child(even) .about-list-cat { color: var(--blue); }

.about-signature {
  max-width: 150px;
  margin-top: 1.75rem;
  opacity: 0.9;
}

/* ---------- portfolio ---------- */
.card-portfolio {
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  background: linear-gradient(180deg, #ffffff, #fbfbfa);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 1px 2px rgba(28, 34, 38, 0.05),
    0 16px 30px -18px rgba(28, 34, 38, 0.28);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.card-portfolio:hover {
  transform: translateY(-8px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 1px 2px rgba(28, 34, 38, 0.06),
    0 26px 42px -18px rgba(28, 34, 38, 0.4);
}

.card-portfolio .card-media {
  height: 150px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-badge {
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  border: 2px solid var(--orange);
  box-shadow: 0 10px 22px -10px rgba(28, 34, 38, 0.4);
  overflow: hidden;
}

.card-portfolio:nth-child(3n+2) .logo-badge { border-color: var(--blue); }

.logo-badge img {
  max-width: 60%;
  max-height: 60%;
  object-fit: contain;
}

.card-portfolio .card-body {
  flex: 1 1 auto;
  padding: 1.35rem 1.4rem 1.15rem;
}

.card-portfolio .card-title {
  font-size: 1.02rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.card-portfolio .card-text {
  font-size: 0.9rem;
  color: rgba(28, 34, 38, 0.7);
  min-height: 2.6em;
}

.card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(90deg, var(--orange), #ff8f3d);
  background-size: 160% 100%;
  background-position: 0% 0%;
  transition: background-position 0.4s ease, gap 0.25s ease;
}

.card-cta svg { transition: transform 0.3s ease; flex: none; }

.card-cta:hover {
  color: #fff;
  gap: 0.75rem;
  background-position: 100% 0%;
}

.card-cta:hover svg { transform: translate(2px, -2px); }

.card-portfolio:nth-child(3n+2) .card-cta {
  background-image: linear-gradient(90deg, var(--blue), #5aa3d8);
}

/* ---------- contact ---------- */
.contact-section {
  background: #12171b;
  color: #f4f4f2;
  text-align: center;
}

.contact-section .section-label { color: var(--orange); }

.contact-link {
  display: block;
  font-size: 1.35rem;
  font-weight: 300;
  color: #f4f4f2;
  margin: 0.4rem 0;
  transition: color 0.2s ease;
}

.contact-link:hover { color: var(--orange); }

.contact-icon { margin-right: 0.5rem; vertical-align: -0.15em; }

/* ---------- footer ---------- */
footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: rgba(28, 34, 38, 0.55);
}

/* ---------- keyframes ---------- */
@keyframes matrixRain {
  from { background-position: 0 0; }
  to { background-position: 0 150px; }
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

@media (max-width: 576px) {
  section { padding: 3.25rem 0; }
  .hero { padding-top: 5rem; }
}
