/* ---------- Theme tokens ---------- */
:root {
  --bg: #faf9f7;
  --bg-raised: #ffffff;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0d6e6e;
  --accent-contrast: #ffffff;
  --border: #e4e1dc;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.06), 0 4px 12px rgb(0 0 0 / 0.04);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --bg-raised: #1c2024;
    --text: #e6e4e1;
    --text-muted: #9aa4ae;
    --accent: #4cc2c2;
    --accent-contrast: #0e1214;
    --border: #2b3138;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4);

    color-scheme: dark;
  }
}

/* Explicit user choice (theme toggle) overrides the OS preference */
:root[data-theme="light"] {
  --bg: #faf9f7;
  --bg-raised: #ffffff;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0d6e6e;
  --accent-contrast: #ffffff;
  --border: #e4e1dc;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.06), 0 4px 12px rgb(0 0 0 / 0.04);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14171a;
  --bg-raised: #1c2024;
  --text: #e6e4e1;
  --text-muted: #9aa4ae;
  --accent: #4cc2c2;
  --accent-contrast: #0e1214;
  --border: #2b3138;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.4);

  color-scheme: dark;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

section {
  margin-top: 4rem;
}

section h2 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

/* ---------- Header ---------- */
.site-header {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
}

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

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
}

#theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Show only the icon for the theme you'd switch TO */
.icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: inline;
}

:root[data-theme="light"] .icon-sun {
  display: none;
}

:root[data-theme="light"] .icon-moon {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-sun {
    display: inline;
  }

  :root:not([data-theme]) .icon-moon {
    display: none;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun {
    display: none;
  }

  :root:not([data-theme]) .icon-moon {
    display: inline;
  }
}

/* ---------- Hero ---------- */
.hero {
  margin-top: 5rem;
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}

.hero-text {
  flex: 1;
}

.hero-portrait {
  flex-shrink: 0;
  width: 168px;
  height: 168px;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column-reverse;
    gap: 1.5rem;
  }

  .hero-portrait {
    width: 120px;
    height: 120px;
  }
}

.kicker {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 3.5rem);
  margin: 0 0 1rem;
}

.tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 36rem;
  margin: 0 0 2rem;
}

.hero-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--bg-raised);
}

.button:hover {
  border-color: var(--text-muted);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.button.primary:hover {
  filter: brightness(1.1);
}

/* ---------- Projects ---------- */
.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.project-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

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

.project-card h3 a:hover {
  color: var(--accent);
}

.project-card p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.project-meta {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0;
}

/* ---------- Contact ---------- */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

.contact-list a {
  display: inline-flex;
  color: var(--text-muted);
}

.contact-list a:hover {
  color: var(--accent);
}

.contact-list svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}
