:root {
  --bg: #FAFAF8;
  --text: #1A1A1A;
  --text-secondary: #5B5B5B;
  --border: #E4E4DF;
  --accent: #2F5D50;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --max-width: 720px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(47, 93, 80, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

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

h1, h2, h3, h4 {
  font-family: var(--font);
  color: var(--text);
  margin: 0;
}

/* ---------- Nav ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(20px, 5vw, 40px);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  color: var(--text);
}

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

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 32px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px 56px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  margin: 10px 0 2px;
}

.hero-location {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.hero-bio {
  font-size: 17px;
  color: var(--text);
  max-width: 640px;
  margin: 0 0 24px;
  line-height: 1.7;
}

.hero-links {
  font-size: 16px;
}

.hero-links .sep {
  color: var(--border);
  margin: 0 8px;
}

/* ---------- Entries (education / experience / projects) ---------- */
.entry {
  margin-bottom: 40px;
}

.entry:last-child { margin-bottom: 0; }

.entry h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.entry .meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

.entry p:not(.meta) {
  margin: 0 0 8px;
  font-size: 16.5px;
  color: var(--text);
  line-height: 1.65;
}

.entry-secondary {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.entry-secondary h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.entry-secondary > p {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 6px 0 20px;
}

/* ---------- Diagram disclosures ---------- */
.diagram-toggle {
  margin-bottom: 14px;
}

.diagram-toggle summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  list-style: none;
  padding: 4px 0;
}

.diagram-toggle summary::-webkit-details-marker { display: none; }

.diagram-toggle summary::before {
  content: "+ ";
  font-weight: 600;
}

.diagram-toggle[open] summary::before {
  content: "\2212 ";
}

.diagram-breakout {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 1080px;
  margin-top: 20px;
  padding: 0 20px;
}

.diagram-frame {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.diagram-frame-light { background: #fff; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
}

.skill-group h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.skill-group p {
  margin: 0;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---------- Contact ---------- */
#contact p:not(.hero-links) {
  font-size: 17px;
  color: var(--text);
  max-width: 560px;
  margin: 0 0 20px;
  line-height: 1.65;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 32px 20px 48px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
    gap: 2px;
    display: none;
  }

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

  .nav-links a {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-toggle { display: flex; }

  .hero h1 { font-size: 34px; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
