/* ktesio.dev: the Ktesio palette, wordmark, hero art, project rows and link
   lists. Layout and components come from base.css (shared/css/base.css),
   which loads first.
   Colours follow Ktesio's own brand (ktesio.com): neutral ink, paper and the
   Ktesio red. Dark is the default; [data-theme="light"] is the paper theme.
   scripts/contrast.py checks every text pair below against WCAG AA. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --bg: #111110;
  --bg-2: #171715;
  --bg-3: #1f1f1c;
  --term: #0b0b0a;
  --line: #262521;
  --line-2: #373631;
  --fg: #f2f1ed;
  --fg-2: #cfccc4;
  --muted: #a3a19a;
  --dim: #8e8c85;
  --accent: #ff5b3d;
  --ok: #7cc99f;
  --warn: #e3b453;
  --bad: #ff5b3d;
  --focus: #ff8f78;
  --num: #6b6963;
  --bad-bg: rgba(255, 91, 61, 0.12);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f1ed;
  --bg-2: #ebe9e3;
  --bg-3: #e2dfd7;
  --term: #fbfaf7;
  --line: #dcd9d0;
  --line-2: #cbc8bf;
  --fg: #111111;
  --fg-2: #33322e;
  --muted: #5c5a54;
  --dim: #62605a;
  --accent: #c2331a;
  --ok: #176a40;
  --warn: #855700;
  --bad: #c2331a;
  --focus: #c2331a;
  --num: #807e76;
  --bad-bg: rgba(194, 51, 26, 0.1);
}

/* ---------------------------------------------------------------- wordmark */
.mark {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.wordmark {
  display: block;
  width: auto;
  height: 22px;
  align-self: center;
  fill: currentColor;
}
.mark-dev {
  color: var(--accent);
  font: 600 15px/1 var(--mono);
}
.mark-sm .wordmark {
  height: 17px;
}
.mark-sm .mark-dev {
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- hero */
/* The first screen: the copy on the left, the recording on the right
   (components.html `term`), from 1180px, where the pane holds about 80
   characters of a line; narrower, the copy stacks above it. The monogram
   (still in components.html for the OG image) left the hero when the
   recording arrived. */
.hero--run {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 36px;
  align-items: center;
}
.hero-obj {
  min-width: 0;
}
@media (min-width: 1180px) {
  .hero--run {
    grid-template-columns: minmax(0, 9fr) minmax(0, 12fr);
    gap: 44px;
  }
}
/* The monogram (components.html) is drawn only by the OG image now. */
.monogram {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
}

/* ---------------------------------------------------------------- terminal pane */
/* A recording (data/recordings/*.json) as a framed terminal: a title bar with
   the version, the transcript, a caption under the frame. The hero's plays
   (static/js/home.js); the tiles' stand still. Lines hide with opacity, not
   display, so they stay in the accessibility tree before the play; the
   fade-in is the transition, and reduced motion turns it off (base.css). */
.term {
  margin: 0;
  min-width: 0;
}
.term-box {
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  background: var(--term);
  color: var(--fg-2);
  font: 400 12px/1.55 var(--mono);
}
.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--dim);
  font-size: 11.5px;
}
.term-ver {
  white-space: nowrap;
}
.term-replay {
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.term-replay:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.term-scroll {
  position: relative;
}
.term-body {
  margin: 0;
  padding: 14px 14px 12px;
  overflow-x: auto;
  font: inherit;
  white-space: pre;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.term-body:focus-visible {
  outline-offset: -2px;
}
/* home.js marks a pane that scrolls sideways (`scrolls`, with a tab stop on
   the body) and clears the fade once the end is in view (`at-end`). */
.term-scroll.scrolls::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, var(--term));
  pointer-events: none;
}
.term-scroll.scrolls.at-end::after {
  display: none;
}
.term-body code {
  font: inherit;
}
/* Prose-like lines wrap; a table's lines keep their columns and scroll. A
   wrapped line continues under its own text (a hanging indent), under the
   source label for a log line, so the timestamp column stays a column. */
.ln-cmd,
.ln-out,
.ln-log,
.ln-breach,
.ln-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ln-cmd,
.ln-out,
.ln-note {
  padding-left: 2ch;
  text-indent: -2ch;
}
/* A table's lines are as wide as their text, plus the pane's end padding, so
   the scroll range keeps that padding past the last column. */
.ln-cols,
.ln-rule,
.ln-row {
  width: max-content;
  padding-right: 14px;
}
.ln-log,
.ln-breach {
  padding-left: 21ch;
  text-indent: -21ch;
}
/* A help row (components.html `ln-desc`): the description column of
   `bite --help` starts at 18 characters, so its continuation stays in it
   instead of reading as another command. */
.ln-desc {
  padding-left: 18ch;
  text-indent: -18ch;
}
.ln {
  display: block;
  transition: opacity 0.18s ease;
}
.ln.pending {
  opacity: 0;
  user-select: none;
  pointer-events: none;
}
.k-prompt {
  color: var(--accent);
}
.k-cmd,
.ln-head,
.ln-cols {
  color: var(--fg);
}
.ln-head,
.ln-cols {
  font-weight: 600;
}
.k-dim,
.ln-rule {
  color: var(--dim);
}
.k-label {
  color: var(--muted);
}
.ln-breach {
  color: var(--bad);
  background: var(--bad-bg);
}
.ln-breach .k-dim,
.ln-breach .k-label {
  color: inherit;
}
.ln.flash {
  animation: flash 1.4s ease-out;
}
@keyframes flash {
  from {
    background: color-mix(in srgb, var(--bad) 38%, transparent);
  }
  to {
    background: var(--bad-bg);
  }
}
/* The cursor while a command types. */
.ln-cmd.typing .k-cmd::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--fg);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}
.term-cap {
  margin: 12px 0 0;
  color: var(--muted);
  font: italic 400 13.5px/1.55 var(--sans);
}
.term-cap b {
  color: var(--fg-2);
  font-weight: 600;
  font-style: normal;
}

/* ---------------------------------------------------------------- facts strip */
/* The release cell's label carries a date. .stat span (base.css) is a flex
   row, which would lay the text and the <time> out as separate items, so
   the label is one inline run that breaks only after the comma, never
   inside the date. */
.strip .stat-text {
  display: inline;
}
.strip time {
  white-space: nowrap;
}

/* Five links plus the toggle: on tablets the row would wrap, so the links never
   break and the outbound ktesio.com link waits for wider screens (the footer
   keeps it; the phone menu lists it). */
.nav-links a {
  white-space: nowrap;
}
@media (max-width: 900px) {
  .nav-links .by {
    display: none;
  }
}

/* ---------------------------------------------------------------- section heads */
/* A .label-row instance (base.css); the padding places it in the page band. */
.sec-head {
  padding: 30px var(--pad) 0;
}
.sec-head h2 {
  margin: 0;
  color: var(--muted);
  font: inherit;
}
.sec-head a {
  color: var(--accent);
  text-decoration: none;
}
.sec-head a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- projects */
.projects {
  border-bottom: 1px solid var(--line);
}
.proj {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) minmax(0, 360px);
  gap: 20px 44px;
  padding: 34px var(--pad) 38px;
  border-top: 1px solid var(--line);
}
.projects .sec-head + .proj {
  margin-top: 24px;
}
.proj h3 {
  margin: 0 0 6px;
  color: var(--fg);
  font: 700 var(--h-section)/1.1 var(--serif);
  letter-spacing: -0.015em;
}
.proj h3 a {
  text-decoration: none;
}
.proj h3 a:hover .cap-arrow {
  transform: translateX(4px);
}
.proj-tag {
  margin: 0 0 14px;
  color: var(--accent);
  font: 700 italic 1.2rem/1.3 var(--serif);
}
.cap-in > p:not(.proj-tag) {
  max-width: 38rem;
  margin: 0 0 18px;
}
.proj .cmd {
  margin-top: 4px;
}
.proj-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}
.proj-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 18px 0 0;
  font: 500 12.5px/1.6 var(--mono);
}
.proj-links a,
.essay-read a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}
.proj-links a:hover,
.essay-read a:hover {
  text-decoration-color: currentColor;
}
.proj-fine {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 0.85rem;
}
.proj-facts {
  align-self: start;
  margin: 6px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--term);
  font: 400 12.5px/1.5 var(--mono);
}
.proj-facts div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.proj-facts div:last-child {
  border-bottom: 0;
}
.proj-facts dt,
.essay-facts dt {
  color: var(--muted);
}
.proj-facts dd,
.essay-facts dd {
  margin: 0;
  color: var(--fg);
}
/* The roadmap row: the project's state as its own status page words it. */
.stage {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 3px;
  color: var(--accent);
  font: 500 11px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.stage:hover {
  border-color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.stage-text {
  display: block;
  color: var(--muted);
}
.proj .term {
  grid-column: 2;
  margin-top: 6px;
}
.proj-log {
  grid-column: 3;
  align-self: start;
  margin: 6px 0 0;
  font: 400 12.5px/1.5 var(--mono);
}
.proj-log-h {
  margin: 0 0 8px;
  color: var(--muted);
  font: 500 11.5px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.proj-log ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.proj-log li {
  display: flex;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.proj-log li a {
  min-width: 5ch;
  color: var(--fg);
  text-decoration: none;
}
.proj-log li a:hover {
  color: var(--accent);
}
.proj-log time {
  color: var(--muted);
}
.proj-log-all {
  margin: 10px 0 0;
}
.proj-log-all a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}
.proj-log-all a:hover {
  text-decoration-color: currentColor;
}
@media (max-width: 980px) {
  .proj {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .proj-facts,
  .proj .term,
  .proj-log {
    grid-column: 2;
  }
}
@media (max-width: 600px) {
  .proj {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .proj-facts,
  .proj .term,
  .proj-log {
    grid-column: 1;
  }
  .term-box,
  .term-bar,
  .stage,
  .proj-log-h,
  .notes-proj {
    font-size: 12px;
  }
  /* On a phone the timestamps go visually (the base.css .sr pattern; the
     text stays for copying and the screen reader): the run is five seconds
     long, and the 20 characters wrapped every line. */
  .ln-log .k-dim,
  .ln-breach .k-dim {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .ln-log,
  .ln-breach {
    padding-left: 2ch;
    text-indent: -2ch;
  }
  .proj-facts,
  .proj-links {
    font-size: 12px;
  }
}

/* ---------------------------------------------------------------- design notes */
/* One line a document: the day it landed, the project, the title and a
   sentence; the shape of the compact essay list. */
.notes {
  border-bottom: 1px solid var(--line);
}
.notes-list {
  margin: 20px 0 0;
  padding: 0 var(--pad);
  list-style: none;
}
.notes-list li {
  display: grid;
  grid-template-columns: 150px 72px minmax(0, 1fr);
  gap: 6px 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.notes-list time {
  color: var(--muted);
  font: 400 12.5px/1.7 var(--mono);
  white-space: nowrap;
}
.notes-proj {
  padding-top: 2px;
  color: var(--accent);
  font: 500 11px/1.9 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.notes-in h3 {
  margin: 0 0 4px;
  color: var(--fg);
  font: 700 1.15rem/1.3 var(--serif);
  letter-spacing: -0.01em;
}
.notes-in h3 a {
  text-decoration: none;
}
.notes-in h3 a:hover {
  color: var(--accent);
}
.notes-in p {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.notes-text {
  max-width: 40rem;
  margin: 0;
  padding: 18px var(--pad) 36px;
  color: var(--muted);
  font-size: 0.95rem;
}
@media (max-width: 700px) {
  .notes-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}
.essay-quote {
  max-width: 36rem;
  margin: 16px 0 18px;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}
.essay-quote p {
  margin: 0;
  color: var(--fg);
  font: italic 400 1.15rem/1.45 var(--serif);
}

/* ---------------------------------------------------------------- writing, elsewhere */
.writing-home {
  border-bottom: 1px solid var(--line);
}
.writing-home .essays {
  margin: 20px var(--pad) 34px;
}
/* The latest essay is a card in the shape of a project row: the piece at
   left, its facts in a mono column at right. Older essays, when there are
   any, follow in the compact list. The read link and the facts' dt/dd share
   the project row's rules above. */
.essay-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 20px 44px;
  margin: 20px var(--pad) 34px;
  padding: 30px 32px 28px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  background: var(--bg-2);
}
.essay-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font: 500 11.5px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.essay-card h3 {
  margin: 0 0 14px;
  color: var(--fg);
  font: 700 var(--h-card)/1.2 var(--serif);
  letter-spacing: -0.01em;
}
.essay-card h3 a {
  color: var(--fg);
  text-decoration: none;
}
.essay-card h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.essay-card h3 span {
  color: var(--accent);
}
.essay-summary {
  max-width: 40rem;
  margin: 0 0 18px;
}
.essay-read {
  font: 500 12.5px/1.6 var(--mono);
}
.essay-facts {
  align-self: start;
  margin: 0;
  font: 400 12.5px/1.5 var(--mono);
}
.essay-facts div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-2);
}
.essay-facts div:last-child {
  border-bottom: 0;
}
.writing-home .essay-card + .essays {
  margin-top: 0;
}
@media (max-width: 760px) {
  .essay-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 22px 20px 20px;
  }
}
@media (max-width: 600px) {
  .essay-kicker,
  .essay-read,
  .essay-facts {
    font-size: 12px;
  }
}
.elsewhere {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}
.elsewhere ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 32px;
  margin: 18px 0 0;
  padding: 0 var(--pad);
  list-style: none;
}
.elsewhere li {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.elsewhere a {
  color: var(--fg);
  font: 600 13.5px/1.4 var(--mono);
  text-underline-offset: 3px;
}
.elsewhere span {
  color: var(--muted);
  font-size: 0.95rem;
}
@media (max-width: 760px) {
  .elsewhere ul {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- privacy, legal */
/* ktesio.dev's long-form pages: /privacy/ and /legal/ (hekma's docs prose is
   its own .prose system, in css/docs.css). */
.page-text .text,
.details {
  max-width: 44rem;
}
.text h2 {
  margin: 2.2em 0 0.6em;
  color: var(--fg);
  font: 700 var(--h-card)/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);
}
@media (max-width: 600px) {
  .details div {
    grid-template-columns: minmax(0, 1fr);
  }
  .details dt,
  .updated {
    font-size: 12px;
  }
}
