*, *::before, *::after {
  box-sizing: border-box;
}

/* ── Theme variables ── */
:root {
  --bg:           #f5f4f0;
  --text:         #111;
  --text-muted:   #666;
  --text-body:    #333;
  --link:         #555;
  --link-hover:   #111;
  --sep:          #bbb;
  --label:        #888;
  --toggle-bg:    #e0deda;
  --toggle-color: #444;
  --photo-border: #ddd;
}

[data-theme="dark"] {
  --bg:           #141412;
  --text:         #e6e4df;
  --text-muted:   #777;
  --text-body:    #a8a69f;
  --link:         #999;
  --link-hover:   #e6e4df;
  --sep:          #333;
  --label:        #555;
  --toggle-bg:    #2a2927;
  --toggle-color: #aaa;
  --photo-border: #2e2c2a;
}

/* ── Base ── */
html {
  background: var(--bg);
  transition: background 0.2s ease;
}

body {
  max-width: 640px;
  margin: 80px auto;
  padding: 0 24px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s ease, color 0.2s ease;
}

/* ── Dark mode toggle ── */
#theme-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

#theme-toggle:hover {
  opacity: 0.75;
}

#theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* ── Header with headshot ── */
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 48px;
}

.intro {
  flex: 1;
  min-width: 0;
}

.headshot {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--photo-border);
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

/* ── Name & tagline ── */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.tagline {
  color: var(--text-muted);
  margin: 0 0 20px 0;
}

/* ── Nav links ── */
nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 0;
}

nav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

nav a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

nav a svg {
  flex-shrink: 0;
  transition: color 0.15s ease;
}

nav .sep {
  color: var(--sep);
  margin: 0 10px;
  user-select: none;
  font-size: 0.875rem;
}

/* ── Sections ── */
h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--label);
  margin: 0 0 12px 0;
}

section {
  margin-bottom: 44px;
}

section p {
  margin: 0 0 12px 0;
  color: var(--text-body);
}

section p:last-child {
  margin-bottom: 0;
}

.contact-email {
  color: var(--text-body);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.contact-cal {
  font-size: 0.95rem;
  margin-top: 0;
}

.contact-cal a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-cal a svg {
  flex-shrink: 0;
}

/* Make links in content appear black with an underline (avoid purple visited color) */
section a,
.contact-email a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

section a:visited,
.contact-email a:visited,
.contact-cal a:visited {
  color: var(--text);
}

section a:hover,
.contact-email a:hover,
.contact-cal a:hover {
  color: var(--text);
}

/* ── Mobile ── */
@media (max-width: 480px) {
  body {
    margin: 48px auto;
  }

  header {
    flex-direction: column-reverse;
    gap: 20px;
  }

  .headshot {
    width: 80px;
    height: 80px;
  }

  #theme-toggle {
    top: 16px;
    right: 16px;
  }
}
