:root {
  --bg: #08080f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ececf1;
  --text-muted: #a0a0b0;
  --text-faint: #55556b;

  --accent-1: #7dd3fc;
  --accent-2: #c4b5fd;
  --accent-3: #86efac;
  --accent-4: #f0abfc;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.65;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* --- Ambient background --- */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(125, 211, 252, 0.09), transparent 70%),
    radial-gradient(ellipse 55% 45% at 85% 75%, rgba(196, 181, 253, 0.10), transparent 70%),
    radial-gradient(ellipse 45% 40% at 50% 100%, rgba(240, 171, 252, 0.06), transparent 70%);
  pointer-events: none;
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}
.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--hero-bg);
  background-size: auto 220%;
  background-position: left center;
  background-repeat: no-repeat;
  opacity: 0.33;
  filter: grayscale(1);
  mask-image: radial-gradient(ellipse at 15% 50%, rgba(0,0,0,0.7) 0%, transparent 40%);
  -webkit-mask-image: radial-gradient(ellipse at 15% 50%, rgba(0,0,0,0.7) 0%, transparent 40%);
  pointer-events: none;
}

.hero-grid {
  width: 100%;
  max-width: 1500px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 3rem;
  align-items: center;
}
.hero-inner {
  min-width: 0;
}

.hero-mosaic-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 1s var(--ease) 0.5s forwards;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.7s forwards;
}
.hero-actions .hero-cta {
  animation: none;
  opacity: 1;
}
button.mosaic-reveal {
  cursor: pointer;
  font-family: var(--font-sans);
}
.mosaic-reveal.is-hidden {
  opacity: 0.4;
  pointer-events: none;
}

.hero-mosaic {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  grid-auto-flow: dense;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.hero-mosaic-wrap.revealed .hero-mosaic {
  opacity: 1;
  pointer-events: auto;
}
.hero-mosaic-wrap.revealed .m-tile {
  animation: tileIn 0.7s var(--ease) var(--tile-delay, 0ms) backwards;
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.m-tile {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid var(--border);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.m-tile img,
.m-tile video,
.m-tile iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.m-tile:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--border-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.m-tile.size-hero {
  grid-column: span 2;
  grid-row: span 2;
  border-radius: 18px;
}
.m-tile.size-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-radius: inherit;
  pointer-events: none;
}
.m-tile.size-wide { grid-column: span 2; }
.m-tile.size-tall { grid-row: span 2; }
.hero-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 1rem;
  display: inline-block;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.1s forwards;
}

.hero-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  color: var(--accent-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.25s forwards;
}
.hero-tagline {
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.4s forwards;
}
.hero-contact {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.55s forwards;
}
.hero-contact a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  color: var(--text-muted);
  transition: all 0.4s var(--ease);
}
.hero-contact a:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-2px);
}
.hero-contact svg { width: 18px; height: 18px; }
.hero-contact a.copied {
  border-color: var(--accent-3);
  color: var(--accent-3);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 999px;
  transition: all 0.4s var(--ease);
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) 0.7s forwards;
}
.hero-cta:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}
.hero-cta .arrow {
  transition: transform 0.4s var(--ease);
  opacity: 0.7;
}
.hero-cta:hover .arrow { transform: translateY(3px); opacity: 1; }

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

/* --- Scroll indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--border-strong), transparent);
  overflow: hidden;
}
.scroll-indicator span {
  display: block;
  width: 1px;
  height: 16px;
  background: var(--text);
  animation: scrollPulse 2.2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0% { transform: translateY(-16px); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(48px); opacity: 0; }
}

/* --- About --- */
.about {
  padding: 7rem 2rem 5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.about-inner {
  display: flex;
  gap: 3rem;
  align-items: center;
  flex-wrap: wrap;
}
.about-image {
  flex: 0 0 200px;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.about-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-text {
  flex: 1;
  min-width: 280px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

/* --- Timeline --- */
.timeline-section {
  padding: 3rem 2rem 7rem;
  max-width: 1400px;
  margin: 0 auto;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-bottom: 4rem;
  text-align: center;
}
.timeline {
  position: relative;
  padding: 2rem 0;
}
.timeline-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  background: var(--border);
}
.timeline-progress {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 0;
  background: linear-gradient(
    to bottom,
    var(--accent-1),
    var(--accent-2),
    var(--accent-3),
    var(--accent-4)
  );
  box-shadow: 0 0 8px rgba(196, 181, 253, 0.35);
  transition: height 0.1s linear;
}
.timeline-progress::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 24px var(--accent-2);
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 6rem;
}
.timeline-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0;
  align-items: start;
  opacity: 0;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.timeline-item:nth-child(odd) { transform: translateX(-32px); }
.timeline-item:nth-child(even) { transform: translateX(32px); }
.timeline-item:nth-child(even) .project-media { order: 3; }
.timeline-item:nth-child(even) .project-body { order: 1; }
.timeline-item:nth-child(even) .timeline-node { order: 2; }
.timeline-item.revealed {
  opacity: 0.3;
  transform: translateX(0);
  filter: blur(3px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.6s var(--ease);
}
.timeline-item.in-view {
  opacity: 1;
  filter: none;
}

.timeline-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: all 0.5s var(--ease);
  z-index: 2;
  justify-self: center;
  margin-top: 2rem;
}
.timeline-item.revealed .timeline-node {
  background: var(--project-color);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--project-color) 15%, transparent),
    0 0 20px color-mix(in srgb, var(--project-color) 40%, transparent);
}

.project-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(1.1);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.5s var(--ease);
}
.project-media:hover {
  border-color: color-mix(in srgb, var(--project-color) 50%, var(--border-strong));
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 30px color-mix(in srgb, var(--project-color) 15%, transparent);
  transform: translateY(-4px);
}
.project-media video,
.project-media img,
.project-media iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease), filter 0.5s var(--ease);
  filter: saturate(0.9);
}
.project-media:hover video,
.project-media:hover img {
  filter: saturate(1.05);
  transform: scale(1.02);
}
.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
}
.project-media:hover .play-btn { opacity: 1; }
.play-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(0, 0, 0, 0.65);
}
.play-btn svg { width: 18px; height: 18px; }

.project-body {
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.85rem;
  gap: 1rem;
}
.project-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.project-date {
  font-family: var(--font-sans);
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.project-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.65;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.project-tag {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem;
  background: color-mix(in srgb, var(--project-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--project-color) 28%, transparent);
  color: color-mix(in srgb, var(--project-color) 85%, white);
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  padding-top: 0.85rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border);
  width: 100%;
  transition: gap 0.3s var(--ease), color 0.3s var(--ease);
}
.project-link:hover {
  gap: 0.7rem;
  color: var(--project-color);
}

/* --- Footer --- */
.footer {
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .hero-bg {
    background-size: cover;
    background-position: center 20%;
    opacity: 0.4;
    mask-image: radial-gradient(ellipse 70% 50% at 50% 25%, rgba(0,0,0,0.9) 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 25%, rgba(0,0,0,0.9) 0%, transparent 75%);
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .hero-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hero-tagline { margin-left: auto; margin-right: auto; }
  .hero-mosaic-wrap {
    aspect-ratio: 1;
    max-width: 240px;
    margin: 1.5rem auto 5rem;
    position: relative;
    isolation: isolate;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px rgba(125, 211, 252, 0.12);
    border-radius: 50%;
  }
  .hero-mosaic-wrap::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
      from 0deg,
      var(--accent-1),
      var(--accent-2),
      var(--accent-3),
      var(--accent-4),
      var(--accent-1)
    );
    animation: ringSpin 10s linear infinite;
    z-index: 0;
  }
  @keyframes ringSpin {
    to { transform: rotate(360deg); }
  }
  .mosaic-reveal { display: none; }
  .hero-mosaic {
    display: block;
    position: relative;
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
    inset: unset;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg);
  }
  .hero-mosaic .m-tile {
    display: none;
    animation: none;
    border: 0;
    border-radius: 50%;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .hero-mosaic .m-tile.size-hero {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    grid-column: unset;
    grid-row: unset;
  }
}

@media (max-width: 768px) {
  html {
    scroll-snap-type: y mandatory;
  }
  .hero { scroll-snap-align: start; }
  .footer { scroll-snap-align: end; }
  .timeline-item {
    scroll-snap-align: center;
    scroll-snap-stop: always;
    scroll-margin-top: 2rem;
  }
  .timeline-line,
  .timeline-progress { left: 18px; }
  .timeline-items { gap: 3rem; }
  .timeline-item {
    display: flex;
    flex-direction: column;
    padding: 0 0 0 2.75rem;
    transform: translateX(24px) !important;
  }
  .timeline-item.revealed { transform: translateX(0) !important; }
  .timeline-item .project-media { order: 1 !important; margin-bottom: 1rem; }
  .timeline-item .timeline-node {
    order: 0 !important;
    position: absolute;
    left: 12px;
    margin-top: 2rem;
  }
  .timeline-item .project-body { order: 2 !important; padding: 0; }
  .about-inner { gap: 2rem; }
  .about { padding: 5rem 1.5rem 3rem; }
}

@media (max-width: 480px) {
  .hero { padding: 1.5rem; }
  .timeline-section { padding: 2rem 1rem 4rem; }
  .project-body { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-name, .hero-title, .hero-tagline, .hero-contact, .hero-cta { opacity: 1; }
  .timeline-item { opacity: 1; transform: none !important; }
  html { scroll-behavior: auto; }
}
