/* hekma.ktesio.dev: the Hekma palette, wordmark, the hero's fleet board, the fleet mock
   and the animated card elements. Layout and components come from base.css
   (shared/css/base.css), which loads first.
   Colours come from the Hekma banner: lapis ink, papyrus, gold, turquoise and
   sun-red. Dark is the default; [data-theme="light"] is the papyrus theme.
   scripts/contrast.py checks every text pair below against WCAG AA. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --bg: #0b1017;
  --bg-2: #0f151e;
  --bg-3: #161f2b;
  --term: #080c12;
  --term-2: #0c121a;
  --line: #1c2531;
  --line-2: #2a3544;
  --fg: #eee8da;
  --fg-2: #c4bdae;
  --muted: #959eaa;
  --dim: #808a97;
  --accent: #e9b650;
  --ok: #5dcbb9;
  --warn: #e9b650;
  --bad: #f4845f;
  --bad-bg: rgba(244, 132, 95, 0.1);
  --focus: #f6d484;
  --num: #5b6573;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4eee0;
  --bg-2: #eee6d3;
  --bg-3: #e6dbc3;
  --term: #fbf8f0;
  --term-2: #f2ebdb;
  --line: #ddd2bb;
  --line-2: #c9bb9d;
  --fg: #1c1813;
  --fg-2: #3c372d;
  --muted: #625a4c;
  --dim: #675f51;
  --accent: #815300;
  --ok: #0b6b60;
  --warn: #815300;
  --bad: #ae3717;
  --bad-bg: rgba(174, 55, 23, 0.08);
  --focus: #815300;
  --num: #8a7f68;
}

/* ---------------------------------------------------------------- wordmark */
.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 700 23px/1 var(--serif);
  letter-spacing: -0.01em;
}
.disc {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.mark-sm {
  font-size: 19px;
}
.mark-sm .disc {
  width: 9px;
  height: 9px;
}

/* ---------------------------------------------------------------- the fleet board */
/* The fleet board sits beside the hero copy on wide screens and below it on
   narrower ones. Dashed means "being built": the Policy, kinds that need attach,
   hold. */
@media (min-width: 1180px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 34rem);
    gap: 56px;
    align-items: center;
  }
}
.board {
  min-width: 0;
  max-width: 40rem;
  margin: 40px 0 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  background: var(--term);
  color: var(--fg-2);
  font: 400 12px/1.4 var(--mono);
}
@media (min-width: 1180px) {
  .board {
    margin: 0;
  }
}
.board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 0 12px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.board-keys {
  display: flex;
  gap: 14px;
}
.board-key::before {
  content: "";
  display: inline-block;
  width: 16px;
  margin-right: 6px;
  border-top: 1px solid var(--fg-2);
  vertical-align: middle;
}
.board-key--built::before {
  border-top-style: dashed;
  border-top-color: var(--muted);
}
.board-policy,
.board-tel {
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.board-policy {
  border: 1px dashed var(--muted);
}
.board-policy span,
.board-tel span {
  margin-right: 6px;
  color: var(--dim);
}
.board-policy b {
  color: var(--accent);
  font-weight: 600;
}
.board-runs {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
}
.board-runs th,
.board-runs td {
  padding: 7px 8px 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.board-runs thead th {
  color: var(--dim);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
}
.board-runs tbody th {
  color: var(--fg);
  font-weight: 500;
}
.board-kind.board--built {
  text-decoration: underline dashed var(--muted);
  text-underline-offset: 4px;
}
.board-state--running {
  color: var(--ok);
}
.board-state--paused {
  color: var(--warn);
}
/* In the table the flag sits under the state; on phones, beside it. */
.board-state b {
  display: block;
  color: var(--bad);
  font-weight: 600;
}
.board-btns svg {
  display: block;
  width: 48px;
  height: 14px;
}
.board-btns rect {
  fill: none;
  stroke: var(--fg-2);
}
.board-btns .board-glyph {
  fill: var(--fg-2);
  stroke: none;
}
.board-hold {
  padding: 0 6px;
  border: 1px dashed var(--muted);
  border-radius: 2px;
  color: var(--muted);
}
.board-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
}
.board-meter svg {
  flex: 1;
  min-width: 48px;
  height: 7px;
  overflow: visible;
}
.board-meter span {
  min-width: 36px;
  text-align: right;
}
.board-track {
  fill: var(--line-2);
}
.board-fill {
  fill: var(--fg-2);
}
.board-tick {
  stroke: var(--bad);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.board-anomaly .board-fill {
  fill: var(--bad);
}
.board-anomaly .board-meter span {
  color: var(--bad);
}
.board-tel em {
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--dim);
  font-style: normal;
}
.board-cap {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.55;
}
/* Phones: each Run becomes a small card (name and state, kind and control, meter). */
@media (max-width: 560px) {
  .board-runs thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .board-runs,
  .board-runs tbody,
  .board-runs th,
  .board-runs td {
    display: block;
  }
  .board-runs tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
  }
  .board-runs th,
  .board-runs td {
    padding: 0;
    border: 0;
  }
  .board-runs .board-state {
    grid-area: 1 / 2;
    text-align: right;
  }
  .board-state b {
    display: inline;
    margin-left: 4px;
  }
  .board-runs .board-ctl {
    grid-area: 2 / 2;
    justify-self: end;
  }
  .board-runs .board-use {
    grid-column: 1 / -1;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .board-fill {
    transform-box: fill-box;
    transform-origin: left;
    animation: board-fill 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
  }
}
@keyframes board-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ---------------------------------------------------------------- the mock */
.fig {
  padding: 40px var(--pad) 38px;
  border-bottom: 1px solid var(--line);
}
/* A .label-row instance (base.css); only the spacing is ours. */
.fig-head {
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------- card groups */
/* Two card groups: the control plane being built (.caps--next, above the
   mock) and what ships today. Each opens with a .label-row header. */
.caps-h {
  padding: 30px var(--pad) 22px;
}
.caps-h p {
  margin: 0;
}
.caps-h a {
  color: var(--muted);
  text-decoration: none;
}
.caps-h a:hover {
  color: var(--fg);
}
/* The stage of a card that is not released: "in development" or "planned". */
.cap-stage {
  display: inline-block;
  margin: 0 0 10px;
  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;
}
/* A design sketch, not hekma output: a dashed frame and a caption say so. */
.ev.ev--sketch {
  border-style: dashed;
}
.ev-cap {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.mock {
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  background: var(--term);
  color: var(--fg-2);
  font: 400 12px/1.5 var(--mono);
}
.mock-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(--term-2);
  color: var(--dim);
  font-size: 11.5px;
}
.mock-sep {
  margin: 0 4px;
}
.mock-replay {
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.mock-replay:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.mock-body {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  height: 620px;
}
.side {
  overflow-y: auto;
  padding: 8px 0 14px;
  border-right: 1px solid var(--line);
  background: var(--term-2);
  scrollbar-width: thin;
}
.side-h {
  margin: 10px 14px 4px;
  color: var(--dim);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.side-g {
  margin: 10px 14px 3px;
  color: var(--muted);
  font-size: 11.5px;
}
.side-g::before {
  content: "~/";
  color: var(--dim);
}
.side ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.agent,
.view-btn {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 8px 14px 9px 12px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
html:not(.js) .agent,
html:not(.js) .view-btn {
  cursor: default;
}
.agent:hover,
.view-btn:hover {
  background: color-mix(in srgb, var(--bg-3) 70%, transparent);
}
.agent[aria-current="true"],
.view-btn[aria-current="true"] {
  border-left-color: var(--accent);
  background: var(--bg-3);
}
.agent-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.agent-name {
  overflow: hidden;
  color: var(--fg);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-rs {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
}
.agent[data-state="running"] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}
.agent[data-state="paused"] .dot {
  background: var(--warn);
}
.agent[data-state="failed"] .dot {
  background: var(--bad);
}
.agent[data-state="stopped"] .dot {
  border: 1.5px solid var(--dim);
  background: transparent;
}
.agent-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--dim);
  font-size: 11px;
}
.agent[data-state="running"] .agent-state {
  color: var(--ok);
}
.agent[data-state="paused"] .agent-state {
  color: var(--warn);
}
.agent[data-state="failed"] .agent-state {
  color: var(--bad);
}
.agent-amt {
  white-space: nowrap;
}
.view-cmd {
  color: var(--dim);
  font-size: 10.5px;
}
.bar {
  display: block;
  width: 100%;
  height: 3px;
  overflow: visible;
}
.bar-bg {
  fill: var(--line-2);
}
.bar-fill {
  fill: var(--ok);
  transition: width 0.35s ease;
}
.bar.near .bar-fill {
  fill: var(--warn);
}
.bar.over .bar-fill {
  fill: var(--bad);
}
.main {
  position: relative;
  min-width: 0;
}
.view {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 16px 12px;
  padding: 18px 14px 12px;
}
.view[hidden] {
  display: none;
}
.layout-single {
  grid-template: "top" minmax(0, 1fr) / minmax(0, 1fr);
}
.layout-stack {
  grid-template: "top" minmax(0, 57fr) "bottom" minmax(0, 43fr) / minmax(0, 1fr);
}
.area-top {
  grid-area: top;
}
.area-bottom {
  grid-area: bottom;
}
.pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-2);
  border-radius: 4px;
}
.view[data-view="pay-triage"] .area-top {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2));
}
.pane-t {
  position: absolute;
  top: -8px;
  left: 10px;
  z-index: 1;
  padding: 0 6px;
  background: var(--term);
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
}
/* column-reverse keeps a full pane scrolled to its newest line, like a
   terminal; the auto margin keeps a short one at the top. */
.pane-b {
  display: flex;
  flex-direction: column-reverse;
  height: 100%;
  padding: 13px 12px 8px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
}
.pane-b > .term {
  margin-bottom: auto;
}
.pane-b:focus-visible {
  outline-offset: -2px;
}
.term {
  margin: 0;
  font: inherit;
  white-space: pre;
}
.ln.wrap {
  white-space: pre-wrap;
}
.term code {
  font: inherit;
}
/* Pre-play lines hide with opacity, not display: they stay in the
   accessibility tree, so a screen reader reads the whole terminal before
   the replay. mock.js reveals a line by dropping the class; the
   transition is the fade-in, and reduced motion turns it off globally
   (base.css). */
.ln {
  transition: opacity 0.18s ease;
}
.ln.pending {
  opacity: 0;
  /* Still in the tree (that is the point), so keep the unseen lines out
     of selection and pointer reach until the class drops. */
  user-select: none;
  pointer-events: none;
}
.ln.breach {
  background: var(--bad-bg);
}
.ln.breach .k-bad {
  font-weight: 600;
}
.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);
  }
}
.k-dim,
.k-rule,
.k-meter {
  color: var(--dim);
}
.k-label {
  color: var(--muted);
}
.k-prompt,
.k-accent {
  color: var(--accent);
}
.k-cmd,
.k-head {
  color: var(--fg);
}
.k-head {
  font-weight: 600;
}
.k-ok {
  color: var(--ok);
}
.k-warn {
  color: var(--warn);
}
.k-bad {
  color: var(--bad);
}
.figcap {
  margin: 14px 0 0;
  color: var(--muted);
  font: italic 400 14px/1.55 var(--sans);
}
@media (max-width: 1100px) {
  .mock {
    font-size: 11.5px;
  }
}
@media (max-width: 900px) {
  .mock {
    font-size: 11px;
  }
  .mock-bar {
    flex-wrap: wrap;
    padding: 6px 10px;
  }
  .mock-body {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }
  .side {
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .side::-webkit-scrollbar {
    display: none;
  }
  .ln.log {
    white-space: pre-wrap;
  }
  .fig-hint {
    display: none;
  }
  .side-h,
  .side-g {
    display: none;
  }
  .side ul {
    display: contents;
  }
  .side li {
    flex: none;
  }
  .agent,
  .view-btn {
    width: 172px;
    height: 100%;
    border: 1px solid var(--line-2);
    border-radius: 4px;
  }
  .agent[aria-current="true"],
  .view-btn[aria-current="true"] {
    border-color: var(--accent);
  }
  .view {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 10px 12px;
  }
  .view[hidden] {
    display: none;
  }
  .pane {
    height: 300px;
  }
  .area-bottom {
    height: 260px;
  }
  .layout-single .pane {
    height: 420px;
  }
}

/* ---------------------------------------------------------------- 404 terminal */
.term-404 {
  max-width: 100%;
  margin: 8px 0 28px;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  background: var(--term);
  font: 400 13px/1.6 var(--mono);
}

/* ---------------------------------------------------------------- card live elements */
/* The feature-card terminal and its status pills, next to the animations
   that drive them. */
.ev {
  align-self: center;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-term);
  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) {
  .ev {
    grid-column: 2;
  }
}
@media (max-width: 600px) {
  .ev {
    grid-column: 1;
  }
}
.cycle {
  display: grid;
  justify-items: end;
}
.cycle .st {
  grid-area: 1 / 1;
  opacity: 0;
  animation: 6s infinite;
}
.cycle .st-ok {
  animation-name: cyc-run;
}
.cycle .st-bad {
  animation-name: cyc-fail;
}
.cycle .st-dim {
  animation-name: cyc-start;
}
@keyframes cyc-run {
  0%, 44% { opacity: 1; }
  45%, 71% { opacity: 0; }
  72%, 100% { opacity: 1; }
}
@keyframes cyc-fail {
  0%, 44% { opacity: 0; }
  45%, 59% { opacity: 1; }
  60%, 100% { opacity: 0; }
}
@keyframes cyc-start {
  0%, 59% { opacity: 0; }
  60%, 71% { opacity: 1; }
  72%, 100% { opacity: 0; }
}
.ev .bar {
  height: 5px;
  margin: 0 0 12px;
}
.bar-grow {
  transform-box: fill-box;
  transform-origin: left center;
  animation: grow 5s ease-in-out infinite;
}
@keyframes grow {
  0% { transform: scaleX(0.75); fill: var(--warn); }
  62% { transform: scaleX(1); fill: var(--warn); }
  64%, 100% { transform: scaleX(1); fill: var(--bad); }
}
.wire {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}
.wire i {
  position: relative;
  flex: 1;
  height: 1px;
  overflow: hidden;
  background: var(--line-2);
}
.wire i::after {
  content: "";
  position: absolute;
  top: 0;
  left: -12%;
  width: 12%;
  height: 1px;
  background: var(--accent);
  animation: packet 2.2s linear infinite;
}
@keyframes packet {
  to { left: 100%; }
}

/* ---------------------------------------------------------------- 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;
}

/* ---------------------------------------------------------------- phones */
/* Nothing under 12px on a phone; base.css floors the shared classes. */
@media (max-width: 600px) {
  .mock,
  .ev,
  .ev-note,
  .more,
  .more-h,
  .st,
  .pane-t,
  .agent-meta,
  .agent-rs,
  .view-cmd,
  .mock-bar {
    font-size: 12px;
  }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  .cycle .st {
    opacity: 0;
  }
  .cycle .st-ok {
    opacity: 1;
  }
  .bar-grow {
    fill: var(--bad);
  }
}
