/* ============================================================
   Resume site styles
   Light and dark themes via CSS custom properties.
   Default follows the visitor's system preference; the toggle
   sets data-theme="light" or data-theme="dark" on <html>.
   ============================================================ */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0b6bcb;
  --border: #e3e6ea;
  --tag-bg: #eef1f4;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2126;
    --text: #e6e9ec;
    --text-muted: #9aa4ae;
    --accent: #5ca8ff;
    --border: #2c333a;
    --tag-bg: #242b32;
    color-scheme: dark;
  }
}

:root[data-theme="light"] {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0b6bcb;
  --border: #e3e6ea;
  --tag-bg: #eef1f4;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14171a;
  --surface: #1c2126;
  --text: #e6e9ec;
  --text-muted: #9aa4ae;
  --accent: #5ca8ff;
  --border: #2c333a;
  --tag-bg: #242b32;
  color-scheme: dark;
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

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

.resume {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: 1.25rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.05rem;
  margin: 0;
}

p {
  margin: 0.5rem 0;
}

ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.avatar {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0.25rem 0 0.75rem;
}

.contact-links,
.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.contact-links {
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.social-links {
  gap: 0.75rem;
  margin-top: 0.6rem;
}

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

.social-links a:hover,
.social-links a:focus-visible {
  color: var(--accent);
}

.social-links svg {
  width: 1.35rem;
  height: 1.35rem;
}

/* ---------- Entries (jobs, education, projects) ---------- */

.entry {
  margin-bottom: 1.5rem;
}

.entry-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.entry-dates {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.entry-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.15rem 0 0.35rem;
}

/* ---------- Technology tags ---------- */

.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list li {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */

.footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Theme toggle ---------- */

#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
}

#theme-toggle:hover {
  color: var(--accent);
}

#theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Show the icon for the theme you would switch TO */
.icon-moon { display: none; }
.icon-sun { display: block; }

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-sun { display: block; }
  :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: block; }
}

/* ---------- Mobile ---------- */

@media (max-width: 540px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .avatar {
    width: 5.5rem;
    height: 5.5rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .entry-heading {
    flex-direction: column;
    gap: 0;
  }
}

/* ---------- Print ---------- */

@media print {
  :root,
  :root[data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --text-muted: #444444;
    --accent: #000000;
    --border: #bbbbbb;
    --tag-bg: #ffffff;
  }

  body {
    font-size: 11pt;
  }

  .resume {
    max-width: none;
    padding: 0;
  }

  #theme-toggle {
    display: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  /* Show URLs next to project links when printed */
  #projects a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--text-muted);
  }

  section,
  .entry {
    break-inside: avoid;
  }
}
