:root,
html[data-theme="dark"] {
  --bg: #0d111a;
  --bg-2: #090d15;
  --surface: rgba(15, 20, 31, 0.84);
  --surface-2: rgba(18, 24, 37, 0.9);
  --edge: rgba(131, 154, 192, 0.26);
  --ink: #e6edf8;
  --ink-soft: #a7b5cc;
  --accent: #5cc8ff;
  --accent-2: #68f6ce;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

html[data-theme="dracula"] {
  --bg: #191622;
  --bg-2: #111018;
  --surface: rgba(34, 29, 48, 0.86);
  --surface-2: rgba(45, 39, 63, 0.88);
  --edge: rgba(210, 165, 255, 0.28);
  --ink: #f8f6ff;
  --ink-soft: #c2b8dc;
  --accent: #ff79c6;
  --accent-2: #8be9fd;
  --shadow: 0 24px 70px rgba(12, 10, 20, 0.55);
}

html[data-theme="alucard"] {
  --bg: #140c10;
  --bg-2: #0c080b;
  --surface: rgba(34, 14, 21, 0.84);
  --surface-2: rgba(48, 19, 30, 0.9);
  --edge: rgba(255, 120, 144, 0.26);
  --ink: #ffeef2;
  --ink-soft: #d5b8c0;
  --accent: #ff5e86;
  --accent-2: #ffb86c;
  --shadow: 0 26px 75px rgba(6, 2, 3, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.66;
  background:
    radial-gradient(circle at 15% 5%, color-mix(in oklab, var(--accent) 28%, transparent), transparent 35%),
    radial-gradient(circle at 85% 10%, color-mix(in oklab, var(--accent-2) 30%, transparent), transparent 40%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-2) 100%);
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(100deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  mask-image: radial-gradient(circle at center, black 15%, transparent 90%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header,
main,
.site-footer {
  width: min(1160px, calc(100% - 2rem));
}

.site-header {
  position: sticky;
  top: 0.85rem;
  z-index: 30;
  margin: 0.9rem auto 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--edge);
  border-radius: 18px;
  background: linear-gradient(120deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.6rem;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

nav {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
}

nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.82rem;
  transition: all 180ms ease;
}

nav a[aria-current="page"],
nav a:hover {
  color: var(--ink);
  border-color: var(--edge);
  background: rgba(255, 255, 255, 0.06);
}

.theme-picker select {
  appearance: none;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  padding: 0.36rem 0.95rem;
  font: 600 0.82rem "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
}

main {
  margin: 1.2rem auto 3rem;
}

.layout-home {
  display: grid;
  gap: 1rem;
}

.hero,
.section,
.post-shell {
  border: 1px solid var(--edge);
  background: linear-gradient(140deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(1.4rem, 2.2vw, 2.8rem);
  border-radius: 26px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  right: -110px;
  top: -120px;
  background: radial-gradient(circle at center, color-mix(in oklab, var(--accent) 26%, transparent), transparent 65%);
  pointer-events: none;
}

.kicker {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.07;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.3rem, 4.8vw, 4.4rem);
  max-width: 16ch;
  margin-bottom: 0.9rem;
}

.hero h1 {
  max-width: 100%;
}

h2 {
  font-size: clamp(1.65rem, 2.3vw, 2.35rem);
}

h3 {
  font-size: 1.55rem;
}

p {
  margin: 0;
  color: var(--ink-soft);
}

.hero p {
  max-width: 64ch;
}

.hero-actions {
  margin-top: 1.35rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--edge);
  padding: 0.62rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  font: 600 0.9rem "Space Grotesk", sans-serif;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(130deg, var(--accent) 0%, color-mix(in oklab, var(--accent-2) 40%, var(--accent)) 100%);
  color: #091018;
  border-color: transparent;
}

.button:hover {
  transform: translateY(-2px);
}

.section {
  padding: 1.2rem;
  border-radius: 20px;
}

.featured-lane {
  position: relative;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.text-link {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--accent-2) 45%, transparent);
}

.featured-post {
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 1.1rem;
}

.featured-post h2 a,
.post-card a,
.archive-item a {
  color: inherit;
  text-decoration: none;
}

.post-meta,
.meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  font: 600 0.78rem "JetBrains Mono", monospace;
  color: color-mix(in oklab, var(--ink-soft) 80%, white);
  margin: 0.55rem 0;
}

.post-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.post-card {
  grid-column: span 4;
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 160ms ease, border-color 160ms ease;
}

.post-grid .post-card:first-child {
  grid-column: span 12;
}

.post-card:hover,
.archive-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--accent) 45%, var(--edge));
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.tag {
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  font: 600 0.74rem "JetBrains Mono", monospace;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
}

.layout-standard {
  display: grid;
  gap: 1rem;
}

.hero.compact h1 {
  max-width: 20ch;
}

.archive-list {
  display: grid;
  gap: 0.9rem;
}

.archive-item {
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.95rem;
  transition: transform 160ms ease, border-color 160ms ease;
}

.post-shell {
  border-radius: 24px;
  padding: clamp(1.2rem, 2.5vw, 2.4rem);
}

.post-shell header {
  margin-bottom: 1.15rem;
}

.post-shell h1 {
  max-width: 100%;
}

.post-shell section {
  margin-bottom: 1rem;
}

.post-shell p {
  max-width: 100%;
}

.post-shell .post-figure {
  margin: 0;
  border: 1px solid var(--edge);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.post-shell .post-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.post-shell .post-figure figcaption {
  padding: 0.75rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.post-shell pre {
  margin: 0;
  padding: 0.85rem 0.95rem;
  overflow-x: auto;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.post-shell code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  color: var(--ink);
}

.post-shell .post-references {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.post-shell .post-references a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in oklab, var(--accent-2) 55%, transparent);
}

.post-shell .post-references a:hover {
  border-bottom-style: solid;
}

.prose h2 {
  margin-top: 1.2rem;
  margin-bottom: 0.45rem;
}

.site-footer {
  margin: 0 auto 2rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: linear-gradient(120deg, var(--surface) 0%, var(--surface-2) 100%);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer p {
  font: 500 0.86rem "JetBrains Mono", monospace;
}

.not-found {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.8rem;
  padding: 2rem;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 0.8rem;
    position: static;
  }

  nav {
    justify-content: flex-start;
  }

  .post-grid .post-card:first-child,
  .post-card {
    grid-column: span 6;
  }
}

@media (max-width: 720px) {
  .site-header,
  main,
  .site-footer {
    width: calc(100% - 1rem);
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-grid .post-card:first-child,
  .post-card {
    grid-column: auto;
  }

  h1 {
    max-width: 100%;
  }
}
