/* ============================================================
   CSS Custom Properties — Light theme defaults
   ============================================================ */
:root {
  --bg: #f8f7f4;
  --bg-alt: #f0ede8;
  --surface: #ffffff;
  --border: #e2ddd8;
  --text: #1c1917;
  --text-muted: #6b6560;
  --accent: #3d5afe;
  --accent-hover: #1a37d4;
  --nav-bg: rgba(248, 247, 244, 0.85);
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radius: 10px;
  --transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Dark theme via system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --bg-alt: #1c1917;
    --surface: #232019;
    --border: #302d28;
    --text: #ede9e4;
    --text-muted: #9b9490;
    --accent: #7b93ff;
    --accent-hover: #a0b2ff;
    --nav-bg: rgba(20, 18, 16, 0.85);
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

/* Manual dark override — checkbox toggles dark-on-light */
body:has(#theme-toggle:checked) {
  --bg: #141210;
  --bg-alt: #1c1917;
  --surface: #232019;
  --border: #302d28;
  --text: #ede9e4;
  --text-muted: #9b9490;
  --accent: #7b93ff;
  --accent-hover: #a0b2ff;
  --nav-bg: rgba(20, 18, 16, 0.85);
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Manual light override — checkbox toggles light-on-dark */
@media (prefers-color-scheme: dark) {
  body:has(#theme-toggle:checked) {
    --bg: #f8f7f4;
    --bg-alt: #f0ede8;
    --surface: #ffffff;
    --border: #e2ddd8;
    --text: #1c1917;
    --text-muted: #6b6560;
    --accent: #3d5afe;
    --accent-hover: #1a37d4;
    --nav-bg: rgba(248, 247, 244, 0.85);
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.05);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: var(--transition);
}

/* ============================================================
   Hidden theme toggle input
   ============================================================ */
#theme-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }

p {
  color: var(--text-muted);
  max-width: 62ch;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

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

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

ul li {
  color: var(--text-muted);
  padding: 0.15rem 0;
  font-size: 0.93rem;
}

ul li::before {
  content: '—';
  color: var(--accent);
  margin-right: 0.5rem;
  opacity: 0.6;
}

/* ============================================================
   Layout wrapper
   ============================================================ */
.site-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Header / Hero
   ============================================================ */
header {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 1.5rem 3rem;
  max-width: 860px;
  margin: 0 auto;
}

.hero-tagline {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hero-tagline .line-1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.hero-tagline .line-2 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--text-muted);
}

.hero-tagline .line-3 {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ============================================================
   Navigation
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-inner a {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.85rem 0.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.nav-inner a:hover {
  color: var(--accent);
  text-decoration: none;
}

.theme-toggle-label {
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.6rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
  user-select: none;
  line-height: 1;
}

.theme-toggle-label:hover {
  color: var(--accent);
  background-color: var(--bg-alt);
}

/* Show moon in light mode, sun in dark mode */
.theme-toggle-label .icon-dark { display: inline; }
.theme-toggle-label .icon-light { display: none; }

@media (prefers-color-scheme: dark) {
  .theme-toggle-label .icon-dark { display: none; }
  .theme-toggle-label .icon-light { display: inline; }
}

body:has(#theme-toggle:checked) .theme-toggle-label .icon-dark { display: none; }
body:has(#theme-toggle:checked) .theme-toggle-label .icon-light { display: inline; }

@media (prefers-color-scheme: dark) {
  body:has(#theme-toggle:checked) .theme-toggle-label .icon-dark { display: inline; }
  body:has(#theme-toggle:checked) .theme-toggle-label .icon-light { display: none; }
}

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

section:nth-of-type(even) {
  background-color: transparent;
}

section h2 {
  position: relative;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* ============================================================
   Section: About
   ============================================================ */
#about p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 65ch;
}

/* ============================================================
   Section: History / Timeline
   ============================================================ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

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

.timeline-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 0.15rem;
  letter-spacing: 0.01em;
}

.timeline-content .org {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text);
}

.timeline-content .role {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ============================================================
   Section: preferences — Cards grid
   ============================================================ */
.preferences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.preference-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.preference-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.preference-card ul li::before {
  display: none;
}

.preference-card ul li {
  font-size: 0.88rem;
  padding: 0.1rem 0;
}

/* ============================================================
   Section: Projects — Cards grid
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.project-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.project-card h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.project-card h4 a {
  color: var(--text);
}

.project-card h4 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.project-card ul li::before {
  display: none;
}

.project-card ul li {
  font-size: 0.85rem;
  padding: 0.1rem 0;
}

/* ============================================================
   Section: Contact — Pill buttons
   ============================================================ */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background-color: var(--surface);
  box-shadow: var(--shadow);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(61, 90, 254, 0.12);
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  padding: 2.5rem 1.5rem;
  max-width: 860px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 540px) {
  header {
    padding-top: 4rem;
    min-height: 90svh;
  }

  section {
    padding: 3.5rem 1rem;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .preferences-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .nav-inner a {
    font-size: 0.75rem;
    padding: 0.75rem 0.25rem;
  }
}
