/* sentinelmode.dev — sentinel species, laid out like a quiet monitoring console. */
:root {
  --bg: #f3f2ec;
  --grid: #e7e5dc;
  --panel: #ffffff;
  --head: #ecebe4;
  --ink: #1b1f1d;
  --muted: #535a56;
  --line: #d4d2c7;
  --ok: #24573a;
  --ok-bg: #e0eee4;
  --ok-bar: #3f8a5c;
  --warn: #774b00;
  --warn-bg: #f6e9cc;
  --info: #1d5372;
  --info-bg: #dcebf3;
  --info-bar: #3b7ea6;
  --off: #4c524f;
  --off-bg: #e6e6e0;
  --off-bar: #9a9f9b;
  --focus: #1d5372;
  --term: #17201b;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0; color: var(--ink); font-family: var(--sans); font-size: 1.02rem; line-height: 1.65;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--mono); font-weight: 600; line-height: 1.15; margin: 0 0 .6em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--info); text-underline-offset: .18em; }
code { font-family: var(--mono); font-size: .92em; background: var(--head); padding: .05em .35em; border-radius: 4px; }

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

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 6px; font-family: var(--mono); }
.skip:focus { top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html:not(.js) .js-only { display: none !important; }

/* ---------- Shell ---------- */
.shell { max-width: 86rem; margin: 0 auto; display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 0 clamp(1.5rem, 3vw, 2.5rem); padding: 0 clamp(1rem, 3vw, 2rem); }
.side { position: sticky; top: 0; align-self: start; padding: 1.6rem 0; min-height: 100vh; display: flex; flex-direction: column; gap: 1.6rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-family: var(--mono); font-weight: 600; font-size: 1.05rem; }
.brand svg { width: 2rem; height: 2rem; flex: none; }
.brand rect { fill: var(--ink); }
.brand path { fill: none; stroke: #9fe0b5; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand b { font-weight: 400; color: var(--muted); }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.side nav a { display: block; padding: .35rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; font-family: var(--mono); font-size: .92rem; }
.side nav a span { color: var(--muted); margin-right: .4rem; }
.side nav a:hover { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.side-note { font-size: .88rem; color: var(--muted); border-left: 2px solid var(--line); padding-left: .8rem; margin: 0; }

.column { min-width: 0; padding: 1.6rem 0 0; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.5rem 2rem; align-items: center; padding: clamp(1rem, 4vw, 3rem) 0 2.5rem; }
.path { font-family: var(--mono); font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); letter-spacing: -.03em; margin-bottom: .4em; }
.lede { font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: #2c322f; max-width: 34rem; margin: 0; }

.term { margin: 0; background: var(--term); border-radius: 10px; overflow: hidden; box-shadow: 0 18px 40px rgba(27, 31, 29, .18); min-width: 0; }
.term-bar { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; background: #222c27; }
.term-bar i { width: .65rem; height: .65rem; border-radius: 50%; background: #48544e; }
.term-bar span { margin-left: .5rem; font-family: var(--mono); font-size: .78rem; color: #a8b8ae; }
.term-body { margin: 0; padding: 1rem 1.1rem 1.2rem; overflow-x: auto; color: #dce8df; font-family: var(--mono); font-size: clamp(.72rem, 2.6vw, .9rem); line-height: 1.75; }
.term-body code { background: none; padding: 0; font-size: inherit; }
.t-prompt { color: #9fe0b5; }
.t-dim { color: #97a99e; }
.t-ok { color: #9fe0b5; }
.t-off { color: #e2c98f; }
.t-cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: text-bottom; background: #9fe0b5; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.pulse { grid-column: 1 / -1; width: 100%; height: 3rem; }
.pulse path { fill: none; stroke: var(--ok-bar); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 1400 200; animation: trace 6s linear infinite; }
@keyframes trace { from { stroke-dashoffset: 1600; } to { stroke-dashoffset: 0; } }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 2rem; overflow: hidden; scroll-margin-top: 1rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding: .55rem 1.1rem; background: var(--head); border-bottom: 1px solid var(--line); }
.file { font-family: var(--mono); font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .5rem; }
.file::before { content: ""; width: .55rem; height: .55rem; border-radius: 2px; background: var(--ok-bar); }
.panel-body { padding: clamp(1.1rem, 3vw, 2rem); }
.count { margin: 0; font-family: var(--mono); font-size: .85rem; color: var(--muted); }

.pill { display: inline-block; font-family: var(--mono); font-size: .76rem; font-weight: 500; line-height: 1.2; padding: .22rem .55rem; border-radius: 999px; white-space: nowrap; }
.pill-ok { color: var(--ok); background: var(--ok-bg); }
.pill-warn { color: var(--warn); background: var(--warn-bg); }
.pill-info { color: var(--info); background: var(--info-bg); }
.pill-off { color: var(--off); background: var(--off-bg); }

/* ---------- README ---------- */
.readme-body > p { max-width: 50rem; }
.two-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; margin: 1.6rem 0; }
.two-kinds > div { border: 1px dashed var(--line); border-radius: 8px; padding: 1rem 1.1rem; }
.two-kinds h3 { margin-bottom: .5rem; }
.two-kinds h3 .pill { font-size: .85rem; }
.two-kinds p { margin: 0; font-size: .97rem; color: #2c322f; }
.note { font-family: var(--mono); font-size: .9rem; color: var(--muted); margin: 0; }
.note span { color: var(--ok-bar); }

/* ---------- Board ---------- */
.board-help { color: var(--muted); max-width: 48rem; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.2rem 0 1rem; }
.filters button {
  font: 500 .88rem var(--mono); color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: .35rem .8rem; cursor: pointer;
}
.filters button::before { content: "--"; color: var(--muted); }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters button[aria-pressed="true"]::before { color: #9fe0b5; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); gap: .7rem; margin-bottom: 1.4rem; }
.tile {
  display: grid; gap: .3rem; justify-items: start; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: #fbfbf8; border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px;
  padding: .8rem .9rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile[hidden] { display: none; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(27, 31, 29, .08); }
.tile.kind-ok { border-left-color: var(--ok-bar); }
.tile.kind-info { border-left-color: var(--info-bar); }
.tile.kind-off { border-left-color: var(--off-bar); }
.tile-name { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; }
.tile-meta { font-size: .88rem; color: var(--muted); }
.tile[aria-selected="true"] { background: var(--panel); border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.tile[aria-selected="true"] .tile-name::after { content: " ●"; color: var(--ok-bar); font-size: .8em; }

.details { display: grid; gap: 1.2rem; }
.detail { border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem 1.2rem; background: #fdfdfb; }
.detail[hidden] { display: none; }
.detail h3 { font-size: 1.35rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; }
.detail h3 small { font-family: var(--sans); font-weight: 400; font-size: .95rem; color: var(--muted); }
.detail-tag { order: 3; }
.kv { margin: 0; display: grid; gap: 0; }
.kv div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .3rem 1.2rem; padding: .65rem 0; border-top: 1px dashed var(--line); }
.kv dt { font-family: var(--mono); font-size: .88rem; color: var(--info); padding-top: .1rem; }
.kv dt::after { content: ":"; color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Spec ---------- */
.spec-help { color: var(--muted); }
.spec-list { margin: 1rem 0 0; padding: .6rem 0; background: #fafaf6; border: 1px solid var(--line); border-radius: 8px; counter-reset: line; }
.spec-list div {
  counter-increment: line; display: grid; grid-template-columns: 2.6rem 11rem minmax(0, 1fr); gap: 0 .8rem;
  padding: .45rem 1rem .45rem 0; align-items: baseline;
}
.spec-list div::before { content: counter(line); font-family: var(--mono); font-size: .8rem; color: #6b716d; text-align: right; border-right: 1px solid var(--line); padding-right: .6rem; }
.spec-list dt { font-family: var(--mono); font-weight: 600; color: var(--ok); }
.spec-list dt::after { content: ":"; color: var(--muted); font-weight: 400; }
.spec-list dd { margin: 0; }

/* ---------- Changelog ---------- */
.log { list-style: none; margin: 1rem 0 0; padding: 0; }
.log li { display: grid; grid-template-columns: 4.5rem 7.5rem minmax(0, 1fr); gap: .3rem 1rem; align-items: baseline; padding: .8rem 0; border-top: 1px dashed var(--line); }
.log li:first-child { border-top: 0; }
.log-when { font-family: var(--mono); font-weight: 600; }
.log-tag { justify-self: start; font-family: var(--mono); font-size: .76rem; padding: .18rem .5rem; border-radius: 4px; }
.tag-added { color: var(--ok); background: var(--ok-bg); }
.tag-docs { color: var(--info); background: var(--info-bg); }
.tag-deprecated { color: var(--warn); background: var(--warn-bg); }
.tag-ongoing { color: #fff; background: var(--ink); }
.log p { margin: 0; }

/* ---------- Contact ---------- */
.contact-intro { max-width: 44rem; color: #2c322f; }
.contact-form { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; margin-top: 1.4rem; max-width: 50rem; }
.field { display: grid; gap: .3rem; }
.field-wide, .cf-turnstile, .contact-form button, .form-status { grid-column: 1 / -1; }
.field label { font-family: var(--mono); font-size: .88rem; font-weight: 500; }
.field label::after { content: " *"; color: var(--muted); }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fbfbf8;
  border: 1px solid #a9a79d; border-radius: 6px; padding: .6rem .75rem;
}
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; background: #fff; }
.field textarea { resize: vertical; min-height: 8rem; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { min-height: 65px; }
.contact-form button {
  justify-self: start; font: 600 .95rem var(--mono); color: #fff; background: var(--ink);
  border: 0; border-radius: 6px; padding: .75rem 1.3rem; cursor: pointer;
}
.contact-form button::before { content: "→ "; color: #9fe0b5; }
.contact-form button:hover { background: #2d3531; }
.contact-form button:disabled { opacity: .6; cursor: progress; }
.form-status { margin: 0; min-height: 1.6em; font-family: var(--mono); font-size: .92rem; }
.contact-form[data-state="sending"] .form-status { color: var(--muted); }
.contact-form[data-state="sent"] .form-status { color: var(--ok); }
.contact-form[data-state="sent"] .form-status::before { content: "[ok] "; }
.contact-form[data-state="error"] .form-status { color: #a1261b; }
.contact-form[data-state="error"] .form-status::before { content: "[error] "; }

/* ---------- Footer ---------- */
.foot { padding: 1rem 0 2.5rem; font-size: .92rem; color: var(--muted); }
.foot p { margin: 0 0 .4rem; }
.foot-note { font-family: var(--mono); font-size: .82rem; }

/* ---------- 404 ---------- */
.lost-main { min-height: 80vh; display: grid; place-items: center; padding: 2rem 1rem; }
.lost-card { width: min(100%, 38rem); }
.lost-card h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.lost-card .term-body { font-size: clamp(.78rem, 3vw, .92rem); }
.t-err { color: #ffb3a7; }
.home-link { display: inline-block; margin-top: 1.2rem; font-family: var(--mono); font-weight: 600; color: #fff; background: var(--ink); padding: .7rem 1.2rem; border-radius: 6px; text-decoration: none; }
.home-link::before { content: "← "; color: #9fe0b5; }
.lost-foot { text-align: center; padding: 1rem 1rem 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; min-height: 0; padding: 1.2rem 0 .4rem; gap: .9rem; border-bottom: 1px solid var(--line); }
  .side ul { display: flex; flex-wrap: wrap; gap: .2rem .3rem; }
  .side nav a { padding: .25rem .5rem; }
  .side-note { display: none; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kv div { grid-template-columns: 1fr; gap: .1rem; }
  .spec-list div { grid-template-columns: 2rem minmax(0, 1fr); }
  .spec-list dd { grid-column: 2; }
  .log li { grid-template-columns: 4rem minmax(0, 1fr); }
  .log li p { grid-column: 1 / -1; }
  .contact-form { grid-template-columns: 1fr; }
}
