/* Typography: load Inter web font with needed weights */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  font-family: var(--font-body);
  --font-body: "Inter";
  --font-display: "Inter";
  --bg: #fcfcf8;
  --text: #05050a;
  --muted: #40404d;
  --accent: #3557ff;
  --border: rgba(16, 16, 20, 0.08);
  --card-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7; /* Readability: slightly taller lines for body text */
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "salt" 1;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, box-shadow 0.2s ease;
}

.container {
  width: min(1200px, 90%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(253, 253, 251, 0.9);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.mode-toggle {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
}

.mode-toggle .mode-icon {
  font-size: 1rem;
  line-height: 1;
}

.mode-toggle:hover,
.mode-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(53, 87, 255, 0.2);
}

.mode-toggle.is-dark {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.015em;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.nav-toggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.5rem;
}

.hero {
  padding: 5rem 0 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.75rem, 6vw, 3.5rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 500;
}

h3 {
  font-family: var(--font-display);
  font-weight: 500;
}

.subheadline {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

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

.btn {
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

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

.btn.secondary {
  border-color: var(--border);
  color: var(--text);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(53, 87, 255, 0.2);
}

.hero-media img {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  object-fit: cover;
  margin-left: auto;
  margin-right: auto;
  border: 6px solid rgba(53, 87, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.section {
  padding: 4.5rem 0;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-family: var(--font-display);
  font-weight: 500;
}

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

/* Layout: loosen about section grid spacing for more breathing room */
.about-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: start;
}

/* Readability: limit measure to ~62ch for balanced measure */
.reading-width {
  max-width: 62ch;
}

.about-copy > * + * {
  margin-top: 1.2rem;
}

.about-copy p {
  margin: 0 0 1.1rem;
  line-height: 1.75;
}

.about-copy p:first-of-type {
  padding-bottom: 1.25rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}

.about-text {
  padding-right: clamp(0.5rem, 2vw, 2rem);
}

/* Bullets: improve scanability with consistent spacing */
.about-list {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.6;
  list-style-position: outside;
}

.about-list li + li {
  margin-top: 0.5rem;
}

.about-text p {
  margin-top: 0;
}

.about-timeline {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.75rem;
  align-self: start;
  margin-left: auto;
}

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

@media (max-width: 820px) {
  /* Stack about layout on small screens so spacing improvements hold up */
  .about-content {
    grid-template-columns: 1fr;
  }

  .about-text {
    padding-right: 0;
  }

  .about-timeline {
    margin-top: 2rem;
  }
}

.about-timeline li + li {
  margin-top: 1rem;
}

.timeline-date {
  font-weight: 600;
  font-size: 0.9rem;
}

.timeline-detail {
  display: block;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 20px 40px rgba(16, 16, 20, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 50px rgba(16, 16, 20, 0.08);
}

.card h3 {
  transition: color 0.2s ease;
}

.card:hover h3 {
  color: var(--text);
}

.card ul {
  padding-left: 1.1rem;
  margin: 0;
  color: var(--muted);
}

.card li {
  margin-bottom: 0.4rem;
}

.card-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.tagline {
  color: var(--muted);
  font-weight: 500;
}

.writing-card {
  min-height: 220px;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
}

.text-link:hover,
.text-link:focus-visible {
  color: #0f1ad1;
}

.speaking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.speaking-list li {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 1.05rem;
}

.contact-links a {
  color: var(--accent);
  position: relative;
  padding-bottom: 0.2rem;
}

.contact-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.contact-links a:hover::after,
.contact-links a:focus-visible::after {
  transform: scaleX(1);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 2rem;
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: -2rem;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.scroll-top {
  border: none;
  background: var(--accent);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 768px) {
  .site-nav ul {
    position: absolute;
    top: 64px;
    right: 5%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .site-nav ul.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .about-content {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 4rem;
  }

  .hero-media img {
    width: 220px;
    height: 220px;
  }

  .site-footer .container {
    flex-direction: column;
  }
}

a:focus-visible {
  box-shadow: 0 0 0 2px rgba(53, 87, 255, 0.4);
  border-radius: 4px;
}

/* Section-specific breathing room */
#projects.section,
#writing.section {
  padding-top: 5.5rem;
}

/* Manual dark theme overrides */
body[data-theme="dark"] {
  --bg: #050506;
  --text: #f7f7f0;
  --muted: #b8b8c7;
  --card-bg: #0f0f12;
  --border: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .site-header {
  background: rgba(5, 5, 6, 0.85);
}

body[data-theme="dark"] .mode-toggle {
  background: rgba(20, 20, 25, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

body[data-theme="dark"] .card {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .card:hover {
  box-shadow: 0 25px 55px rgba(0, 0, 0, 0.55);
}

body[data-theme="dark"] .text-link:hover,
body[data-theme="dark"] .text-link:focus-visible {
  color: #8da1ff;
}
