/* The design system of the site: the colors, the page layout, and the control panel. */
:root {
  --bg: #0e1013; --panel: #15181d; --line: #262b33; --dim: #2c323b;
  --text: #e7e9ec; --muted: #8b93a1; --accent: #ff6a1a;
}
body { background: var(--bg); color: var(--text); font-family: var(--sans); }
::selection { background: var(--accent); color: var(--bg); }

.nav {
  position: absolute; inset: 0 0 auto; z-index: 20; height: 64px; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between; font-size: 0.875rem;
}
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--text); }
.nav nav { display: flex; gap: 28px; }
.nav .brand { color: var(--text); font-weight: 700; letter-spacing: -0.01em; font-size: 1rem; }
.brand b { font: 700 0.75rem var(--mono); color: var(--bg); background: var(--accent); padding: 3px 5px; margin-right: 10px; }

/* Hero: the title is at the left, centered vertically. The 3D view fills the section. */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 660px; overflow: hidden; cursor: grab; background: var(--bg); }
#gpu { position: absolute; inset: 0; width: 100%; height: 100%; }
.copy {
  position: absolute; left: 40px; top: 0; bottom: 0; width: min(520px, 100% - 80px);
  display: flex; flex-direction: column; justify-content: center; gap: 20px; pointer-events: none;
}
.eyebrow { font: 0.75rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
h1 { font: 600 clamp(2.375rem, 5vw, 4.25rem)/1.02 var(--sans); letter-spacing: -0.035em; }
h1 em { font-style: normal; color: var(--accent); }
.lede { color: var(--muted); font-size: 1.125rem; max-width: 36ch; }
.cta { display: flex; gap: 10px; margin-top: 6px; }
.cta a {
  pointer-events: auto; font: 0.8125rem var(--mono); text-decoration: none; padding: 11px 16px;
  border: 1px solid var(--line); background: rgba(14, 16, 19, 0.6);
}
.cta a:hover { border-color: var(--accent); }
.cta a.solid { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.hint { position: absolute; right: 24px; bottom: 60px; font: 0.6875rem var(--mono); color: var(--muted); pointer-events: none; }

/* Control panel. */
.panel {
  position: absolute; right: 24px; top: 76px; z-index: 10; width: 300px; cursor: default;
  max-height: calc(100% - 150px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
  font: 0.75rem var(--mono); color: var(--text);
  background: rgba(21, 24, 29, 0.86); border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(12px);
}
.panel summary {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px; cursor: pointer; list-style: none;
  text-transform: uppercase; letter-spacing: 0.1em; user-select: none;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary b { font-weight: 600; }
.panel summary span { margin-left: auto; color: var(--muted); font-size: 0.6875rem; }
.panel summary::after { content: "+"; color: var(--muted); width: 8px; text-align: center; }
.panel details[open] summary::after { content: "-"; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.led.idle { background: var(--muted); box-shadow: none; }
.panel-body { display: grid; gap: 14px; padding: 14px; border-top: 1px solid var(--line); }
.k { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.65625rem; }
.group { display: grid; gap: 7px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: baseline; }
.row output { font-variant-numeric: tabular-nums; }
.row input { grid-column: 1 / -1; }

.panel input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0;
  background: transparent; cursor: pointer;
}
.panel input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--dim) var(--fill, 50%));
}
.panel input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 18px; margin-top: -7.5px;
  background: var(--text); border: 0; border-radius: 2px;
}
.panel input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--dim); }
.panel input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent); }
.panel input[type=range]::-moz-range-thumb { width: 10px; height: 18px; background: var(--text); border: 0; border-radius: 2px; }
.panel input[type=range]:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { padding: 8px 2px; border: 0; background: var(--bg); color: var(--muted); cursor: pointer; font-size: 0.71875rem; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--bg); font-weight: 600; }

.field {
  width: 100%; padding: 9px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  font: 0.875rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.field:focus-visible { border-color: var(--accent); outline-offset: 0; }

.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--c); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line);
}
.swatches button[aria-pressed=true] { box-shadow: 0 0 0 2px var(--accent); }

.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.btn-row button {
  padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg);
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.71875rem;
}
.btn-row button:hover { border-color: var(--accent); }
.btn-row .primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sections: the heading is at the left and stays in view while its content scrolls. */
.sec { padding: 104px 0 8px; display: grid; grid-template-columns: 200px 1fr; gap: 32px; border-top: 1px solid var(--line); }
.sec h2 { font: 600 0.9375rem var(--sans); letter-spacing: -0.01em; position: sticky; top: 24px; align-self: start; }
.sec h2::before { content: ""; display: block; width: 28px; height: 4px; background: var(--accent); margin-bottom: 12px; }

.focus { display: grid; grid-template-columns: repeat(2, 1fr); gap: 44px 36px; padding-bottom: 96px; }
.fi-k { font: 600 2.75rem/1 var(--sans); letter-spacing: -0.04em; color: var(--dim); }
.focus-item h3 { font: 600 1.5rem/1.15 var(--sans); letter-spacing: -0.02em; margin: 10px 0 8px; }
.focus-item p { color: var(--muted); }

.posts { padding-bottom: 72px; }
.post {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; padding: 22px 0; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.post:first-child { padding-top: 0; }
.post h3 { font: 600 clamp(1.1875rem, 2.1vw, 1.625rem)/1.2 var(--sans); letter-spacing: -0.02em; grid-column: 1; transition: color 0.15s; }
.post:hover h3 { color: var(--accent); }
.post-n { display: none; }
.post time { grid-column: 2; grid-row: 1; font: 0.75rem var(--mono); color: var(--muted); padding-top: 6px; }
.post-tags { grid-column: 1; font: 0.75rem var(--mono); color: var(--muted); }
.post-go { grid-column: 2; grid-row: 2; text-align: right; color: var(--accent); }

footer { border-top: 1px solid var(--line); padding: 28px 0 80px; font-size: 0.8125rem; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
.foot nav { display: flex; gap: 18px; }

@media (max-width: 900px) {
  .nav { padding: 0 20px; }
  .nav nav { gap: 18px; }
  .copy { left: 20px; width: calc(100% - 40px); justify-content: flex-end; padding-bottom: 84px; gap: 12px; }
  .lede { font-size: 0.9375rem; }
  .hint { display: none; }
  /* The panel is under the header, so that the links of the header stay in view. */
  .panel { right: 12px; top: 64px; width: min(300px, 100% - 24px); max-height: calc(100% - 76px); }
  .sec { grid-template-columns: 1fr; gap: 20px; padding-top: 56px; }
  .sec h2 { position: static; }
  .focus { grid-template-columns: 1fr; }
}

/* --- Pages with no 3D view: all posts, a post, a series, and the 404 page. ---------------- */

/* The header is over the top of the page, so the content starts under it. */
.page { padding: 128px 0 72px; }
.page-head { display: grid; gap: 18px; padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
/* A post title is longer than the three words of the home page, so it is smaller and can break in a long word. */
.page-head h1 { font-size: clamp(1.875rem, 4.2vw, 3.25rem); line-height: 1.08; max-width: 26ch; overflow-wrap: break-word; }
.page-head .lede { max-width: 60ch; }
.eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.eyebrow a:hover { color: var(--text); }

.meta { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0; padding: 0; list-style: none; font: 0.75rem var(--mono); color: var(--muted); }
.meta li { padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; }
.meta .tag { color: var(--text); background: var(--panel); }

.cover { margin: 0 0 40px; }
.cover img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }

.more { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 28px; }
.more a { font: 0.8125rem var(--mono); text-decoration: none; padding: 11px 16px; border: 1px solid var(--line); background: var(--panel); }
.more a:hover { border-color: var(--accent); }
.page .posts { padding-bottom: 0; }

/* A post: the text is at the left, and the contents panel stays in view at the right. */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.post-layout.has-contents { grid-template-columns: minmax(0, 1fr) 280px; }
.has-contents .prose { grid-column: 1; grid-row: 1; }
.contents {
  grid-column: 2; grid-row: 1; align-self: start;
  position: sticky; inset: 24px auto auto; width: auto; max-height: calc(100vh - 48px); max-height: calc(100svh - 48px);
}
.contents ol { margin: 0; padding: 14px; list-style: none; gap: 2px; font-size: 0.78125rem; }
.contents a { display: block; padding: 6px 8px; border-radius: 4px; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.contents a:hover { color: var(--text); background: var(--bg); }
.contents-3 a { padding-left: 22px; }
.contents-4 a { padding-left: 36px; }

/* The body of a post. The HTML comes from Hashnode through the cleaner, so the rules use tags only. */
.prose { font-size: 1.0625rem; line-height: 1.7; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.2em; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { line-height: 1.2; letter-spacing: -0.02em; scroll-margin-top: 24px; }
.prose h2 { font-size: 1.75rem; margin-top: 2.2em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { font-size: 1.3125rem; margin-top: 1.8em; }
.prose h4, .prose h5, .prose h6 { font-size: 1.0625rem; margin-top: 1.6em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--text); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: 0.45em; }
.prose li::marker { color: var(--accent); }
.prose li > p + p { margin-top: 0.6em; }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose blockquote ul { padding-left: 1.1em; }
.prose hr { height: 1px; border: 0; background: var(--line); margin-block: 2.4em; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: 8px; font: 0.75rem var(--mono); color: var(--muted); }
.prose code { font: 0.875em var(--mono); padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
/* A code block and a wide table scroll in their own box. The page does not scroll sideways. */
.prose pre {
  overflow-x: auto; padding: 16px 18px; font: 0.8125rem/1.6 var(--mono); tab-size: 3;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; white-space: pre; overflow-wrap: normal; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.9375rem; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; background: var(--panel); }

.post-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.post-nav a { display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); text-decoration: none; font-weight: 600; line-height: 1.3; }
.post-nav a:hover { border-color: var(--accent); }
.post-nav .k { font-family: var(--mono); font-weight: 400; }
.post-nav-older { grid-column: 2; text-align: right; }

/* A link and a control show the keyboard focus in the accent color. */
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 900px) {
  .page { padding-top: 104px; }
  .post-layout.has-contents { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .contents { grid-column: 1; grid-row: 1; position: static; max-height: none; }
  .has-contents .prose { grid-row: 2; }
}
@media (max-width: 600px) {
  .wrap { width: min(1120px, 100% - 32px); }
  .post { grid-template-columns: minmax(0, 1fr); }
  .post time { grid-column: 1; grid-row: auto; padding-top: 0; }
  .post-go { display: none; }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav-older { grid-column: 1; text-align: left; }
  .prose { font-size: 1rem; }
  .prose h2 { font-size: 1.5rem; }
}
/* On a narrow phone the brand mark alone is the link to the home page. Its label has the name. */
@media (max-width: 420px) {
  .brand span { display: none; }
  .nav nav { gap: 14px; }
}
