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

:root {
  --ctp-base: #1e2030;
  --ctp-mantle: #181926;
  --ctp-crust: #11111b;
  --ctp-surface0: #363a4f;
  --ctp-surface1: #494d64;
  --ctp-surface2: #5b6078;
  --ctp-overlay0: #6e738d;
  --ctp-overlay1: #8087a2;
  --ctp-overlay2: #939ab7;
  --ctp-subtext0: #a5adcb;
  --ctp-subtext1: #b8c0e0;
  --ctp-text: #cad3f5;
  --ctp-lavender: #b7bdf8;
  --ctp-blue: #8aadf4;
  --ctp-sapphire: #7dc4e4;
  --ctp-teal: #8bd5ca;
  --ctp-green: #a6da95;
  --ctp-yellow: #eed49f;
  --ctp-peach: #f5a97f;
  --ctp-red: #ed8796;
  --ctp-mauve: #c6a0f6;
  --ctp-pink: #f5bde6;

  color-scheme: dark;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background-color: var(--ctp-base);
  color: var(--ctp-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--ctp-mauve);
  color: var(--ctp-crust);
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.375rem 0.375rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--ctp-lavender);
  outline-offset: 2px;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--ctp-lavender);
  outline-offset: 3px;
}

/* Container */
.container {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Nav */
nav {
  background: var(--ctp-mantle);
  border-bottom: 1px solid var(--ctp-surface0);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.nav-logo {
  color: var(--ctp-lavender);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
}

.nav-logo:hover {
  color: var(--ctp-mauve);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-bar {
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--ctp-text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--ctp-subtext1);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--ctp-lavender);
  transition: width 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ctp-text);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  width: 100%;
}

.nav-links a[aria-current="page"] {
  color: var(--ctp-lavender);
}

.nav-links a[aria-current="page"]::after {
  width: 100%;
}

/* Main */
main {
  flex: 1;
  padding: 3rem 0;
}

/* Hero */
.hero {
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2rem;
  color: var(--ctp-lavender);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--ctp-subtext0);
  font-size: 1.125rem;
}

/* Headings */
h1, h2, h3, h4 {
  color: var(--ctp-text);
  line-height: 1.3;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; margin-top: 2rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; margin-top: 1.5rem; }

h2:first-child,
h3:first-child {
  margin-top: 0;
}

/* Links */
a {
  color: var(--ctp-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--ctp-sapphire);
}

/* Content */
.content {
  margin-top: 1.5rem;
}

.content p {
  margin-bottom: 1.25rem;
}

.content ul, .content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.content li {
  margin-bottom: 0.375rem;
}

.content blockquote {
  border-left: 3px solid var(--ctp-mauve);
  padding-left: 1rem;
  color: var(--ctp-subtext1);
  margin-bottom: 1.25rem;
}

.content code {
  background: var(--ctp-surface0);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.content pre {
  background: var(--ctp-crust);
  border: 1px solid var(--ctp-surface0);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.content pre code {
  background: none;
  padding: 0;
}

.content img {
  max-width: 100%;
  height: auto;
}

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

/* Post list */
.post-list {
  list-style: none;
  margin-top: 1rem;
}

.post-list li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--ctp-surface0);
}

.post-list li:first-child {
  padding-top: 0;
}

.post-list h2,
.post-list h3 {
  margin: 0 0 0.25rem;
}

.post-list time {
  color: var(--ctp-overlay1);
  font-size: 0.8125rem;
}

.post-list p {
  color: var(--ctp-subtext0);
  margin-top: 0.5rem;
  font-size: 0.9375rem;
}

/* Header (single page) */
article header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ctp-surface0);
}

article header time {
  color: var(--ctp-overlay1);
  font-size: 0.875rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--ctp-surface0);
  padding: 1.5rem 0;
  margin-top: auto;
  text-align: center;
  color: var(--ctp-overlay1);
  font-size: 0.8125rem;
}

footer a {
  color: var(--ctp-subtext1);
}

/* Mobile nav */
@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    background: var(--ctp-mantle);
    border-bottom: 1px solid var(--ctp-surface0);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
  }

  .nav-links[data-open="true"] {
    display: flex;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  nav, footer, .skip-link {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}
