:root {
  --bg: #12151a;
  --bg-alt: #171b22;
  --card: #1b2029;
  --border: #2a3038;
  --text: #e8e6e1;
  --text-dim: #9aa1ac;
  --accent: #d4a24c;
  --accent-dim: #9c7936;
  --grid-line: rgba(212, 162, 76, 0.035);
  --header-bg: rgba(18, 21, 26, 0.85);
  --btn-accent-text: #16130a;
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --max-width: 960px;
}

:root[data-theme="light"] {
  --bg: #faf8f5;
  --bg-alt: #f1ede6;
  --card: #ffffff;
  --border: #e3ddd2;
  --text: #201d18;
  --text-dim: #6b6459;
  --accent: #8a5c1f;
  --accent-dim: #6e4718;
  --grid-line: rgba(138, 92, 31, 0.05);
  --header-bg: rgba(250, 248, 245, 0.85);
  --btn-accent-text: #ffffff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(90deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; color: var(--text); }

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

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

.section-inner, .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 96px 0; }

.section-index {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 8px;
}

section h2 { font-size: 1.8rem; margin-bottom: 40px; }

/* Scroll progress */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
}

#scroll-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

/* Header */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

#main-nav { display: flex; gap: 24px; flex: 1; }

#main-nav a {
  position: relative;
  font-size: 0.9rem;
  color: var(--text-dim);
  padding-bottom: 4px;
  transition: color 0.15s ease;
}

#main-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

#main-nav a:hover, #main-nav a.active { color: var(--text); }

#main-nav a:hover::after, #main-nav a.active::after { transform: scaleX(1); }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-accent { background: var(--accent); color: var(--btn-accent-text); }
.btn-accent:hover { opacity: 0.88; box-shadow: 0 8px 20px rgba(212, 162, 76, 0.25); }

.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }

.header-cta { margin-left: auto; }

#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}

#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

#theme-toggle svg { display: none; }

#theme-toggle .icon-moon { display: block; }

:root[data-theme="light"] #theme-toggle .icon-moon { display: none; }

:root[data-theme="light"] #theme-toggle .icon-sun { display: block; }

#nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

#nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* Hero */
#hero {
  padding-top: 140px;
  padding-bottom: 120px;
  text-align: center;
}

.hero-inner { max-width: 720px; margin: 0 auto; padding: 0 24px; }

.eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

#hero h1 { font-size: 3rem; margin-bottom: 12px; }

.hero-title { font-size: 1.15rem; color: var(--text); margin: 0 0 20px; }

.hero-lede { color: var(--text-dim); font-size: 1.05rem; max-width: 560px; margin: 0 auto 36px; }

.hero-ctas { display: flex; gap: 16px; justify-content: center; }

/* About */
.about-copy { color: var(--text-dim); font-size: 1.05rem; max-width: 760px; margin: 0 0 20px; }

/* Timeline */
.timeline { position: relative; display: flex; flex-direction: column; gap: 40px; }

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 172px;
  width: 1px;
  background: var(--border);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.1s ease;
}

.reveal.in-view .timeline::before { transform: scaleY(1); }

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 167px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal.in-view .timeline-item::before { opacity: 1; transform: scale(1); }

.timeline-item:nth-child(1)::before { transition-delay: 0.15s; }
.timeline-item:nth-child(2)::before { transition-delay: 0.3s; }
.timeline-item:nth-child(3)::before { transition-delay: 0.45s; }
.timeline-item:nth-child(4)::before { transition-delay: 0.6s; }
.timeline-item:nth-child(5)::before { transition-delay: 0.75s; }
.timeline-item:nth-child(6)::before { transition-delay: 0.9s; }
.timeline-item:nth-child(7)::before { transition-delay: 1.05s; }
.timeline-item:nth-child(8)::before { transition-delay: 1.2s; }

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

.timeline-dates {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

.timeline-body { min-width: 0; }

.timeline-body h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }

.timeline-company { color: var(--text-dim); font-weight: 400; font-family: var(--font-body); }

.timeline-client { color: var(--accent); font-style: italic; font-size: 0.9rem; margin: 0 0 12px; }

.timeline-clients {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.timeline-client-block .timeline-client { margin-bottom: 8px; }

.timeline-body ul { display: flex; flex-direction: column; gap: 8px; }

.timeline-availability {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.timeline-body li {
  color: var(--text-dim);
  font-size: 0.95rem;
  padding-left: 18px;
  position: relative;
  overflow-wrap: break-word;
}

.timeline-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}

.skill-group h3 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 600;
}

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }

.pill-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.pill-list li:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.project-card {
  position: relative;
  overflow: hidden;
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

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

a.project-card:hover::before { transform: scaleX(1); }

.project-card h3 { font-size: 1.05rem; margin-bottom: 8px; }

.project-card p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 16px; min-height: 40px; }

.project-link { color: var(--accent); font-size: 0.85rem; font-weight: 500; display: inline-block; transition: transform 0.2s ease; }

a.project-card:hover .project-link { transform: translateX(3px); }

.project-tag {
  display: inline-block;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

/* Clients & Platforms */
.clients-lede { color: var(--text-dim); margin: 0 0 28px; max-width: 640px; }

.clients-grid { display: flex; flex-wrap: wrap; gap: 12px; }

.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.client-item:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }

.client-item img { display: block; border-radius: 4px; }

/* Education */
.edu-list { display: flex; flex-direction: column; gap: 12px; }

.edu-list li { color: var(--text-dim); }

.edu-list strong { color: var(--text); font-weight: 600; }

/* Contact */
.contact-lede { color: var(--text-dim); margin: 0 0 24px; }

.contact-links { display: flex; flex-wrap: wrap; gap: 24px; }

.contact-links a {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.contact-links a:hover { color: var(--accent); border-color: var(--accent); }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Hero: staggered entrance for each child in turn */
.stagger-reveal > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.stagger-reveal.in-view > *:nth-child(1) { transition-delay: 0s; }
.stagger-reveal.in-view > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-reveal.in-view > *:nth-child(3) { transition-delay: 0.16s; }
.stagger-reveal.in-view > *:nth-child(4) { transition-delay: 0.24s; }
.stagger-reveal.in-view > *:nth-child(5) { transition-delay: 0.32s; }

/* Responsive */
@media (max-width: 720px) {
  #main-nav { display: none; }

  #nav-toggle { display: flex; }

  .header-cta { display: none; }

  #theme-toggle { margin-left: auto; }

  #site-header.nav-open #main-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px 24px;
    gap: 16px;
  }

  #hero { padding-top: 110px; }

  #hero h1 { font-size: 2.1rem; }

  .hero-title { font-size: 1rem; }

  section { padding: 64px 0; }

  .timeline-item { grid-template-columns: 1fr; gap: 8px; }

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

/* Respect reduced-motion preference: content still appears, just without motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
