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

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:           #050505;
  --fg:           #f5f5f5;
  --muted:        #888;
  --muted-light:  #b3b3b3;
  --accent:       #4A90E2;
  --card-bg:      #0f0f0f;
  --border:       #1e1e1e;
  --border-hover: #2e2e2e;
  --max-w:        960px;
  --radius:       10px;
  --nav-h:        60px;
  --font:         "Space Grotesk", system-ui, -apple-system, sans-serif;
}

/* ── Base ────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ─────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(5,5,5,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--fg);
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.nav-brand:hover { opacity: 1; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--fg); }
.nav-cta {
  padding: 6px 14px !important;
  border-radius: 999px;
  border: 1px solid var(--border-hover) !important;
  color: var(--fg) !important;
  background: transparent;
}
.nav-cta:hover {
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--accent) !important;
}

/* ── Section base ────────────────────────────────────── */
section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 80px) 24px 80px;
  position: relative;
}
.section-inner { max-width: var(--max-w); margin: 0 auto; width: 100%; }
.section-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.section-divider {
  width: 32px;
  height: 1px;
  background: var(--accent);
  margin-bottom: 32px;
  opacity: 0.5;
}
.section-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 16px;
}
.section-description {
  font-size: 0.95rem;
  color: var(--muted-light);
  max-width: 500px;
  margin-bottom: 40px;
  line-height: 1.7;
}

/* ── HERO background ─────────────────────────────────── */
#hero {
  background-color: #050505;
  background-image:
    linear-gradient(to bottom, rgba(5,5,5,0.60) 0%, rgba(5,5,5,0.75) 100%),
    url("assets/backgrounds/hero.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
}

.hero-video-bg {
  display: none;
}

#hero .section-inner {
  position: relative;
  z-index: 1;
}
#hero::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 220px;
  background: linear-gradient(to bottom, transparent, #050505);
  pointer-events: none;
}

/* ── ABOUT background ────────────────────────────────── */
#about {
  background-color: #050505;
  background-image:
    linear-gradient(to bottom, rgba(5,5,5,0.68) 0%, rgba(5,5,5,0.80) 100%),
    url("assets/backgrounds/about.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ── PROJECTS background ─────────────────────────────── */
#projects {
  background-color: #050505;
  background-image:
    linear-gradient(to bottom, rgba(5,5,5,0.65) 0%, rgba(5,5,5,0.78) 100%),
    url("assets/backgrounds/projects.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}

.projects-video-bg {
  display: none;
}

#projects .section-inner {
  position: relative;
  z-index: 1;
}

/* ── WRITING background ──────────────────────────────── */
#writing {
  background-color: #050505;
  background-image:
    linear-gradient(to bottom, rgba(5,5,5,0.65) 0%, rgba(5,5,5,0.80) 100%),
    url("assets/backgrounds/writing.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ── CONTACT background ──────────────────────────────── */
#contact {
  background-color: #050505;
  background-image:
    linear-gradient(to bottom, rgba(5,5,5,0.62) 0%, rgba(5,5,5,0.78) 100%),
    url("assets/backgrounds/contact.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 80vh;
  position: relative;
  overflow: hidden;
}

.contact-video-bg {
  display: none;
}

/* ── Unified video background wrapper ───────────────── */
.video-bg-wrap {
  position: absolute;
  inset: -5%;
  width: 110%;
  height: 110%;
  overflow: hidden;
  opacity: 0.7;
  filter: blur(8px) brightness(0.35);
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 40%, transparent 100%);
}
.video-bg-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#hero .section-inner,
#projects .section-inner,
#contact .section-inner {
  position: relative;
  z-index: 1;
}

#contact .section-inner {
  position: relative;
  z-index: 1;
}

/* ── Hero typography ─────────────────────────────────── */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr 520px;
  align-items: center;
  gap: 48px;
}
.hero-portrait {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  overflow: visible;
}
.portrait-img {
  width: 100%;
  max-width: 980px;
  height: 1200px;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  opacity: 0.22;
  mix-blend-mode: luminosity;
  filter: grayscale(20%) contrast(1.08);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, transparent 100%),
                      linear-gradient(to top,  rgba(0,0,0,0) 0%,  rgba(0,0,0,1) 18%);
  mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, transparent 100%),
              linear-gradient(to top,  rgba(0,0,0,0) 0%,  rgba(0,0,0,1) 18%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.hero-eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.hero-title {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.hero-title em { font-style: normal; color: var(--muted); }
.hero-tagline {
  font-size: 1rem;
  max-width: 480px;
  color: var(--muted-light);
  margin-bottom: 40px;
  line-height: 1.7;
}
.hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--fg);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--font);
}
.btn-primary:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  border-color: rgba(255,255,255,0.4);
}
.btn-ghost {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--muted-light);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--font);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.03);
  color: var(--fg);
  border-color: var(--accent);
}

/* ── About ───────────────────────────────────────────── */
.about-body {
  max-width: 600px;
  font-size: 1.08rem;
  color: var(--fg);
  line-height: 1.9;
  margin-bottom: 36px;
}
.about-body p {
  position: relative;
  padding-left: 0;
}
.about-body p + p { margin-top: 20px; }
.about-body em { font-style: normal; color: var(--fg); }

.about-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
  padding-left: 4px;
  border-left: 1px solid var(--border);
  padding-left: 20px;
  max-width: 480px;
}
.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.timeline-year {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  white-space: nowrap;
  min-width: 76px;
}
.timeline-role {
  font-size: 0.88rem;
  color: var(--muted-light);
}

.about-stack { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Tags ────────────────────────────────────────────── */
.tag {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s;
}
.tag:hover { border-color: var(--border-hover); color: var(--muted-light); }

/* ── Projects ────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  background: rgba(15, 15, 15, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  background: rgba(15, 15, 15, 0.72);
  border-color: rgba(74,144,226,0.40);
}
.project-card.featured { grid-column: span 2; }
.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.project-name  { font-size: 1rem;   font-weight: 600; color: var(--fg); }
.project-role  { font-size: 0.78rem; color: var(--accent); font-weight: 500; }
.project-status {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}
.project-description { font-size: 0.88rem; color: var(--muted); line-height: 1.65; flex: 1; }
.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.project-tags  { display: flex; flex-wrap: wrap; gap: 6px; }
.project-link  {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
  white-space: nowrap;
}
.project-link:hover { color: var(--accent); }

/* ── Writing ─────────────────────────────────────────── */
.articles-list { display: flex; flex-direction: column; gap: 16px; max-width: 600px; }
.article-card {
  background: rgba(15, 15, 15, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 22px 20px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
}
.article-card:hover {
  background: rgba(15, 15, 15, 0.72);
  border-color: rgba(74,144,226,0.35);
}
.article-card--featured {
  border-color: rgba(74,144,226,0.25);
  background: rgba(74,144,226,0.06);
}
.article-card--featured:hover {
  border-color: rgba(74,144,226,0.5);
  background: rgba(74,144,226,0.10);
}
.idl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.article-live {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
}
.article-meta  { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.article-title { font-size: 1rem; font-weight: 600; color: var(--fg); line-height: 1.4; }
.article-description { font-size: 0.88rem; color: var(--muted); line-height: 1.65; }
.article-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  align-self: flex-start;
  margin-top: 4px;
}
.article-link-label {
  font-size: 0.75rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  align-self: flex-start;
  transition: opacity 0.15s;
}
.article-card:hover .article-link-label { opacity: 0.8; }

/* ── Contact ─────────────────────────────────────────── */
.contact-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.contact-link {
  font-size: 0.9rem;
  color: var(--muted-light);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.contact-link:hover { color: var(--fg); border-color: var(--accent); }
.contact-link svg { opacity: 0.5; transition: opacity 0.15s; }
.contact-link:hover svg { opacity: 1; }

/* ── Footer ──────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 24px; }
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  gap: 12px;
  flex-wrap: wrap;
}
.footer-inner span:last-child {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

/* ── Scroll reveal ───────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 720px) {
  section { padding: calc(var(--nav-h) + 56px) 18px 56px; }
  .hero-layout { grid-template-columns: 1fr; }
  .hero-portrait { display: none; }
  .hero-title { font-size: 2.1rem; }
  .hero-actions { flex-direction: column; align-items: flex-start; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: span 1; }
  .timeline-item { flex-direction: column; gap: 2px; }
}
@media (max-width: 480px) {
  :root { --nav-h: 56px; }
  .nav-links { display: none; }
}
