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

:root {
  --bg-dark: #0a0a0a;
  --bg-section: #111111;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --text-primary: #e8e5e0;
  --text-secondary: #a09d98;
  --text-muted: #6b6965;
  --accent: #4d94d4;
  --accent-dim: rgba(0, 51, 102, 0.25);
  --accent-glow: rgba(77, 148, 212, 0.3);
  --accent-subtle: rgba(77, 148, 212, 0.08);
  --border: #2a2a2a;
  --border-light: #333333;
  --nav-bg: rgba(10, 10, 10, 0.92);
  --nav-mobile-bg: rgba(10, 10, 10, 0.97);
  --radius: 6px;
  --max-width: 800px;
  --max-width-wide: 900px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] {
  --bg-dark: #f8f7f4;
  --bg-section: #efede8;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f3ef;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4744;
  --text-muted: #8a8580;
  --accent: #003366;
  --accent-dim: rgba(0, 51, 102, 0.1);
  --accent-glow: rgba(0, 51, 102, 0.2);
  --accent-subtle: rgba(0, 51, 102, 0.04);
  --border: #e0ddd7;
  --border-light: #d4d0c9;
  --nav-bg: rgba(248, 247, 244, 0.92);
  --nav-mobile-bg: rgba(248, 247, 244, 0.97);
}

[data-theme="light"] a:hover { color: #004d99; }
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .btn-primary:hover { color: #fff; }
[data-theme="light"] .skill-item { background: rgba(0, 0, 0, 0.04); }
[data-theme="light"] .tag { color: #003366; }
[data-theme="light"] .project-card.open { border-left-color: #003366; }

/* ===== GLOBAL ===== */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* Accent top border — design signature */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  z-index: 1001;
}

/* Selection */
::selection {
  background: rgba(77, 148, 212, 0.25);
  color: var(--text-primary);
}
[data-theme="light"] ::selection {
  background: rgba(0, 51, 102, 0.2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-feature-settings: 'liga' 1, 'kern' 1;
}
h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 600;
}
h3 { font-size: clamp(1.1rem, 2vw, 1.3rem); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: #6baeed; }

/* ===== LAYOUT ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: 7rem 0;
  position: relative;
}

section:nth-child(even) {
  background: var(--bg-section);
}

.section-title {
  margin-bottom: 3.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  letter-spacing: -0.01em;
}

/* ===== SCROLL REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== NAVIGATION ===== */
nav {
  position: fixed;
  top: 2px; /* below accent line */
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 1080px;
  gap: 1.5rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.nav-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-icon {
  flex-shrink: 0;
  opacity: 0.85;
  width: 14px;
  height: 14px;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--transition-fast);
  position: relative;
  padding-bottom: 2px;
}

/* Underline draw-in on hover */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: var(--transition-fast);
}

/* ===== HERO ===== */
#hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 62px 0 0 0;
  background: var(--bg-dark);
  position: relative;
  overflow: hidden;
}

/* Large ambient glow */
#hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--accent-subtle) 0%, transparent 65%);
  pointer-events: none;
}

/* Secondary glow bottom-left */
#hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-subtle) 0%, transparent 65%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-label {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid rgba(77, 148, 212, 0.3);
  border-radius: 3px;
}

.hero-name {
  margin: 0.5rem 0 1.5rem;
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-primary:hover {
  background: #6baeed;
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ===== PROFILE ===== */
.profile-text {
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--text-secondary);
  max-width: 700px;
}

/* ===== EXPERIENCE ===== */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent-dim), var(--border), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem - 4px);
  top: 0.45rem;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--bg-dark), 0 0 0 4px var(--accent-dim);
}

.timeline-role {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.timeline-company {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 0.15rem;
}

.timeline-dates {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.85rem;
}

.timeline-bullets {
  list-style: none;
  padding: 0;
}

.timeline-bullets li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.timeline-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 1px;
  background: var(--text-muted);
}

/* ===== PROJECTS ===== */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: var(--max-width-wide);
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.project-card.open {
  border-left-color: var(--accent);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.project-header:hover {
  background: var(--bg-card-hover);
}

.project-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.project-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.project-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color var(--transition-fast);
  flex-shrink: 0;
  margin-left: 1rem;
}

.project-card.open .project-toggle {
  transform: rotate(45deg);
  color: var(--accent);
}

.project-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-body-inner {
  padding: 0 1.5rem 1.75rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.project-card.open .project-body-inner {
  opacity: 1;
  transform: translateY(0);
}

.project-plain {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.7;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.project-description {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 3px;
  transition: background var(--transition-fast);
}

/* ===== SKILLS ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  max-width: var(--max-width-wide);
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition-fast);
}

.skill-group:hover {
  border-color: var(--border-light);
}

.skill-group-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
}

.skill-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  transition: background var(--transition-fast);
}

.skill-item:hover {
  background: var(--accent-dim);
}

/* ===== EDUCATION ===== */
.education-list {
  list-style: none;
}

.education-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}

.education-item:last-child {
  border-bottom: none;
}

.education-name {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.education-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ===== CONTACT ===== */
#contact {
  text-align: center;
}

.contact-info {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.contact-link {
  font-size: 1.05rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color var(--transition-fast);
  position: relative;
}

.contact-link:hover {
  color: var(--accent);
}

/* ===== FOOTER ===== */
footer {
  padding: 3rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ===== SECTION DIVIDERS ===== */
section + section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  section {
    padding: 4rem 0;
  }

  .container {
    padding: 0 1.25rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-mobile-bg);
    padding: 1rem 1.5rem;
    gap: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-toggle {
    display: block;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-item::before {
    left: calc(-1.5rem - 4px);
  }

  .education-item {
    flex-direction: column;
    gap: 0.15rem;
  }

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

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    text-align: center;
    justify-content: center;
  }

  .section-title {
    margin-bottom: 2.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  h1 { font-size: 2.2rem; }

  section {
    padding: 3.5rem 0;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

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

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--accent);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(15deg);
}

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

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

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

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

/* ===== UTILITIES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== PRINT ===== */
@media print {
  body::before, body::after, nav, .theme-toggle,
  .hero-actions, .project-toggle, .nav-toggle { display: none !important; }
  section { padding: 1rem 0; }
  .project-body { max-height: none !important; overflow: visible; }
  .project-body-inner { opacity: 1; transform: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
  * { color: #000 !important; background: #fff !important; box-shadow: none !important; }
}
