@font-face {
  font-family: "Alliance No. 2";
  src: url("fonts/alliance-400.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Theme: light (default) */
:root {
  --bg: #f8f6f3;
  --text: #1a1a1a;
  --text-muted: #494949;
  --accent: #00319c;
  --accent-hover: #1d4ed8;
  --surface: #ffffff;
  --border: #e5e2dd;
}

/* Theme: dark */
[data-theme="dark"] {
  --bg: #0f0f0f;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --accent: #d8c8ff;
  --accent-hover: #ffffff;
  --surface: #1a1a1a;
  --border: #2a2a2a;
}

/* Respect system preference when no saved choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f0f0f;
    --text: #f0f0f0;
    --text-muted: #a0a0a0;
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --surface: #1a1a1a;
    --border: #2a2a2a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem;
  min-height: 100vh;
  font-family: "Alliance No. 2", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  opacity: 0;

  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

html.ready body {
  opacity: 1;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sun icon (shown in dark mode = click to go light) */
.theme-icon {
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

/* Sun icon (shown in dark mode = click to go light) */
[data-theme="dark"] .theme-icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
}

/* Moon icon (shown in light mode = click to go dark) */
[data-theme="light"] .theme-icon,
:root:not([data-theme]) .theme-icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

/* When no data-theme and system is dark, show sun (click = light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
  }
}

h1 {
  margin-top: 0;
  font-size: 4rem;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  margin-bottom: 1rem;
}

p {
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 50ch;
  margin-top: 4px;
  margin-bottom: 4px;
}

a {
  color: var(--text-muted);

  &:hover {
    color: var(--accent-hover);
  }
}

.section-title {
  margin-top: 4rem;
  margin-bottom: 2rem;
  font-size: 3rem;
}

.projects {
  margin-bottom: 4rem;
}

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

.github-link {
  margin-top: 4rem;

  &:hover {
    color: var(--accent-hover);
  }
}