:root {
  --bg: #fdfcfa;
  --text: #333;
  --heading: #222;
  --muted: #666;
  --nav: #555;
  --border: #e5e2dc;
  --link: #2c5aa0;
  --nav-hover: #000;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --text: #d5d0c8;
    --heading: #e5e2dc;
    --muted: #999;
    --nav: #aaa;
    --border: #3a3530;
    --link: #7aa8e0;
    --nav-hover: #fff;
  }
}

:root.dark {
  --bg: #1a1a1a;
  --text: #d5d0c8;
  --heading: #e5e2dc;
  --muted: #999;
  --nav: #aaa;
  --border: #3a3530;
  --link: #7aa8e0;
  --nav-hover: #fff;
}

:root.light {
  --bg: #fdfcfa;
  --text: #333;
  --heading: #222;
  --muted: #666;
  --nav: #555;
  --border: #e5e2dc;
  --link: #2c5aa0;
  --nav-hover: #000;
}

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

nav {
  text-align: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

nav a {
  margin: 0 1rem;
  color: var(--nav);
  text-decoration: none;
  font-weight: 500;
}

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

#theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 28px;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  margin-left: 1rem;
  vertical-align: middle;
}

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

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle svg {
  position: absolute;
  opacity: 0;
  color: var(--text);
}

html:not(.dark) #theme-toggle .icon-sun {
  opacity: 1;
}

html.dark #theme-toggle .icon-moon {
  opacity: 1;
}

html.dark #theme-toggle {
  background: #555;
}

html.theme-ready #theme-toggle {
  transition: background 0.3s;
}

html.theme-ready #theme-toggle svg {
  transition: opacity 0.2s;
}

html.theme-ready .switch-thumb {
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

html.dark #theme-toggle .switch-thumb {
  transform: translateX(24px);
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
  font-weight: normal;
  color: var(--heading);
}

h1 {
  margin-top: 0;
  font-size: 2.2rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

figure {
  margin: 2rem 0;
}

figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.hero {
  margin: 2rem 0;
}

.gallery img {
  margin: 0 auto 2rem;
}

a {
  color: var(--link);
}

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
