:root {
  --bg-color: #f6f8fa;
  --text-color: #24292f;
  --link-color: #0969da;
  --accent-color: #af52de;
  --border-color: #d0d7de;
  --card-bg: #ffffff;
  --muted-color: #57606a;
  --max-width: 780px;
}

[data-theme="dark"] {
  --bg-color: #0d1117;
  --text-color: #c9d1d9;
  --link-color: #58a6ff;
  --accent-color: #bc8cff;
  --border-color: #30363d;
  --card-bg: #161b22;
  --muted-color: #8b949e;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.7;
  transition: background-color 0.3s, color 0.3s;
}

a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ──────────────────────────────────────────────── */
#preamble {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-color);
}

.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 44px;
  flex-shrink: 0;
}

.theme-switch input { display: none; }

.slider {
  background-color: #ccc;
  bottom: 0; left: 0; right: 0; top: 0;
  position: absolute;
  cursor: pointer;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  background-color: #fff;
  bottom: 4px; left: 4px;
  content: "";
  height: 16px; width: 16px;
  position: absolute;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: var(--link-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Layout ───────────────────────────────────────────────── */
#content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

#postamble {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--muted-color);
  text-align: center;
}

/* ── Hero ─────────────────────────────────────────────────── */
h1.title {
  font-size: 2.6rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  border: none;
}

/* Avatar image */
img.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
  float: right;
  margin: 0 0 1.5rem 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Section headings ─────────────────────────────────────── */
h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 3rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  color: var(--text-color);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  color: var(--muted-color);
}

/* ── Social icons ─────────────────────────────────────────── */
.social-icons {
  display: flex;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.social-icon:hover {
  border-color: var(--link-color);
  box-shadow: 0 2px 8px rgba(9,105,218,0.12);
  text-decoration: none;
  color: var(--link-color);
}

.social-icon svg {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .social-icons {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ── Lists ────────────────────────────────────────────────── */
ul {
  padding-left: 1.4rem;
}

ul li {
  margin: 0.4rem 0;
}

/* ── Project cards ────────────────────────────────────────── */
#outline-container-projects h3 a,
#outline-container-Projects h3 a,
#outline-container-projects h4 a,
#outline-container-Projects h4 a {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--link-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

#outline-container-projects h3 a:hover,
#outline-container-Projects h3 a:hover {
  border-color: var(--link-color);
  box-shadow: 0 2px 8px rgba(9,105,218,0.12);
  text-decoration: none;
}

/* Clearfix after avatar */
#content::after {
  content: "";
  display: table;
  clear: both;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  h1.title { font-size: 2rem; }

  img.avatar {
    float: none;
    display: block;
    margin: 0 auto 1.5rem;
  }

  #content { padding: 2rem 1.25rem 3rem; }
}
