/* ── Fonts ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap');

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

:root {
  --accent:      #225c3b;
  --text:        #2c2c2c;
  --heading:     #1a1a1a;
  --muted:       #6b6b6b;
  --border:      #e7e7e4;
  --bg:          #ffffff;
  --bg-elevated: #ffffff;
  --max-w:   760px;
  --serif:   "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:    Inter, -apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light;
}

/* Automatic: follow the OS/browser preference unless the user has picked one explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent:      #4caf7d;
    --text:        #dcdcdc;
    --heading:     #f2f2f2;
    --muted:       #9a9a9a;
    --border:      #303030;
    --bg:          #16171a;
    --bg-elevated: #1e1f23;

    color-scheme: dark;
  }
}

/* Manual: explicit override via the theme toggle, persisted in localStorage */
:root[data-theme="dark"] {
  --accent:      #4caf7d;
  --text:        #dcdcdc;
  --heading:     #f2f2f2;
  --muted:       #9a9a9a;
  --border:      #303030;
  --bg:          #16171a;
  --bg-elevated: #1e1f23;

  color-scheme: dark;
}

html { font-size: 16px; }

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s, color 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── Links ──────────────────────────────────────────────────── */
a { color: var(--muted); text-decoration: none; }
a:hover { color: var(--text); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
a.accent { color: var(--accent); }
a.accent:hover { color: var(--accent); text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.1rem 1.4rem;
}

.flex-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Site Header / Nav ──────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.site-header .container {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.logo a {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo a:hover { color: var(--text); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.navbar {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}
.navbar a {
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 400;
}
.navbar a:hover, .navbar a.active { color: var(--accent); }

/* ── Theme toggle ───────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  padding: 1.75rem 0 0;
}

/* ── Intro / Profile Block ──────────────────────────────────── */
.page-intro {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.75rem;
}

.page-intro-item:first-child { flex: 1; }
.page-intro-item:last-child  { flex-shrink: 0; }

.contact-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.contact-header .role {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.contact-header .affil {
  font-size: 0.9375rem;
  color: var(--muted);
}
.contact-details {
  margin: 0.6rem 0 0.8rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.contact-details a { color: var(--accent); }
.contact-details a:hover { text-decoration: underline; }

/* Social buttons */
.social { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.social-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.social-item:hover { border-color: var(--accent); color: var(--accent); }
.social-item svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* Round photo */
.roundImg {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* ── Bio paragraphs ─────────────────────────────────────────── */
.bio p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.7;
}
.bio p:last-child { margin-bottom: 0; }
.bio a { color: var(--accent); }
.bio a:hover { text-decoration: underline; }

/* ── Section Headings ───────────────────────────────────────── */
.header-name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 1.1rem;
}
.header-name::after {
  content: "";
  display: block;
  width: 38px;
  height: 2px;
  background: var(--accent);
  margin-top: 4px;
}

.section-note {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  margin-top: -0.5rem;
}
.section-note a { color: var(--accent); }
.section-note a:hover { text-decoration: underline; }

/* ── Year labels (projects page) ───────────────────────────── */
.year-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 1.75rem 0 0.75rem;
}
.year-label:first-child { margin-top: 0; }

/* ── Publication / Project entries ─────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 1.5rem; }

.pub-item {
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
  transition: border-color 0.15s;
}
.pub-item:hover { border-left-color: var(--accent); }

.pub-tags {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.pub-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
  font-style: italic;
}

.pub-authors {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.pub-authors strong { font-weight: 600; }

.pub-venue {
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* Inline description (projects page — always visible) */
.pub-desc {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0.35rem 0 0.4rem;
}

/* "▸ what it does" toggle (index page only) */
.pub-tldr { font-size: 0.9375rem; margin-bottom: 0.4rem; }
.pub-tldr summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.pub-tldr summary::-webkit-details-marker { display: none; }
.pub-tldr summary::before { content: "▸"; font-size: 0.7rem; }
.pub-tldr[open] summary::before { content: "▾"; }
.pub-tldr .tldr-body {
  margin-top: 0.4rem;
  color: var(--text);
  padding-left: 0.85rem;
}

.pub-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.pub-links a {
  font-size: 0.8125rem;
  color: var(--accent);
}
.pub-links a:hover { text-decoration: underline; }

/* ── News / Updates ─────────────────────────────────────────── */
ul.list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
ul.list li {
  font-size: 0.9375rem;
  line-height: 1.6;
  padding: 0.55rem 0 0.55rem 1.1rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
ul.list li:last-child { border-bottom: none; }
ul.list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--muted);
  font-size: 0.75rem;
  top: 0.72rem;
}
ul.list li a { color: var(--accent); }
ul.list li a:hover { text-decoration: underline; }
ul.list li strong { font-weight: 600; }

.more-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--accent);
}
.more-link:hover { text-decoration: underline; }

/* ── Disclosure / Expandable section ───────────────────────── */
.disclosure {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}
.disclosure summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .toggle {
  font-size: 0.75rem;
  color: var(--muted);
}
.disclosure summary .subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}
.disclosure-body {
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.7;
}
.disclosure-body p { margin-bottom: 0.9rem; }
.disclosure-body p:last-child { margin-bottom: 0; }
.disclosure-body a { color: var(--accent); }
.disclosure-body a:hover { text-decoration: underline; }

/* ── CV specific ────────────────────────────────────────────── */
.cv-section { margin-bottom: 2rem; }
.cv-entry { margin-bottom: 1.25rem; }
.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.cv-entry-head strong { font-weight: 600; font-size: 0.9375rem; }
.cv-date { font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.cv-entry p { font-size: 0.9375rem; margin-top: 0.2rem; color: var(--text); line-height: 1.6; }

.cv-skills dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.9375rem;
}
.cv-skills dt { color: var(--muted); }
.cv-skills dd { margin: 0; }

ul.plain-list { list-style: none; padding: 0; }
ul.plain-list li {
  font-size: 0.9375rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
}
ul.plain-list li:last-child { border-bottom: none; }
ul.plain-list li strong { color: var(--accent); margin-right: 0.4rem; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1rem 1.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0;
  padding-bottom: 0;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 560px) {
  .page-intro { flex-direction: column-reverse; align-items: flex-start; gap: 1rem; }
  .roundImg { width: 110px; height: 110px; }
  .navbar { gap: 1rem; }
  .nav-right { gap: 0.75rem; }
  .cv-entry-head { flex-direction: column; gap: 0; }
  .cv-skills dl { grid-template-columns: 1fr; }
  .site-footer .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 360px) {
  .roundImg { width: 90px; height: 90px; }
  .social { gap: 0.35rem; }
}
