/* === Reset === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === Custom properties === */
:root {
  --blue: #0000ff;
  --black: #000;
  --white: #fff;
  --gray: #333;
  --light: #f5f5f5;
  --font-body: "Roboto Mono", monospace;
  --font-head: "Roboto Slab", serif;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* === Smooth scroll === */
html {
  scroll-behavior: smooth;
}

/* === Base === */
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */
h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 900;
  line-height: 1.15;
}

h1 {
  font-size: 2.4rem;
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: opacity 0.2s var(--ease);
}

a:hover {
  opacity: 0.6;
}

/* === Layout === */
.site-header,
main,
footer {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* === Header === */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--light);
  transition:
    background 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1rem;
  color: var(--black);
  letter-spacing: -0.02em;
  transition: color 0.3s var(--ease);
}

/* === Hamburger (mobile) === */
.nav-toggle {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.nav-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.nav-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--black);
  transition:
    transform 0.3s var(--ease),
    background 0.3s var(--ease);
  transform-origin: center;
}

/* === Mobile overlay (outside header, direct child of body) === */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.nav-overlay-link {
  color: var(--black);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.4rem;
  transition: opacity 0.2s var(--ease);
}

.nav-overlay-link:hover {
  opacity: 0.6;
}

.nav-overlay-cta {
  color: var(--blue);
  opacity: 0.7;
}

/* Checkbox checked → open overlay, restyle burger & logo */
.nav-toggle:checked ~ .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-toggle:checked ~ .site-header .nav-burger span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle:checked ~ .site-header .nav-burger span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.nav-toggle:checked ~ .site-header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: transparent;
}

/* Desktop inline nav (hidden on mobile) */
.nav-links {
  display: none;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.nav-links a {
  color: var(--black);
  transition: opacity 0.2s var(--ease);
}

.nav-cta {
  color: var(--blue) !important;
}

/* === Hero === */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 1.25rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-text {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin-bottom: 1.5rem;
}

.hero-sub {
  max-width: 540px;
  color: var(--gray);
  font-size: 1.1rem;
}

.hero-portrait {
  display: block;
  width: 60%;
  max-width: 280px;
  height: auto;
  margin-top: 2rem;
  border-radius: 24px;
  align-self: center;
  opacity: 0.9;
}

/* === Sections === */
section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 1.25rem;
}

.section-label {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--blue);
  margin-bottom: 2rem;
}

/* === About — overlapping bordered boxes === */
.about-stack {
  position: relative;
}

.about-card {
  background: var(--white);
  border: 4px solid var(--blue);
  border-radius: 24px;
  padding: 2rem;
  position: relative;
  display: flex;
  align-items: center;
}

.about-card p {
  color: var(--gray);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* Mobile: stack vertically, no overlap */
.about-card--back {
  z-index: 1;
  margin-bottom: 1rem;
}

.about-card--front {
  z-index: 2;
}

/* Parallax reveal: same opacity timing, different travel distances */
.reveal-slow {
  opacity: 0;
  transform: translate(-30px, 40px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
}

.reveal-fast {
  opacity: 0;
  transform: translate(50px, 80px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
}

@supports (animation-timeline: view()) {
  .reveal-slow {
    animation: parallaxSlow linear both;
    animation-timeline: view();
    animation-range: entry 70% entry 100%;
  }

  .reveal-fast {
    animation: parallaxFast linear both;
    animation-timeline: view();
    animation-range: entry 70% entry 100%;
  }

  @keyframes parallaxSlow {
    from {
      opacity: 0;
      transform: translate(-30px, 40px);
    }
    to {
      opacity: 1;
      transform: translate(0, 0);
    }
  }

  @keyframes parallaxFast {
    from {
      opacity: 0;
      transform: translate(50px, 80px);
    }
    to {
      opacity: 1;
      transform: translate(0, 0);
    }
  }
}

@supports not (animation-timeline: view()) {
  .reveal-slow,
  .reveal-fast {
    opacity: 1;
    transform: none;
  }
}

/* === Skills === */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.skill-icon {
  width: 36px;
  height: 36px;
  color: var(--blue);
  margin-bottom: 0.75rem;
}

.skill-item h3 {
  color: var(--black);
}

.skill-item p {
  color: var(--gray);
  font-size: 1rem;
}

/* === Timeline === */
.timeline {
  list-style: none;
  border-left: 2px solid var(--light);
  padding-left: 1.5rem;
}

.timeline-item {
  padding-bottom: 2.5rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  margin-left: -4px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--blue);
  display: block;
  margin-bottom: 0.25rem;
}

.timeline-item h3 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

.timeline-item p {
  color: var(--gray);
  font-size: 1rem;
}

/* === Work / Projects === */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.work-card {
  display: block;
  color: var(--black);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 1px 2px hsl(0 0% 0% / 0.02),
    0 2px 6px hsl(0 0% 0% / 0.02),
    0 6px 16px hsl(0 0% 0% / 0.02),
    0 12px 32px hsl(0 0% 0% / 0.02),
    0 24px 60px hsl(0 0% 0% / 0.02);
  transition:
    opacity 0.3s var(--ease),
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.work-card:hover {
  opacity: 1;
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px hsl(0 0% 0% / 0.02),
    0 4px 10px hsl(0 0% 0% / 0.02),
    0 10px 24px hsl(0 0% 0% / 0.02),
    0 20px 48px hsl(0 0% 0% / 0.02),
    0 40px 80px hsl(0 0% 0% / 0.02);
}

.work-img {
  background: var(--light);
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.work-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-info {
  padding: 1rem;
}

.work-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.work-info p {
  color: var(--gray);
  font-size: 0.9rem;
}

/* === Clients === */
.client-list {
  color: var(--gray);
  max-width: 640px;
  font-size: 0.95rem;
}

/* === Contact === */
.contact {
  padding-top: 6rem;
  padding-bottom: 6rem;
}

.contact h2 {
  margin-bottom: 1rem;
}

.contact p {
  color: var(--gray);
  max-width: 480px;
  margin-bottom: 1.5rem;
}

.cta {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--blue);
  border-bottom: 2px solid var(--blue);
  padding-bottom: 0.15rem;
  transition: opacity 0.2s var(--ease);
}

.cta:hover {
  opacity: 0.6;
}

/* === Footer === */
footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--light);
  font-size: 0.75rem;
  color: var(--gray);
}

/* === Reveal animation (scroll-driven) === */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

@supports (animation-timeline: view()) {
  .reveal {
    animation: revealUp linear both;
    animation-timeline: view();
    animation-range: entry 70% entry 100%;
  }

  /* Staggered work cards: each starts later in the scroll */
  .reveal-d1 {
    animation-range: entry 50% entry 75%;
  }

  .reveal-d2 {
    animation-range: entry 65% entry 90%;
  }

  .reveal-d3 {
    animation-range: entry 80% entry 100%;
  }

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

/* Fallback: show immediately if animation-timeline not supported */
@supports not (animation-timeline: view()) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal-slow,
  .reveal-fast {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }
}

/* === Responsive — Tablet (640px+) === */
@media (min-width: 640px) {
  h1 {
    font-size: 3.5rem;
  }

  h2 {
    font-size: 2.2rem;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
  }

  .work-grid {
    grid-template-columns: 1fr 1fr;
  }

  .about-stack {
    display: grid;
    grid-template-columns: 1fr 3rem 1fr;
    grid-template-rows: 1fr 4fr 1fr;
    gap: 0;
  }

  .about-card--back {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    margin-bottom: 0;
    padding-right: 4rem;
  }

  .about-card--front {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
  }

  .about-card p {
    font-size: 1.15rem;
  }

  .site-header,
  main,
  footer {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .hero {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  section {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

/* === Responsive — Desktop (1024px+) === */
@media (min-width: 1024px) {
  h1 {
    font-size: 4.5rem;
  }

  /* Hide hamburger & overlay, show inline nav */
  .nav-burger {
    display: none;
  }

  .nav-overlay {
    display: none;
  }

  .nav-links {
    display: flex;
    gap: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .about-card {
    padding: 2.5rem;
  }

  .about-card p {
    font-size: 1.2rem;
  }

  .work-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .site-header,
  main,
  footer {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr 6rem 1fr;
    grid-template-rows: 1fr;
    align-items: center;
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .hero-text {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .hero-portrait {
    grid-column: 2 / 4;
    grid-row: 1;
    width: 100%;
    max-width: none;
    margin-top: 0;
    align-self: center;
    justify-self: end;
  }

  section {
    padding: 6rem 3rem;
  }
}
