/* kodma.dev. Colours, radii and fonts come from the app's Tally skin
   (web/src/design/tokens.css); the pane picture follows web/src/features/grid/grid.css
   and the state glyphs follow web/src/design/StateGlyph.tsx and base.css.
   Colour means agent state only; there is no brand colour. */

/* ---------- Fonts (self-hosted, copied from @fontsource-variable) ---------- */
@font-face {
  font-family: "Mona Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("assets/fonts/mona-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Mona Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("assets/fonts/mona-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("assets/fonts/geist-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("assets/fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens: dark by default, light when the system asks for it ---------- */
:root {
  color-scheme: dark light;

  --font-ui: "Mona Sans Variable", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono Variable", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --radius-pane: 8px;
  --gap: 8px;

  --bg-backdrop: #08090b;
  --chrome: #14161a;
  --term-bg: #0e1013;
  --ring: #24282e;
  --hair: #24282e;
  --hair-2: #363b43;
  --text-1: #e8eaed;
  --text-2: #a3a8b0;
  --text-3: #7e848d;
  --focus: #e8eaed;
  --link-line: var(--hair-2);
  --state-needs: #f0a630;
  --state-done: #43c47c;
  --state-working: #a3a8b0;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg-backdrop: #dcdfe4;
    --chrome: #eceef1;
    --term-bg: #fbfbfc;
    --ring: #c8ccd3;
    --hair: #d6d9de;
    --hair-2: #b9bec6;
    --text-1: #15171b;
    --text-2: #474c54;
    --text-3: #636973;
    --focus: #16181c;
    --link-line: var(--text-3);
    --state-needs: #d98708;
    --state-done: #1f9d5b;
    --state-working: #474c54;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(28px, 6vw, 96px) clamp(24px, 7vw, 112px) clamp(20px, 3vw, 36px);
  background: var(--bg-backdrop);
  color: var(--text-1);
  font: 400 1.0625rem / 1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,
p {
  margin: 0;
}

/* ---------- Layout: text beside the picture, stacked on narrow screens ---------- */
.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 30rem) minmax(0, 42rem);
  justify-content: space-between;
  align-items: start;
  align-content: center;
  gap: clamp(40px, 6vw, 112px);
}
/* side by side: pull the h1 up so its cap height lines up with the pane tops */
@media (min-width: 881px) {
  .page:not(.page-404) h1 {
    margin-top: -0.17em;
  }
}
@media (max-width: 880px) {
  .page {
    grid-template-columns: minmax(0, 36rem);
    justify-content: start;
    align-content: start;
    gap: 44px;
  }
}

/* ---------- Text ---------- */
.intro {
  max-width: 33em;
}
h1 {
  font-size: clamp(2.5rem, 1.9rem + 1.9vw, 3.25rem);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.7em;
}
.intro p + p {
  margin-top: 1em;
}
.what {
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--text-1);
}
@media (max-width: 520px) {
  .what {
    font-size: 1.125rem;
  }
}
.status,
.contact {
  color: var(--text-2);
}

a {
  color: var(--text-1);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  border-radius: 3px;
}
/* room for the focus ring before the full stop */
.contact a {
  margin-inline-end: 0.12em;
}
a:hover {
  text-decoration-color: currentColor;
}
a:focus {
  outline: none;
}
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  text-decoration-color: currentColor;
}

.foot {
  width: 100%;
  max-width: 1180px;
  margin: clamp(40px, 6vw, 72px) auto 0;
  font: 400 0.75rem / 1.4 var(--font-mono);
  color: var(--text-2);
}

/* small phones: keep the picture and the footer on one screen */
@media (max-width: 520px) and (max-height: 720px) {
  body {
    padding-top: 20px;
  }
  h1 {
    margin-bottom: 0.45em;
  }
  .intro p + p {
    margin-top: 0.6em;
  }
  .page {
    gap: 24px;
  }
  .foot {
    margin-top: 24px;
  }
}

/* ---------- The picture: four panes of the agent grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  aspect-ratio: 8 / 5;
  width: 100%;
}
@media (max-width: 520px) {
  .grid {
    aspect-ratio: 1 / 1;
    max-height: 22rem;
  }
}
@media (max-width: 520px) and (max-height: 720px) {
  .grid {
    aspect-ratio: 8 / 5;
  }
}

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--term-bg);
  border-radius: var(--radius-pane);
  overflow: hidden;
  container-type: inline-size;
}
/* the hairline ring drawn above the content, as in the app */
.pane::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--ring);
  border-radius: inherit;
  pointer-events: none;
}
/* the amber edge of a pane whose agent needs you */
.pane[data-state="needs_you"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid var(--state-needs);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

.pane-h {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  flex: none;
  padding: 0 10px;
  background: var(--chrome);
  border-bottom: 1px solid var(--hair);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  min-width: 0;
}
.pane-agent {
  font-weight: 650;
  color: var(--text-1);
  flex: none;
}
.pane-ws {
  font: 500 11.5px var(--font-mono);
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
@container (max-width: 210px) {
  .pane-ws {
    display: none;
  }
}

/* muted lines standing in for terminal text */
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 12px;
  /* its height comes from the grid cell, so it can be a size container */
  container: body / size;
}
/* hide lines that do not fit, a whole line at a time, so no bar is ever cut.
   Each step is the bottom edge of line n in the fullest pane (5px lines,
   7px gaps, 6px extra before a group); the queried height is the content box. */
@container body (height < 113px) { .pane-body > :nth-child(n+9) { display: none; } }
@container body (height < 101px) { .pane-body > :nth-child(n+8) { display: none; } }
@container body (height < 89px)  { .pane-body > :nth-child(n+7) { display: none; } }
@container body (height < 71px)  { .pane-body > :nth-child(n+6) { display: none; } }
@container body (height < 59px)  { .pane-body > :nth-child(n+5) { display: none; } }
@container body (height < 41px)  { .pane-body > :nth-child(n+4) { display: none; } }
/* the idle pane keeps its prompt and drops a line above it instead */
@container body (height < 41px)  { [data-state="idle"] .pane-body > :nth-child(2) { display: none; } }
.ln {
  flex: none;
  display: block;
  height: 5px;
  border-radius: 2.5px;
  background: var(--hair-2);
  opacity: 0.75;
}
.ln.dim {
  background: var(--hair);
  opacity: 1;
}
.ln.in {
  margin-left: 14px;
}
.gap {
  margin-top: 6px;
}
.w15 { width: 15%; }
.w25 { width: 25%; }
.w35 { width: 35%; }
.w45 { width: 45%; }
.w55 { width: 55%; }
.w65 { width: 65%; }
.w75 { width: 75%; }
.w85 { width: 85%; }
.w95 { width: 95%; }

/* a still block cursor at the prompt of the idle pane */
.prompt {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cursor {
  display: block;
  width: 6px;
  height: 11px;
  border-radius: 1px;
  background: var(--text-3);
}

/* ---------- State glyphs, drawn on a 12 by 12 grid ---------- */
.st {
  display: block;
  flex: none;
  overflow: visible;
}
.st .f-needs {
  fill: var(--state-needs);
}
.st .f-done {
  fill: var(--state-done);
}
.st .f-mute {
  fill: var(--text-3);
}
.st .s-track {
  fill: none;
  stroke: var(--state-working);
  stroke-opacity: 0.28;
  stroke-width: 1.5;
}
.st .s-work {
  fill: none;
  stroke: var(--state-working);
  stroke-width: 1.5;
  stroke-linecap: round;
}
/* the only motion on the page */
.st-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: st-spin 1.1s linear infinite;
}
@keyframes st-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .st-spin {
    animation: none;
  }
}

/* ---------- 404 ---------- */
.page-404 {
  grid-template-columns: minmax(0, 33em);
  justify-content: start;
}
