/* Shared by ktesio.dev and hekma.ktesio.dev: fonts, layout and components.
   Source of truth: shared/css/base.css. scripts/sync.py copies it into each
   site's static/css/base.css; edit the source, then run the sync.

   It uses colour tokens only. Each site defines its own palette (--bg, --fg,
   --accent, …) in its static/css/site.css, which loads after this file. */

/* ---------------------------------------------------------------- fonts */
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Code Pro";
  src: url("/fonts/source-code-pro.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
/* Fallbacks sized to the web fonts, so the swap barely moves the layout. */
@font-face {
  font-family: "Serif Fallback";
  src: local("Georgia Bold"), local("Georgia-Bold"), local("Georgia");
  font-weight: 700;
  size-adjust: 98%;
  ascent-override: 104%;
  descent-override: 34%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Mono Fallback";
  src: local("Menlo"), local("DejaVu Sans Mono"), local("Consolas");
  size-adjust: 100%;
  ascent-override: 98%;
  descent-override: 27%;
  line-gap-override: 0%;
}

/* ---------------------------------------------------------------- type tokens */
:root {
  --serif: "Source Serif 4", "Serif Fallback", Georgia, "Times New Roman", serif;
  --mono: "Source Code Pro", "Mono Fallback", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 44px);
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-2);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a {
  color: inherit;
}
p {
  margin: 0;
}
code {
  font-family: var(--mono);
}
::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--fg);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--bg);
  font: 600 13px/1 var(--mono);
  text-decoration: none;
}
.skip:focus {
  top: 8px;
}
html:not(.js) .js-only {
  display: none !important;
}

/* ---------------------------------------------------------------- frame */
.frame {
  max-width: 1240px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
}
@media (min-width: 1000px) {
  .frame {
    border-inline: 1px solid var(--line);
  }
}

/* ---------------------------------------------------------------- nav */
.nav {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 60px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--fg);
  text-decoration: none;
}
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font: 500 13px/1 var(--mono);
  text-transform: lowercase;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--fg);
}
.gh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
}
.gh .ic {
  color: var(--fg-2);
}
.theme {
  display: flex;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  overflow: hidden;
}
html:not(.js) .theme {
  display: none;
}
.theme button {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 11.5px/1 var(--mono);
  cursor: pointer;
}
.theme button:hover {
  color: var(--fg);
}
.theme button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}
.menu {
  display: none;
}
@media (max-width: 760px) {
  .nav {
    gap: 12px;
  }
  .nav-links {
    display: none;
  }
  .theme {
    margin-left: auto;
  }
  .menu {
    display: block;
    position: relative;
  }
  .menu summary {
    display: grid;
    place-items: center;
    width: 38px;
    height: 34px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    cursor: pointer;
    list-style: none;
  }
  .menu summary::-webkit-details-marker {
    display: none;
  }
  .menu-bars,
  .menu-bars::before,
  .menu-bars::after {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--fg-2);
  }
  .menu-bars {
    position: relative;
  }
  .menu-bars::before,
  .menu-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }
  .menu-bars::before {
    top: -5px;
  }
  .menu-bars::after {
    top: 5px;
  }
  .menu-sheet {
    position: absolute;
    right: 0;
    top: 44px;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--bg-2);
    font: 500 14px/1 var(--mono);
  }
  .menu-sheet a {
    padding: 12px 12px;
    color: var(--fg-2);
    text-decoration: none;
    text-transform: lowercase;
  }
  .menu-sheet a:hover,
  .menu-sheet a[aria-current] {
    color: var(--fg);
    background: var(--bg-3);
  }
}

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 6.5vw, 84px) var(--pad) clamp(44px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}
.hero-in {
  position: relative;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-bottom: 30px;
  padding: 4px 13px 4px 4px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg-2);
  font: 500 12.5px/1.3 var(--mono);
  text-decoration: none;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.pill-tag {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.pill-arrow {
  color: var(--accent);
  transition: transform 0.2s ease;
}
.pill:hover .pill-arrow {
  transform: translateX(3px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--accent);
  font: 500 12.5px/1 var(--mono);
  letter-spacing: 0.14em;
}
.eyebrow-rule {
  width: 32px;
  height: 1px;
  background: currentColor;
}
h1 {
  margin: 0 0 24px;
  color: var(--fg);
  font: 700 clamp(2.35rem, 5.15vw, 4rem)/1.03 var(--serif);
  letter-spacing: -0.021em;
  font-optical-sizing: auto;
}
h1 em {
  color: var(--accent);
  font-style: italic;
  letter-spacing: -0.012em;
}
.lede {
  max-width: 37rem;
  margin: 0 0 32px;
  font-size: 1.075rem;
}
.lede strong {
  color: var(--fg);
  font-weight: 600;
}
.lede a,
.page a {
  color: var(--accent);
  text-underline-offset: 3px;
}
.cmd {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--term);
}
.cmd code {
  min-width: 0;
  padding: 16px 18px;
  overflow-x: auto;
  color: var(--fg);
  font: 400 14.5px/1.1 var(--mono);
  white-space: nowrap;
  user-select: all;
  scrollbar-width: thin;
}
.cmd-p {
  color: var(--accent);
  user-select: none;
}
.copy {
  flex: none;
  padding: 0 16px;
  border: 0;
  border-left: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.copy:hover {
  color: var(--fg);
}
.copy.done {
  color: var(--ok);
}
html:not(.js) .copy {
  display: none;
}
.meta {
  margin: 16px 0 0;
  color: var(--muted);
  font: 400 12.5px/1.7 var(--mono);
}
.meta a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}
.meta a:hover {
  text-decoration-color: currentColor;
}
.meta-dash {
  margin: 0 4px;
}
@media (max-width: 560px) {
  .cmd code {
    padding: 14px 14px;
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .copy {
    padding: 0 12px;
  }
}
.meta code {
  color: var(--fg-2);
  font-size: 1em;
}

/* ---------------------------------------------------------------- stat strip */
.strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px var(--pad) 22px;
  border-right: 1px solid var(--line);
  text-decoration: none;
}
.stat:last-child {
  border-right: 0;
}
.stat:hover {
  background: var(--bg-2);
}
.stat b {
  color: var(--fg);
  font: 700 clamp(1.55rem, 2.5vw, 2.15rem)/1 var(--serif);
  letter-spacing: -0.01em;
}
.stat span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 500 11.5px/1.3 var(--mono);
  letter-spacing: 0.08em;
}
.ic {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--accent);
}
@media (max-width: 860px) {
  .strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(2n) {
    border-right: 0;
  }
  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

/* ---------------------------------------------------------------- feature cards */
.caps {
  border-bottom: 1px solid var(--line);
}
.cap {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) minmax(0, 432px);
  gap: 20px 44px;
  padding: 38px var(--pad);
  border-top: 1px solid var(--line);
}
.cap:first-child {
  border-top: 0;
}
.cap:hover {
  background: var(--bg-2);
}
.cap-n {
  color: var(--num);
  font: 700 3rem/0.9 var(--serif);
  letter-spacing: -0.02em;
}
.cap h2 {
  margin: 0 0 12px;
  color: var(--fg);
  font: 700 1.55rem/1.2 var(--serif);
  letter-spacing: -0.01em;
}
.cap h2 a {
  text-decoration: none;
}
.cap h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.cap h2 a:focus-visible {
  outline: none;
}
.cap h2 a:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: -4px;
}
.cap-arrow {
  display: inline-block;
  color: var(--accent);
  transition: transform 0.2s ease;
}
.cap:hover .cap-arrow {
  transform: translateX(4px);
}
.cap p {
  max-width: 36rem;
  margin: 0 0 12px;
}
.cap code {
  color: var(--fg);
  font-size: 0.88em;
}
.cap-note {
  color: var(--muted);
  font-size: 0.93rem;
}
.ev {
  align-self: center;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--term);
  color: var(--fg-2);
  font: 400 11.5px/1.55 var(--mono);
}
.ev-log {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ev-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--fg);
}
.ev-note {
  color: var(--dim);
  font-size: 11px;
}
.st {
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 600 11px/1 var(--mono);
  font-style: normal;
}
.st-ok {
  color: var(--ok);
}
.st-bad {
  color: var(--bad);
}
.st-warn {
  color: var(--warn);
}
.st-dim {
  color: var(--muted);
}
@media (max-width: 980px) {
  .cap {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .cap-n {
    font-size: 2.2rem;
  }
  .ev {
    grid-column: 2;
  }
}
@media (max-width: 600px) {
  .cap {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .ev {
    grid-column: 1;
  }
}

/* ---------------------------------------------------------------- more from Ktesio */
.more {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  padding: 20px var(--pad);
  border-bottom: 1px solid var(--line);
  font: 400 12.5px/1.6 var(--mono);
}
.more-h {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.more ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.more a {
  color: var(--fg);
  text-underline-offset: 3px;
}
.more span {
  color: var(--muted);
}
.more-all {
  margin-left: auto;
  color: var(--accent);
  text-underline-offset: 3px;
}
@media (max-width: 760px) {
  .more-all {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- closing install */
.end {
  padding: clamp(56px, 8vw, 104px) var(--pad);
}
.end h2 {
  max-width: 13ch;
  margin: 0 0 20px;
  color: var(--fg);
  font: 700 clamp(2.2rem, 4.8vw, 3.5rem)/1.03 var(--serif);
  letter-spacing: -0.02em;
}
.end > p:not(.meta) {
  max-width: 34rem;
  margin: 0 0 28px;
}
.end code {
  color: var(--fg);
}

/* ---------------------------------------------------------------- footer */
.foot {
  padding: 28px var(--pad) 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 400 12.5px/1.6 var(--mono);
}
.foot-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 26px;
}
.attrib {
  color: var(--fg-2);
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-left: auto;
}
.foot-links a {
  color: var(--muted);
  text-decoration: none;
}
.foot-links a:hover {
  color: var(--fg);
}
.fine {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 18px;
  color: var(--dim);
  font-size: 11.5px;
}
.fine a {
  color: var(--muted);
}
@media (max-width: 760px) {
  .foot-links {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- writing, 404 */
.page {
  min-height: 60vh;
  padding: clamp(36px, 6.5vw, 84px) var(--pad) clamp(48px, 7vw, 96px);
}
.page h1 {
  max-width: 19ch;
  font-size: clamp(2.2rem, 4.8vw, 3.5rem);
}
.essays {
  margin: 44px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}
.essays li {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.essays time {
  grid-row: span 3;
  color: var(--muted);
  font: 500 12.5px/2 var(--mono);
}
.essays h2 {
  margin: 0;
  color: var(--fg);
  font: 700 1.6rem/1.2 var(--serif);
}
.essays h2 a {
  color: var(--fg);
  text-decoration: none;
}
.essays h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.essays h2 span {
  color: var(--accent);
}
.essays p {
  max-width: 40rem;
}
.essay-by {
  color: var(--dim);
  font: 400 12.5px/1.6 var(--mono);
}
@media (max-width: 700px) {
  .essays li {
    grid-template-columns: minmax(0, 1fr);
  }
  .essays time {
    grid-row: auto;
  }
}
.term-404 {
  max-width: 100%;
  margin: 8px 0 28px;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--term);
  font: 400 13px/1.6 var(--mono);
}

/* ---------------------------------------------------------------- privacy, legal */
.page-text .text,
.details {
  max-width: 44rem;
}
.updated {
  margin: -16px 0 36px;
  color: var(--muted);
  font: 500 12.5px/1.6 var(--mono);
}
.text h2 {
  margin: 2.2em 0 0.6em;
  color: var(--fg);
  font: 700 1.45rem/1.25 var(--serif);
}
.text p + p,
.text ul + p,
.text p + ul {
  margin-top: 1em;
}
.text ul {
  margin: 0;
  padding-left: 1.3em;
}
.text li + li {
  margin-top: 0.4em;
}
.text li::marker {
  color: var(--dim);
}
.text strong {
  color: var(--fg);
  font-weight: 600;
}
.details {
  margin: 0 0 12px;
  border-top: 1px solid var(--line);
}
.details div {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 4px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.details dt {
  color: var(--muted);
  font: 500 13px/1.6 var(--mono);
}
.details dd {
  margin: 0;
  color: var(--fg);
}
.ph {
  padding: 0 0.3em;
  border: 1px dashed var(--line-2);
  border-radius: 3px;
  color: var(--muted);
  font: 500 0.88em/1.6 var(--mono);
}
@media (max-width: 600px) {
  .details div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- phones */
/* Nothing under 12px on a phone. */
@media (max-width: 600px) {
  .mock,
  .ev,
  .ev-note,
  .fine,
  .more,
  .foot,
  .st,
  .stat span,
  .fig-head,
  .more-h,
  .pane-t,
  .agent-meta,
  .agent-rs,
  .view-cmd,
  .mock-bar,
  .meta,
  .copy,
  .theme button,
  .essays time,
  .essay-by,
  .updated,
  .details dt {
    font-size: 12px;
  }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
