:root {
  color-scheme: light;
  --paper: #f1eee5;
  --surface: #fbfaf5;
  --ink: #172125;
  --muted: #657176;
  --line: #d4d0c5;
  --line-strong: #a9aca7;
  --petrol: #102e36;
  --cyan: #0b7189;
  --orange: #d85a36;
  --code: #10282f;
  --code-ink: #d9f0ec;
  --focus: #f09b36;
  --shadow: 0 18px 55px rgb(25 39 43 / 9%);
  --serif: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 86% 4%, rgb(11 113 137 / 9%), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgb(216 90 54 / 24%);
}

a {
  color: var(--cyan);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--orange);
}

a:focus-visible,
summary:focus-visible {
  border-radius: 3px;
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-180%);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem 1.6rem 1.5rem;
  border-right: 1px solid rgb(255 255 255 / 12%);
  background:
    linear-gradient(rgb(255 255 255 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px),
    var(--petrol);
  background-size: 28px 28px;
  color: #d9e2df;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: white;
  text-decoration: none;
}

.brand:hover {
  color: white;
}

.brand-mark {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 52%);
  background: var(--orange);
  box-shadow: 5px 5px 0 #071d23;
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.brand small {
  margin-top: 0.25rem;
  color: #97aaa8;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-intro {
  margin: 1.5rem 0 1.1rem;
  color: #aebfbc;
  font-size: 0.86rem;
  line-height: 1.55;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-bottom: 1.8rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgb(255 255 255 / 14%);
  color: #d5dfdd;
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #65d3b6;
  box-shadow: 0 0 0 3px rgb(101 211 182 / 12%);
}

.nav-group {
  margin-bottom: 1.25rem;
}

.nav-label {
  display: block;
  margin-bottom: 0.35rem;
  color: #718b8c;
  font-family: var(--mono);
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.nav-group a {
  position: relative;
  display: block;
  padding: 0.27rem 0 0.27rem 0.72rem;
  color: #bac9c6;
  font-size: 0.82rem;
  text-decoration: none;
}

.nav-group a::before {
  position: absolute;
  top: 0.86rem;
  left: 0;
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 50%;
  background: #557173;
  content: "";
}

.nav-group a:hover,
.nav-group a[aria-current="page"] {
  color: white;
}

.nav-group a[aria-current="page"]::before {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgb(216 90 54 / 18%);
}

.rail-footer {
  display: grid;
  gap: 0.65rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(255 255 255 / 11%);
  color: #718b8c;
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.55;
}

.rail-footer a {
  color: #d8e1df;
  text-decoration: none;
}

.mobile-menu {
  display: none;
}

.content {
  width: min(100%, 68rem);
  margin: 0 auto;
  padding: 2rem clamp(1.4rem, 5vw, 5.4rem) 4rem;
}

.content-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(3rem, 7vw, 6rem);
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
}

.content-meta a {
  color: var(--ink);
  letter-spacing: 0;
  text-decoration: none;
}

.prose {
  max-width: 52rem;
}

.prose > h1:first-child {
  max-width: 15ch;
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: clamp(3.1rem, 8vw, 6.4rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.92;
}

.prose > h1:first-child::after {
  display: block;
  width: 4.5rem;
  height: 0.35rem;
  margin-top: 1.6rem;
  background: var(--orange);
  content: "";
}

.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: 2rem;
  color: var(--ink);
}

.prose h2 {
  margin: 4rem 0 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-strong);
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.prose h3 {
  margin-top: 2.6rem;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.prose p,
.prose li {
  color: #334146;
}

.prose strong {
  color: var(--ink);
}

.prose a {
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.32rem 0;
  padding-left: 0.25rem;
}

.prose blockquote {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  border-left: 0.35rem solid var(--orange);
  background: rgb(255 255 255 / 48%);
  box-shadow: var(--shadow);
}

.prose blockquote > :first-child {
  margin-top: 0;
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.16em 0.34em;
  border: 1px solid #d3d0c6;
  border-radius: 3px;
  background: #e9e5da;
  color: #7c3524;
  font-family: var(--mono);
  font-size: 0.86em;
}

.prose pre {
  margin: 1.5rem 0 2rem;
  padding: 1.2rem 1.3rem;
  overflow: auto;
  border: 1px solid #25434a;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px),
    var(--code);
  background-size: 2.2rem 100%;
  box-shadow: 0 16px 36px rgb(16 46 54 / 16%);
  color: var(--code-ink);
  line-height: 1.58;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.82rem;
}

.prose table {
  display: block;
  width: 100%;
  margin: 1.6rem 0 2rem;
  overflow-x: auto;
  border-collapse: collapse;
  background: rgb(255 255 255 / 35%);
  box-shadow: inset 0 0 0 1px var(--line);
}

.prose th,
.prose td {
  min-width: 8rem;
  padding: 0.72rem 0.85rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: #e4e0d5;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.prose hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.content-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 52rem;
  margin-top: 5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.content-footer a {
  color: var(--ink);
  text-decoration: none;
}

@media (max-width: 860px) {
  .site-shell {
    display: block;
  }

  .rail {
    position: relative;
    height: auto;
    max-height: none;
    padding: 1.25rem;
    border-right: 0;
    border-bottom: 1px solid rgb(255 255 255 / 15%);
  }

  .rail-intro,
  .desktop-navigation,
  .rail-footer {
    display: none;
  }

  .status {
    position: absolute;
    top: 1.55rem;
    right: 1.25rem;
    margin: 0;
  }

  .mobile-menu {
    display: block;
    margin-top: 1.1rem;
  }

  .mobile-menu summary {
    cursor: pointer;
    color: #d9e2df;
    font-family: var(--mono);
    font-size: 0.72rem;
    list-style-position: inside;
    text-transform: uppercase;
  }

  .mobile-menu-content {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding-top: 1rem;
  }

  .content {
    padding-top: 1.3rem;
  }

  .content-meta {
    margin-bottom: 3.3rem;
  }
}

@media (max-width: 590px) {
  .brand small,
  .status,
  .content-meta span {
    display: none;
  }

  .mobile-menu-content {
    grid-template-columns: 1fr 1fr;
  }

  .content {
    padding-inline: 1.15rem;
  }

  .content-meta {
    justify-content: flex-end;
  }

  .prose > h1:first-child {
    font-size: clamp(2.7rem, 15vw, 4.5rem);
  }

  .content-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
