:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1d1f22;
  --text-muted: #5b6169;
  --accent: #a6192e; /* USC/Disney-adjacent deep red, kept from original palette */
  --border: #e2e4e8;
  --link: #a6192e;
  --link-hover: #7a1222;
  --max-width: 900px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #16181c;
    --bg-alt: #1e2126;
    --text: #e7e9ec;
    --text-muted: #a3a9b1;
    --accent: #e2687c;
    --border: #2c2f35;
    --link: #e2687c;
    --link-hover: #f0a0af;
  }
}

:root[data-theme="dark"] {
  --bg: #16181c;
  --bg-alt: #1e2126;
  --text: #e7e9ec;
  --text-muted: #a3a9b1;
  --accent: #e2687c;
  --border: #2c2f35;
  --link: #e2687c;
  --link-hover: #f0a0af;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

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

.layout {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: 2.5rem;
  padding: 1.5rem 1.25rem 3rem;
}

nav.site-nav {
  flex: 0 0 160px;
}

.nav-category {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.4rem 0 0.4rem;
}

.nav-category:first-child { margin-top: 0; }

.nav-item { margin: 0.15rem 0; }
.nav-item a { color: var(--text); font-size: 0.92rem; }
.nav-item a:hover { color: var(--link); }
.nav-item a[aria-current="page"] {
  color: var(--link);
  font-weight: 600;
}

main.content {
  flex: 1 1 auto;
  min-width: 0;
}

h1 {
  font-size: 1.7rem;
  margin: 0 0 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  color: var(--accent);
}

.profile {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.profile img {
  width: 160px;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.profile .name { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.4rem; }
.profile p { margin: 0.15rem 0; }

.updates-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.updates-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.updates-list li:last-child { border-bottom: none; }

.updates-list .date {
  font-weight: 700;
  margin-right: 0.4rem;
}

.code-project {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.code-project:last-child { border-bottom: none; }
.code-project h2 { margin: 0 0 0.5rem; }

.code-graphic {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 0.75rem;
}

footer.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
}

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

@media (max-width: 680px) {
  #theme-toggle {
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  .layout {
    flex-direction: column;
    gap: 1rem;
  }
  nav.site-nav {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
  }
  .nav-category { width: 100%; margin: 0.6rem 0 0.15rem; }
  .nav-category:first-child { margin-top: 0; }
  .profile { flex-direction: column; align-items: center; text-align: center; }
  .profile img { width: 140px; }
}
