/* === Reset / Base === */

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

body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* === Font Face === */

@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/AtkinsonHyperlegibleMono-Regular.woff2) format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/AtkinsonHyperlegibleMono-Bold.woff2) format('woff2');
}

/* === Color Scheme: Light (default) === */

:root {
  --bg: #ffffff;
  --text: #1F2328;
  --accent: #0969da;
  --accent-hover: #218bff;
  --muted: #6e7781;
  --secondary: #57606a;
  --border: #d0d7de;
  --code-bg: #f6f8fa;
  --red: #cf222e;
  --green: #116329;
  --yellow: #4d2d00;
  --magenta: #8250df;
  --cyan: #1b7c83;
}

/* === Color Scheme: Dark (auto) === */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #30363d;
    --text: #e6edf3;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --muted: #b1bac4;
    --secondary: #6e7681;
    --border: #484f58;
    --code-bg: #484f58;
    --red: #ff7b72;
    --green: #3fb950;
    --yellow: #d29922;
    --magenta: #bc8cff;
    --cyan: #39c5cf;
  }
}

/* === Manual Theme Overrides === */

html[data-theme="light"] {
  --bg: #ffffff;
  --text: #1F2328;
  --accent: #0969da;
  --accent-hover: #218bff;
  --muted: #6e7781;
  --secondary: #57606a;
  --border: #d0d7de;
  --code-bg: #f6f8fa;
  --red: #cf222e;
  --green: #116329;
  --yellow: #4d2d00;
  --magenta: #8250df;
  --cyan: #1b7c83;
}

html[data-theme="dark"] {
  --bg: #30363d;
  --text: #e6edf3;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --muted: #b1bac4;
  --secondary: #6e7681;
  --border: #484f58;
  --code-bg: #484f58;
  --red: #ff7b72;
  --green: #3fb950;
  --yellow: #d29922;
  --magenta: #bc8cff;
  --cyan: #39c5cf;
}

/* === Layout === */

body {
  font-family: 'Atkinson Hyperlegible Mono', monospace;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

main {
  max-width: 65ch;
  margin: 0 auto;
  padding: 1rem;
}

/* === Typography === */

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.3;
}

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

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

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

a:hover,
a:focus {
  color: var(--accent-hover);
}

p {
  margin: 1rem 0;
}

/* === Navigation === */

header {
  max-width: 65ch;
  margin: 0 auto;
  padding: 1rem 1rem 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

nav a {
  text-decoration: none;
}

nav a:hover,
nav a:focus {
  text-decoration: underline;
}

nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}

.theme-toggle:hover,
.theme-toggle:focus {
  color: var(--accent-hover);
}

/* === Content Elements === */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

blockquote {
  border-left: 3px solid var(--border);
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: var(--secondary);
}

code {
  background: var(--code-bg);
  padding: 0.15rem 0.3rem;
  font-family: inherit;
  font-size: 0.95em;
}

/* === Work Highlights === */

article {
  margin: 2rem 0;
}

article h2 {
  margin-bottom: 0.5rem;
}

article p {
  margin: 0.5rem 0;
}

/* === Footer === */

footer {
  max-width: 65ch;
  margin: 0 auto;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

footer hr {
  margin: 1.5rem 0 1rem;
}

/* === Utility === */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === Print === */

@media print {
  body {
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  nav, .theme-toggle {
    display: none;
  }
}

/* === Responsive === */

@media (max-width: 768px) {
  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  main {
    padding: 0.75rem;
  }

  header {
    padding: 0.75rem 0.75rem 0;
  }

  footer {
    padding: 0.75rem;
  }
}
