/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Now';
  src: url('../fonts/Now-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Now';
  src: url('../fonts/Now-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Now';
  src: url('../fonts/Now-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --bg: #F5F5F7;
  --surface: rgba(255, 255, 255, 0.65);
  --surface-nav: rgba(255, 255, 255, 0.72);
  --surface-border: rgba(255, 255, 255, 0.6);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --accent: #0071E3;
  --accent-hover: #0060c2;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-violet-bg: rgba(124, 92, 255, 0.12);
  --accent-violet-text: #6E42E0;
  --accent-pink-bg: rgba(255, 95, 168, 0.14);
  --accent-pink-text: #E0398A;
  --hero-glow-a: rgba(10, 132, 255, 0.16);
  --hero-glow-b: rgba(124, 92, 255, 0.14);
  --hero-glow-c: rgba(255, 95, 168, 0.11);
  --hairline: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --font-display: 'Now', system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-nav: rgba(20, 20, 22, 0.72);
  --surface-border: rgba(255, 255, 255, 0.12);
  --text-primary: #F5F5F7;
  --text-secondary: #98989D;
  --accent: #0A84FF;
  --accent-hover: #3aa0ff;
  --accent-soft: rgba(10, 132, 255, 0.16);
  --accent-violet-bg: rgba(124, 92, 255, 0.20);
  --accent-violet-text: #9E8CFF;
  --accent-pink-bg: rgba(255, 95, 168, 0.20);
  --accent-pink-text: #FF7FBE;
  --hero-glow-a: rgba(10, 132, 255, 0.38);
  --hero-glow-b: rgba(124, 92, 255, 0.34);
  --hero-glow-c: rgba(255, 95, 168, 0.22);
  --hairline: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

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

button {
  font: inherit;
}

svg {
  width: 100%;
  height: 100%;
}

/* ---------- Layout helpers ---------- */
.section-inner, .nav-inner {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 120px 0;
}

/* ---------- Scroll reveal (progressive enhancement) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    transform: none;
  }
}

/* ---------- Nav ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--surface-nav);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.site-nav.scrolled {
  border-bottom-color: var(--hairline);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand:hover {
  text-decoration: none;
}

.brand-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-soft);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-link, .menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
}

.icon-link svg, .menu-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-link:hover, .menu-toggle:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.icon-link:active, .menu-toggle:active {
  transform: scale(0.94);
}

.menu-toggle {
  display: none;
  position: relative;
}

.menu-toggle .icon-close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 2px;
  padding: 8px 24px 20px;
  background: var(--surface-nav);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

.mobile-menu.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.mobile-menu .nav-link {
  font-size: 14px;
  padding: 12px 10px;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
  .mobile-menu {
    display: flex;
  }
}

/* ---------- Hero ----------
   The gradient-mesh treatment adapts to the light/dark toggle like the rest
   of the page: same structure, softer glow intensity in light mode so it
   reads as a tint rather than a neon wash on a bright background. */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding-top: 64px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-primary);
}

/* Fades the hero's dark/glow bottom edge into the page's actual --bg instead of
   a hard cut — resolves to the right hand-off colour in either theme automatically. */
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 170px;
  background: linear-gradient(to bottom, transparent 0%, var(--bg) 100%);
  z-index: 0;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.hero-glow-a {
  width: 60vw;
  max-width: 760px;
  height: 60vw;
  max-height: 760px;
  top: -28vw;
  left: -14vw;
  background: radial-gradient(circle, var(--hero-glow-a) 0%, transparent 68%);
}

.hero-glow-b {
  width: 55vw;
  max-width: 680px;
  height: 55vw;
  max-height: 680px;
  top: -8vw;
  right: -18vw;
  background: radial-gradient(circle, var(--hero-glow-b) 0%, transparent 68%);
  animation-delay: -4s;
}

.hero-glow-c {
  width: 50vw;
  max-width: 620px;
  height: 50vw;
  max-height: 620px;
  bottom: -26vw;
  left: 20%;
  background: radial-gradient(circle, var(--hero-glow-c) 0%, transparent 70%);
  animation-delay: -9s;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-glow {
    animation: hero-glow-drift 14s ease-in-out infinite alternate;
  }
}

@keyframes hero-glow-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-3%, 2%) scale(1.06); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 5rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
  min-height: 1.1em;
}

.hero-title.typing {
  border-right: 2px solid var(--accent);
  padding-right: 4px;
  animation: caret 0.8s steps(1) infinite;
}

@keyframes caret {
  50% { border-color: transparent; }
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 38ch;
  margin: 0;
}

.hero-chip {
  position: absolute;
  z-index: 1;
  bottom: 17%;
  right: 6%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.hero-chip b {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 700px) {
  .hero-chip {
    display: none;
  }
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  z-index: 1;
  color: var(--text-secondary);
  animation: bounce 2.5s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.4; }
  50% { transform: translate(-50%, 6px); opacity: 1; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* Frosted glass reads well on the hero's dark gradient mesh, but a translucent white
   pill disappears on a light background — light mode gets a solid accent fill instead,
   the same treatment as .btn-primary. */
.btn-glass {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.btn-glass:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

:root[data-theme="dark"] .btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #F5F5F7;
}

:root[data-theme="dark"] .btn-glass:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn:active {
  transform: scale(0.97);
}

/* ---------- Section titles / body text ---------- */
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.body-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 60ch;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: center;
}

.about-content .body-text {
  max-width: none;
}

.about-photo {
  display: flex;
  justify-content: center;
}

.profile-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Two chips echo the hero's violet/pink so the tools list feels like the same
   family of colour as the hero, without turning into a rainbow. */
.chip.accent-violet {
  background: var(--accent-violet-bg);
  color: var(--accent-violet-text);
}

.chip.accent-pink {
  background: var(--accent-pink-bg);
  color: var(--accent-pink-text);
}

@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .about-photo {
    order: -1;
  }
  .chip-list, .body-text {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- Experience timeline ---------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 40px;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--hairline);
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-card {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 16px;
}

.role-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.role-org {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--accent);
}

.role-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-desc {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-desc li {
  position: relative;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.role-desc li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--hairline);
}

@media (max-width: 600px) {
  .timeline {
    padding-left: 20px;
  }
  .timeline-item::before {
    left: -20px;
  }
  .timeline-card {
    padding: 22px 20px;
  }
  .role-date {
    margin-left: 0;
  }
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.project-card {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.project-link {
  margin-top: auto;
  padding-top: 8px;
  font-weight: 500;
  color: var(--accent);
}

.project-link-muted {
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--hairline);
}

/* ---------- Accessibility media queries ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .scroll-cue {
    animation: none;
  }
  .hero-title.typing {
    animation: none;
    border-right-color: transparent;
  }
  .mobile-menu {
    transition: opacity 0.15s ease;
    transform: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-nav, .mobile-menu, .timeline-card, .project-card, .hero-chip {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --hairline: rgba(0, 0, 0, 0.4);
  }
  :root[data-theme="dark"] {
    --hairline: rgba(255, 255, 255, 0.5);
  }
  .timeline-card, .project-card, .hero-chip {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--text-primary);
  }
  .site-nav {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--text-primary);
  }
}
