/* Doctrina's website, in the look of jabbott.dev: a dark "capsuleer UI" with a deep-space
   backdrop, translucent hairline panels, teal signal accents, and squared uppercase type. A light
   theme swaps the color tokens; see "Light theme" below. The tokens and most components come
   from jabbott.dev's stylesheet, trimmed to what these pages use. */

/* Dark theme, the default. Rules use these tokens instead of literal colors, so the light theme
   only has to redefine the tokens. */
:root {
  --bg: #0b0c0d;
  --panel: rgba(16, 19, 21, 0.78);
  --panel-solid: #14181a;
  --slate: #29353a;
  --slate-2: #1b2326;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #eef2f3;
  --text-2: #b3bdc1;
  --text-3: #7d898e;
  /* --tint is the color with the most contrast against the page. Mixed in at a few percent, it
     makes hover washes, scan lines, and grid lines; mixed with an accent, it makes hover labels. */
  --tint: #fff;
  /* Shadows mix this color with transparent; the light theme gives it an alpha to soften them. */
  --shadow: #000;
  --teal: #5ccbcb;
  --teal-hi: #8fe5e5;
  --teal-wash: color-mix(in srgb, var(--teal) 10%, transparent);
  --teal-glow: color-mix(in srgb, var(--teal) 35%, transparent);
  --amber: #f2c200;
  --amber-hi: #ffd84a;
  /* Amber fills, such as the skip link, stay bright in both themes and always carry dark text. */
  --amber-fill: #f2c200;
  --green: #3ddc97;
  --rust: #f09a4a;
  --violet: #a58cff;
  --bronze: #cd7f32;
  --bronze-hi: #ffc98f;
  --purple: #9a6bff;
  --purple-hi: #e3d6ff;
  --header-bg: rgba(9, 10, 11, 0.84);
  --drawer-bg: rgba(9, 10, 11, 0.97);
  --footer-bg: rgba(7, 8, 9, 0.92);
  --space-glow: rgba(38, 70, 82, 0.4);
  --hex-core: #1d2a2e;
  --code-bg: #0a0f11;
  --code-text: #d9e3e6;
  --code-inline: #a9ecec;
  --font: "Saira", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1280px;
  --gutter: clamp(16px, 3vw, 32px);
  --header-h: 68px;
  color-scheme: dark;
}

/* ---------- Light theme ---------- */

/* Chosen with the header's theme button; the inline script in templates/layout.html sets the
   attribute before the first paint. The values match jabbott.dev's light theme. Accents are
   darker than in the dark theme, so text in them keeps a contrast of at least 4.5:1 on the light
   panels. */
[data-theme="light"] {
  --bg: #eef2f4;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #fff;
  --slate: #dce4e7;
  --slate-2: #e4eaec;
  --line: rgba(16, 40, 48, 0.12);
  --line-2: rgba(16, 40, 48, 0.24);
  --text: #10181b;
  --text-2: #3a484e;
  --text-3: #56656b;
  --tint: #000;
  --shadow: rgba(20, 40, 48, 0.35);
  --teal: #0a6e6f;
  --teal-hi: #064e4f;
  --amber: #7f5b00;
  --green: #0b6f4c;
  --rust: #a2480f;
  --violet: #6345c8;
  --bronze: #c07a35;
  --bronze-hi: #d9822f;
  --purple: #8c66e8;
  --purple-hi: #7b4ddb;
  --header-bg: rgba(248, 250, 251, 0.86);
  --drawer-bg: rgba(248, 250, 251, 0.98);
  --footer-bg: rgba(226, 232, 235, 0.92);
  --space-glow: rgba(92, 203, 203, 0.18);
  --hex-core: #fff;
  --code-bg: #f6f8f9;
  --code-text: #1d272b;
  --code-inline: #0b5d5e;
  color-scheme: light;
}

/* Daylight has no stars, and the edge drawings fade back so body text over them stays readable. */
[data-theme="light"] .space__stars { display: none; }
[data-theme="light"] .space__art { opacity: 0.6; }
[data-theme="light"] .space__stop--core { stop-color: var(--art-hi); }

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--teal); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--teal-hi); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

::selection { background: var(--teal-glow); color: var(--tint); }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; }

code {
  padding: 0.08em 0.36em;
  font-family: var(--mono); font-size: 0.86em;
  color: var(--code-inline);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 16%, transparent);
  overflow-wrap: anywhere;
}
a code { color: inherit; }
/* Keep short code such as --release or writing.md on one line; the longest in the README's lists
   is about 25 characters, which fits a phone's card. Commands in .signature may still wrap. */
.item__summary code,
.steps code,
.side-panel__note code,
.page-head__lede code,
.group__intro code { white-space: nowrap; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px;
  background: var(--amber-fill); color: #111;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.skip-link:focus { top: 12px; color: #111; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-main { flex: 1; padding-bottom: 72px; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Deep-space backdrop ---------- */

.space {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
  background:
    radial-gradient(800px 900px at 104% 35%, color-mix(in srgb, var(--purple) 10%, transparent), transparent 62%),
    radial-gradient(800px 900px at -4% 60%, color-mix(in srgb, var(--bronze) 8%, transparent), transparent 62%),
    radial-gradient(1400px 900px at 50% 125%, var(--space-glow), transparent 62%),
    var(--bg);
}

.space__stars {
  position: absolute; inset: -260px;
  background-image:
    radial-gradient(1px 1px at 25px 35px, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 75px 125px, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1.6px 1.6px at 162px 62px, rgba(205, 245, 255, 0.85), transparent 60%),
    radial-gradient(1px 1px at 214px 192px, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1px 1px at 118px 232px, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.2px 1.2px at 272px 22px, rgba(255, 236, 200, 0.7), transparent 60%),
    radial-gradient(1px 1px at 286px 148px, rgba(255, 255, 255, 0.45), transparent 60%);
  background-size: 300px 260px;
  opacity: 0.55;
  animation: drift 260s linear infinite;
}

.space__stars--far {
  background-size: 190px 170px;
  opacity: 0.28;
  animation-duration: 420s;
}

.space__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--tint) 2.2%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--tint) 2.2%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}

@keyframes drift {
  to { transform: translate3d(-300px, -260px, 0); }
}

/* Bronze circuit traces on the left edge and purple nerve cells on the right. Each drawing is as
   tall as the window and 2:5 wide, capped at 40% of the window's width, and fades out toward the
   content in the middle. */
.space__art {
  --art: var(--bronze);
  --art-hi: var(--bronze-hi);
  position: absolute; top: 0;
  width: auto; height: 100%;
  aspect-ratio: 2 / 5;
  max-width: 40vw;
}
.space__art--circuits {
  left: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent);
          mask-image: linear-gradient(90deg, #000 40%, transparent);
}
.space__art--synapses {
  --art: var(--purple);
  --art-hi: var(--purple-hi);
  right: 0;
  -webkit-mask-image: linear-gradient(270deg, #000 40%, transparent);
          mask-image: linear-gradient(270deg, #000 40%, transparent);
}

/* These opacities keep --text-2 body text at 4.5:1 or better where a line or cell sits behind it. */
.space__traces { fill: none; stroke: var(--art); stroke-width: 2; stroke-opacity: 0.34; stroke-linejoin: round; }
.space__pads { fill: none; stroke: var(--art); stroke-width: 2; stroke-opacity: 0.42; }
.space__chip { fill: color-mix(in srgb, var(--art) 6%, transparent); stroke: var(--art); stroke-width: 1.5; stroke-opacity: 0.4; }
.space__axons { fill: none; stroke: var(--art); stroke-width: 1.2; stroke-opacity: 0.38; }
.space__dendrites { fill: none; stroke: var(--art); stroke-width: 1; stroke-opacity: 0.24; stroke-linecap: round; }
.space__somas { fill: var(--art); fill-opacity: 0.45; }
.space__flash { fill: none; stroke: var(--art-hi); stroke-width: 2; stroke-linejoin: round; }

.space__stop--core { stop-color: color-mix(in srgb, var(--art-hi) 35%, #fff); }
.space__stop--hi { stop-color: var(--art-hi); }
.space__stop--glow { stop-color: var(--art); stop-opacity: 0.55; }
.space__stop--clear { stop-color: var(--art); stop-opacity: 0; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
          backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.site-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal) 50%, transparent);
  opacity: 0.4;
}

.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  min-height: var(--header-h);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--text);
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.brand__mark { width: 36px; height: 36px; color: var(--teal); flex: none; }
/* The mark's book and tip follow the theme wherever the mark appears. */
.mark__glyph { fill: var(--text); }
.mark__tip { fill: var(--amber); }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-size: 18px; font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase;
}
.brand__sub {
  margin-top: 6px;
  font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--text-3);
}

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  margin-right: -10px;
  background: none; border: 0; color: var(--text);
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block; width: 22px; height: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle__bars { position: relative; margin: 0 auto; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -7px; width: 16px; }
.nav-toggle__bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 0; width: 22px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { top: 0; transform: rotate(-45deg); }

/* ---------- Header: theme toggle ---------- */

/* It shows the theme a press switches to: the sun in the dark theme, the moon in the light one.
   It needs JavaScript, so it appears only when the .js class is on <html>. */
.theme-toggle {
  display: none; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  color: var(--text-2);
  background: var(--panel);
  border: 1px solid var(--line-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.js .theme-toggle { display: grid; }
.theme-toggle:hover { color: var(--teal-hi); border-color: var(--teal); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle__moon,
[data-theme="light"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: block; }

/* ---------- Header: navigation tiles ---------- */

/* Small versions of the home page's tiles (.portal): a glass panel with an accent glow, corner
   brackets, and a hexagon icon frame. Each bracket is two 1px lines (one on the link, one on
   .nav-tile__fx), so hover can lengthen them with scaleX() and scaleY() and only transform
   animates. */
.nav-tile {
  --accent: var(--teal);
  --arm: 16px;
  --reach: 0.5;
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 16px 0 8px;
  font: 600 13px/1 var(--font);
  letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
  background:
    radial-gradient(90% 160% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--panel);
  border: 1px solid var(--line-2);
  transition: transform 0.2s ease;
}
.nav-tile--neutral { --accent: var(--text-2); }
.nav-tile--skills { --accent: var(--amber); }
.nav-tile--rules { --accent: var(--teal); }

.nav-tile::before,
.nav-tile::after,
.nav-tile__fx::before,
.nav-tile__fx::after {
  content: "";
  position: absolute;
  background: var(--accent);
  transition: transform 0.25s ease;
}
.nav-tile::before,
.nav-tile::after { width: var(--arm); height: 1px; transform: scaleX(var(--reach)); }
.nav-tile::before { top: -1px; left: -1px; transform-origin: left; }
.nav-tile::after { bottom: -1px; right: -1px; transform-origin: right; }
.nav-tile__fx { position: absolute; inset: -1px; pointer-events: none; }
.nav-tile__fx::before,
.nav-tile__fx::after { width: 1px; height: var(--arm); transform: scaleY(var(--reach)); }
.nav-tile__fx::before { top: 0; left: 0; transform-origin: top; }
.nav-tile__fx::after { bottom: 0; right: 0; transform-origin: bottom; }

.nav-tile__icon {
  position: relative;
  display: grid; place-items: center;
  width: 24px; height: 26px; flex: none;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.nav-tile__icon::before {
  content: "";
  position: absolute; inset: 1px;
  background: var(--panel-solid);
  clip-path: inherit;
}
.nav-tile__icon .icon { position: relative; width: 14px; height: 14px; }

.nav-tile:hover,
.nav-tile:focus-visible,
.nav-tile.is-current {
  --reach: 1;
  color: color-mix(in srgb, var(--accent) 55%, var(--tint));
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.nav-tile:hover,
.nav-tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--shadow) 45%, transparent), 0 0 20px color-mix(in srgb, var(--accent) 16%, transparent);
}
.nav-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* The current page also fills its hexagon, so the state doesn't depend on color alone. */
.nav-tile.is-current .nav-tile__icon { color: var(--bg); background: var(--accent); }
.nav-tile.is-current .nav-tile__icon::before { opacity: 0; }

/* ---------- Buttons and links ---------- */

.btn {
  --btn-bg: color-mix(in srgb, var(--tint) 3%, transparent);
  --btn-fg: var(--text);
  --btn-line: var(--line-2);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 40px; padding: 0 18px;
  font: 600 13px/1 var(--font);
  letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-line);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { color: var(--btn-fg); }
.btn--ghost:hover {
  --btn-line: var(--teal);
  --btn-fg: var(--teal-hi);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--teal) 12%, transparent);
}
.btn--sm { height: 34px; padding: 0 14px; font-size: 12px; gap: 8px; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text);
  font-size: 14px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.link-arrow .icon { color: var(--teal); transition: transform 0.2s ease; }
.link-arrow:hover { color: var(--teal-hi); }
.link-arrow:hover .icon { transform: translateX(4px); }
.link-arrow--sm { font-size: 12px; margin-top: 14px; }

/* ---------- Panels and headings ---------- */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.panel--brackets::before,
.panel--brackets::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 1px solid var(--teal);
  pointer-events: none;
}
.panel--brackets::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel--brackets::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--text-3);
}

.section-title {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--teal);
  font-size: clamp(20px, 2.1vw, 26px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-title--xl {
  padding-left: 18px;
  border-left-width: 4px;
  font-size: clamp(30px, 4.4vw, 48px);
}

.kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px;
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.kicker__sep { color: var(--text-3); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 48px;
  padding: 16px 0 36px;
}
.page-head__lede {
  margin: 0;
  max-width: 58ch;
  color: var(--text-2);
  font-size: 16px;
}

.section-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 12px;
}
.section-head__count {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}

.breadcrumbs ol {
  display: flex; flex-wrap: wrap; gap: 4px 8px;
  margin: 28px 0 18px; padding: 0;
  list-style: none;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: var(--teal); }
.breadcrumbs a { color: var(--text-2); }
.breadcrumbs a:hover { color: var(--teal-hi); }
.breadcrumbs [aria-current] { color: var(--text-3); }

/* ---------- Home: welcome ---------- */

.welcome {
  display: flex; align-items: center; gap: clamp(18px, 3vw, 32px);
  padding: 52px 0 36px;
}
.welcome__copy { min-width: 0; }
.welcome__title {
  margin: 0 0 12px;
  font-size: clamp(30px, 4.6vw, 52px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.02em;
}
.welcome__text { margin: 0; max-width: 62ch; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.65; }

/* The hexagon that holds jabbott.dev's portrait holds Doctrina's mark here. */
.hex-avatar {
  --size: 72px;
  flex: none;
  display: inline-grid; place-items: center;
  width: var(--size); height: calc(var(--size) * 1.06);
  background: linear-gradient(160deg, var(--teal), #2a6b6b 60%, var(--amber));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.hex-avatar__inner {
  display: grid; place-items: center;
  width: calc(var(--size) - 4px); height: calc(var(--size) * 1.06 - 4px);
  background: radial-gradient(circle at 50% 35%, var(--hex-core), var(--slate-2) 70%);
  clip-path: inherit;
}
.hex-avatar__mark { width: 62%; height: 62%; color: var(--teal); }
.hex-avatar--lg { --size: 112px; }

/* ---------- Home: destination tiles ---------- */

.portals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 64px; padding: 0;
  list-style: none;
}

.portal {
  --accent: var(--teal);
  position: relative;
  isolation: isolate;
  display: flex; flex-direction: column;
  min-height: 320px;
  padding: 24px 24px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.accent-teal { --accent: var(--teal); }
.accent-amber { --accent: var(--amber); }
.accent-green { --accent: var(--green); }
.accent-violet { --accent: var(--violet); }
.accent-rust { --accent: var(--rust); }

/* Corner brackets that open out on hover, like a targeting reticle. */
.portal::before,
.portal::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--accent);
  pointer-events: none;
  transition: width 0.25s ease, height 0.25s ease;
}
.portal::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.portal::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* Backdrop: accent glow, scan lines, a large ghost icon, and a sweep on hover. */
.portal__fx {
  position: absolute; inset: 0; z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 62%),
    linear-gradient(color-mix(in srgb, var(--tint) 3%, transparent) 1px, transparent 1px) 0 0 / 100% 22px;
}
.portal__fx::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 45%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 10%, transparent) 80%, color-mix(in srgb, var(--accent) 55%, transparent));
  opacity: 0;
  transform: translateY(-110%);
}
.portal__ghost {
  position: absolute; right: -28px; bottom: -34px;
  width: 190px; height: 190px;
  color: var(--accent);
  stroke-width: 0.6;
  opacity: 0.07;
  transition: opacity 0.25s ease, transform 0.4s ease;
}

.portal__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.portal__index {
  font-family: var(--mono);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.portal__kind { color: var(--text-3); letter-spacing: 0.12em; text-transform: uppercase; }
.portal__index::after {
  content: "";
  display: block;
  width: 26px; height: 1px;
  margin-top: 8px;
  background: var(--accent);
  opacity: 0.6;
}
.portal__icon {
  position: relative;
  display: grid; place-items: center;
  width: 54px; height: 58px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.portal__icon::before {
  content: "";
  position: absolute; inset: 1px;
  background: var(--panel-solid);
  clip-path: inherit;
}
.portal__icon .icon { position: relative; width: 24px; height: 24px; }

.portal__title {
  margin: 0 0 6px;
  font-size: clamp(24px, 2.3vw, 30px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.portal__title a { color: var(--text); }
.portal__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.portal__title a:focus-visible { outline: none; }
.portal__sub {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.portal__text { margin: 0 0 22px; color: var(--text-2); font-size: 15px; line-height: 1.55; }

.portal__meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: auto 0 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
}
.portal__arrow { color: var(--accent); transition: transform 0.2s ease; }

.portal:hover,
.portal:focus-within {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 36px color-mix(in srgb, var(--accent) 14%, transparent);
}
.portal:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.portal:hover::before,
.portal:hover::after,
.portal:focus-within::before,
.portal:focus-within::after { width: 34px; height: 34px; }
.portal:hover .portal__fx::after { animation: portal-scan 1.2s ease-out; }
.portal:hover .portal__ghost { opacity: 0.13; transform: translate(-6px, -6px); }
.portal:hover .portal__title a,
.portal:focus-within .portal__title a { color: color-mix(in srgb, var(--accent) 55%, var(--tint)); }
.portal:hover .portal__arrow,
.portal:focus-within .portal__arrow { transform: translateX(4px); }

@keyframes portal-scan {
  15% { opacity: 1; }
  to { opacity: 0; transform: translateY(240%); }
}

/* ---------- Skills and rules: layout ---------- */

/* The filter comes first in the page, so keyboard users reach it before the cards. On wide
   screens it and the "Adopt" panel sit in a column on the right, and the panel stays in view while
   the cards scroll; on one column the order is filter, cards, panel. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "groups filter" "groups adopt";
  gap: 20px 36px;
  align-items: start;
}
.layout > .filter { grid-area: filter; }
.layout > .groups { grid-area: groups; }
.layout > .adopt { grid-area: adopt; position: sticky; top: calc(var(--header-h) + 20px); }

.groups { display: grid; gap: 48px; min-width: 0; }
.group[hidden] { display: none; }
.group__intro { margin: 0 0 20px; max-width: 72ch; color: var(--text-2); font-size: 15px; }

.side-panel { padding: 22px; }
.side-panel[hidden] { display: none; }
.side-panel__title {
  margin: 0 0 16px;
  padding-left: 10px;
  border-left: 2px solid var(--teal);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
}
/* The skills page's panel also shows the plugin's install commands, in the cards' amber. */
.page--skills .adopt { --accent: var(--amber); }
.side-panel__note {
  margin: 18px 0 10px;
  color: var(--text-2); font-size: 14.5px; line-height: 1.6;
}
.side-panel .signature { margin-bottom: 8px; }
.side-panel .signature + .side-panel__note { margin-top: 0; }

/* ---------- Skills and rules: cards ---------- */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 18px;
  margin: 0; padding: 0;
  list-style: none;
}

.item {
  --accent: var(--teal);
  position: relative;
  display: flex; flex-direction: column;
  padding: 20px 20px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.item[hidden] { display: none; }
.page--skills .item { --accent: var(--amber); }
.item:hover,
.item:target {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  border-top-color: var(--accent);
  box-shadow: 0 12px 36px color-mix(in srgb, var(--shadow) 40%, transparent);
}
.item:target { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 12px 36px color-mix(in srgb, var(--shadow) 40%, transparent); }

.item__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.item__file {
  font-family: var(--mono);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.item__name { margin: 0 0 10px; font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: 0.06em; text-transform: uppercase; }
.item__name a { color: var(--text); }
.item__name a:hover { color: color-mix(in srgb, var(--accent) 55%, var(--tint)); }
.item__summary { flex: 1; margin: 0 0 18px; color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.item__summary a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--teal) 40%, transparent); text-underline-offset: 3px; }
.item__summary strong { color: var(--text); font-weight: 600; }
.item__links { display: flex; flex-wrap: wrap; gap: 8px; }

.status {
  --status: var(--teal);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  font-size: 10.5px; font-weight: 700; line-height: 1.4;
  letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
  color: var(--status);
  background: color-mix(in srgb, var(--status) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--status) 40%, transparent);
  border-radius: 999px;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status[data-status="adopted"] { --status: var(--green); }

/* A skill's command, shown as if typed at a prompt. */
.signature {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 14px; padding: 9px 12px;
  background: var(--code-bg);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent);
}
.signature__prompt { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.signature code { padding: 0; font-size: 13px; color: var(--code-text); background: none; border: 0; }
/* A word breaks inside itself only when it can't fit on a line of its own. */
.signature__word { display: inline-block; max-width: 100%; }

/* Where a rule loads: every session, or a list of file patterns to open. */
.scope {
  margin: 0 0 14px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
}
.scope summary { cursor: pointer; width: fit-content; }
.scope summary:hover { color: var(--teal-hi); }
.scope--always::before { content: "●"; margin-right: 8px; color: var(--green); }
.scope__list {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 0; padding: 0;
  list-style: none;
  text-transform: none; letter-spacing: 0;
}
.scope__list code { font-size: 12px; }

/* ---------- Skills and rules: sidebar ---------- */

.filter__field { position: relative; }
.filter__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.filter__input {
  width: 100%; height: 42px;
  padding: 0 12px 0 40px;
  font: 500 15px/1 var(--font);
  color: var(--text);
  background: color-mix(in srgb, var(--tint) 4%, transparent);
  border: 1px solid var(--line-2);
  border-radius: 0;
}
.filter__input::placeholder { color: var(--text-3); }
.filter__input:focus-visible { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
.filter__status {
  margin: 10px 0 0;
  font-family: var(--mono); font-size: 11.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
}

.steps {
  margin: 0; padding: 0;
  list-style: none;
  counter-reset: step;
  color: var(--text-2); font-size: 14.5px; line-height: 1.6;
}
.steps li { position: relative; padding-left: 36px; counter-increment: step; }
.steps li + li { margin-top: 12px; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 1px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--teal);
}

.archive-empty {
  padding: 28px 24px;
  text-align: center;
  border: 1px dashed var(--line-2);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--tint) 1.8%, transparent) 0 10px, transparent 10px 20px);
}
.archive-empty[hidden] { display: none; }
.archive-empty__title {
  margin: 0 0 6px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-2);
}
.archive-empty__text { margin: 0; color: var(--text-3); font-size: 14px; line-height: 1.6; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  padding: 52px 0 26px;
  background: var(--footer-bg);
  border-top: 1px solid var(--line);
}
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 36px; }
.footer-brand p { margin: 18px 0 0; max-width: 46ch; color: var(--text-3); font-size: 14px; line-height: 1.6; }
.footer-title { margin: 0 0 14px; color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.footer-links { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--text-2); font-size: 14.5px; }
.footer-links a:hover { color: var(--teal-hi); }
.footer-base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 44px; padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 13px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .portals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal { min-height: 290px; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: none; gap: 28px; }
  .layout > .filter,
  .layout > .groups,
  .layout > .adopt { grid-area: auto; }
  .layout > .adopt { position: static; }
}

/* The skills page's panel, with the plugin's commands, is about 670 px tall. On a shorter screen,
   such as a laptop's, it would hide its own end while the cards scroll, so it scrolls with them. */
@media (max-height: 800px) {
  .page--skills .layout > .adopt { position: static; }
}

/* With JavaScript, the header row (brand, four nav tiles, and the theme button) needs about 840px;
   below 900px, leaving room for a scrollbar, it collapses into the menu button. Without
   JavaScript there is no theme button, the row needs about 780px, and below 860px the tiles wrap
   below the brand. */
@media (max-width: 900px) {
  .js .nav-toggle { display: inline-grid; place-items: center; }
  .js .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    display: none;
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 16px var(--gutter) 22px;
    background: var(--drawer-bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 50px color-mix(in srgb, var(--shadow) 60%, transparent);
  }
  .js .site-nav.is-open { display: flex; }
  .js .nav-tile { width: 100%; height: 48px; }
}

@media (max-width: 860px) {
  .site-nav { padding-bottom: 12px; }
  .js .site-nav { padding-bottom: 22px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  :root { --header-h: 60px; }
  /* A smaller gap and tighter tagline keep the brand, the menu button, and the theme button on
     one row down to about 347px. */
  .site-header__inner { gap: 12px; }
  /* On phones the drawings sit behind most of the text, so dim them further. */
  .space__art { opacity: 0.7; }
  .brand__mark { width: 32px; height: 32px; }
  .brand__name { font-size: 16px; letter-spacing: 0.22em; }
  .brand__sub { letter-spacing: 0.24em; }
  .welcome { flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 32px; }
  .welcome .hex-avatar--lg { --size: 84px; }
  .portals { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 48px; }
  .portal { min-height: 0; padding: 20px 20px 18px; }
  .portal__top { margin-bottom: 18px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* Narrower than that, the tagline doesn't fit beside both buttons. The menu names the same three
   sections, so the tagline is the part to drop. */
@media (max-width: 350px) {
  .brand__sub { display: none; }
}

@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; }
  .space__stars { animation: none; }
  .space__pulses { display: none; }
}
