/* Stitch: slate/bone console shell. Ink strokes, one ruled grid, oxide only
   for thresholds and the primary action. Shape rule: zero radius everywhere.
   This is a shell template page, not a live admin. */

:root {
  --ink: #21262B;
  --bone: #E9EAE2;
  --panel: #F4F4EE;
  --rule: #C7C9BE;
  --oxide: #B3401B;
  --shale: #5C636A;
  --sans: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", monospace;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bone);
  padding: 0.6rem 1rem;
  font-weight: 600;
}
.skip:focus { left: 0; z-index: 100; }

a { color: inherit; }

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

/* Top bar */

.top {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.demo-chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--shale);
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 0.28rem 0.6rem;
}

.cta {
  margin-left: auto;
  background: var(--oxide);
  color: var(--bone);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.55rem 1.1rem;
  white-space: nowrap;
  transition: background 160ms ease;
}
.cta:hover { background: #97350F; }
.cta:active { transform: translateY(1px); }

/* Shell frame */

.shell {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: calc(100vh - 58px);
}

.rail {
  min-width: 0;
  border-right: 1px solid var(--rule);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.rail nav {
  display: flex;
  flex-direction: column;
}

.rail nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--shale);
  padding: 0.5rem 0.6rem;
  border-left: 2px solid transparent;
}
.rail nav a:hover { color: var(--ink); }
.rail nav a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--oxide);
  font-weight: 600;
}

.rail-note {
  font-size: 0.85rem;
  color: var(--shale);
  max-width: 24ch;
}

/* Main column */

main { padding: 1.6rem 1.4rem 2rem; min-width: 0; }

.intro {
  max-width: 52ch;
  margin-bottom: 1.6rem;
}

.intro h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

.intro p {
  margin-top: 0.5rem;
  color: var(--shale);
  font-size: 1rem;
}

/* Shared cell: every module is a cell of one ruled grid */

.cell {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1rem 1.1rem;
  min-width: 0;
}

.cell h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--shale);
  margin-bottom: 0.8rem;
}

/* Status strip: four equal instruments */

.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.metric .value {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 500;
  line-height: 1.1;
}

.metric .hot { color: var(--oxide); }

.metric .note {
  font-size: 0.78rem;
  color: var(--shale);
  margin-top: 0.2rem;
}

/* Panel grid: unequal modules on one ruled field */

.panels {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-areas:
    "queue queue gauge"
    "regions feed gauge";
  gap: 0.8rem;
}

.wide { grid-column: span 2; }

/* Assign areas explicitly */
.panels .module:nth-of-type(1) { grid-area: queue; }
.panels .module:nth-of-type(2) { grid-area: gauge; }
.panels .module:nth-of-type(3) { grid-area: regions; }
.panels .module:nth-of-type(4) { grid-area: feed; }

.queue, .feed, .regions {
  list-style: none;
  padding: 0;
}

.queue li, .feed li, .regions li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
}
.queue li:first-child, .feed li:first-child, .regions li:first-child {
  border-top: 0;
  padding-top: 0;
}

.what {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.state {
  margin-left: auto;
  color: var(--shale);
  font-size: 0.82rem;
}

time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--shale);
  flex-shrink: 0;
}

/* Gauge ring: ink track, oxide arc for spent budget */

.gauge { display: flex; flex-direction: column; }

.ring {
  width: 130px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--oxide) 0 295deg, var(--rule) 295deg 360deg);
  display: grid;
  place-content: center;
  text-align: center;
  margin: 0.4rem auto 0;
}
.ring::before {
  content: "";
  width: 78px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel);
  grid-area: 1 / 1;
  place-self: center;
  margin-top: 2.4rem;
}

.ring-value, .ring-label { grid-area: 1 / 1; place-self: center; }
.ring-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 500;
  transform: translateY(-0.5rem);
}
.ring-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shale);
  transform: translateY(1.6rem);
}

/* Footer */

.foot {
  border-top: 1px solid var(--rule);
  padding: 1.6rem 1.4rem 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

.foot p { font-size: 0.92rem; max-width: 46ch; }
.foot .fine { color: var(--shale); font-size: 0.82rem; }

/* Motion: hover states only, nothing loops */

@media (prefers-reduced-motion: reduce) {
  .cta { transition: none; }
  html { scroll-behavior: auto; }
}

/* Mobile */

@media (max-width: 1080px) {
  .panels {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "queue gauge"
      "queue gauge"
      "regions feed";
  }
}

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; min-height: 0; }
  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 0.8rem 1rem;
  }
  .rail nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.4rem;
  }
  .rail nav a {
    border-left: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    padding: 0.4rem 0.5rem;
  }
  .rail nav a[aria-current="page"] { border-bottom-color: var(--oxide); }
  .rail-note { display: none; }
  .strip { grid-template-columns: 1fr 1fr; }
  .wide { grid-column: auto; }
  .intro h1 { text-wrap: balance; }
  .panels {
    grid-template-columns: 1fr;
    grid-template-areas: "queue" "gauge" "regions" "feed";
  }
}

@media (max-width: 520px) {
  .top { flex-wrap: wrap; }
  .demo-chip { order: 3; }
  .cta { margin-left: auto; }
}
