/*
 * Nord palette. Colors follow `color-scheme`: the device setting by
 * default, or the visitor's choice via `data-theme` on <html> (set by
 * theme.js).
 */
:root {
  --bg: light-dark(#eceff4, #2e3440);
  --surface: light-dark(rgb(255 255 255 / 0.62), rgb(59 66 82 / 0.62));
  --fg: light-dark(#2e3440, #eceff4);
  --muted: light-dark(#4c566a, #d8dee9);
  --border: light-dark(#d8dee9, #434c5e);
  --control-border: #81a1c1;
  --accent: light-dark(#5e81ac, #88c0d0);
  --accent-soft: light-dark(rgb(94 129 172 / 0.14),
    rgb(136 192 208 / 0.16));
  --shadow: light-dark(rgb(46 52 64 / 0.1), rgb(0 0 0 / 0.3));
  --dot: light-dark(rgb(76 86 106 / 0.35), rgb(216 222 233 / 0.2));
  color-scheme: light dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Browsers do not apply the hidden attribute to SVG elements */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 1rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* Static dot grid, fixed to the viewport and faded toward the edges */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(var(--dot) 1px, transparent 1.5px) 0 0 / 22px
    22px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 40%,
    transparent 100%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 40%,
    transparent 100%);
}

main {
  max-width: 36rem;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 32px var(--shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.headshot {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  object-fit: cover;
}

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

p {
  margin: 0.25rem 0;
}

.tagline {
  color: var(--muted);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

a,
a:visited {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
.theme button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

nav a,
nav a:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

nav a:focus-visible {
  border-radius: 10px;
}

.icon {
  flex-shrink: 0;
  width: 0.875em;
  height: 0.875em;
}

/* Light / Dark / System switcher, pinned to the top right */
.theme {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  display: flex;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.theme button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme button:focus-visible {
  border-radius: 999px;
}

.theme .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.theme button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Hidden visually but still read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (hover: hover) {
  nav a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .theme button:hover {
    color: var(--fg);
  }

  .theme button[aria-pressed="true"]:hover {
    color: var(--accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  nav a,
  .theme button {
    transition: none;
  }
}
