/* ============================================================
   sensortap.baselashraf.com
   Direction: instrument readout. See DESIGN.md.
   ============================================================ */

:root {
  --bg: #0a0d0f;
  --bg-panel: #101418;
  --bg-panel-raised: #161b20;
  --line: #242b31;
  --ink: #e8ecee;
  --ink-dim: #9aa5ab;
  --ink-faint: #7a848a;
  --amber: #ffb454;
  --amber-dim: #8a6a3c;
  --blue: #5fb3d9;
  --green: #7ec98f;
  --red-dim: #c17e6e;

  --font-sans: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --shell: 74rem;
  --gap: clamp(1.25rem, 5vw, 3rem);
  --measure: 34rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* No overflow clip on body: the nav dropdown is positioned relative to
     .bar and must be able to escape into the viewport below it. Horizontal
     overflow is prevented per-element instead (.term__body, .code-block
     scroll their own long lines) so nothing needs a page-level clip. */
}

a { color: var(--blue); text-decoration: underline; text-decoration-color: rgba(95, 179, 217, 0.4); text-underline-offset: 0.15em; }
a:hover { text-decoration-color: currentColor; }

code { font-family: var(--font-mono); }

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

.skip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
}
.skip:focus { transform: translate(-50%, 0); }

/* --- Nav bar (shared vocabulary with sibling subdomains) -------------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 13, 15, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.bar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.75rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.bar__name {
  font-size: 0.86rem;
  color: var(--ink-dim);
  text-decoration: none;
}
.bar__name strong { color: var(--ink); }
.bar__name:hover { color: var(--ink); }

.bar__links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.bar__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-dim);
  text-decoration: none;
  white-space: nowrap;
}
.bar__link:hover { color: var(--ink); background: var(--bg-panel-raised); }
.bar__link--primary { color: var(--bg); background: var(--amber); font-weight: 600; }
.bar__link--primary:hover { background: #ffc478; color: var(--bg); }
.bar__link--dim { color: var(--ink-faint); }
.bar__link--icon { padding: 0.45rem; }

.bar__divider { width: 1px; height: 1.2rem; background: var(--line); margin: 0 0.2rem; }

.icon { width: 1em; height: 1em; }

.drop { position: relative; }
.drop summary { cursor: pointer; list-style: none; }
.drop summary::-webkit-details-marker { display: none; }
.drop__chevron { transition: transform 0.15s var(--ease); }
.drop[open] .drop__chevron { transform: rotate(180deg); }

.drop__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  min-width: 15rem;
  background: var(--bg-panel-raised);
  border: 1px solid #333c44;
  border-radius: 10px;
  padding: 0.4rem;
}
.drop__menu--right { right: 0; }

.drop__option {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
}
.drop__option:hover { background: var(--bg-panel-raised); }
.drop__name { display: block; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.drop__note { display: block; font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.1rem; }

/* --- Hero --------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(2.5rem, 7vh, 5rem) 0 clamp(3rem, 8vh, 6rem);
  isolation: isolate;
}

.hero__grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(255, 180, 84, 0.05), transparent),
    radial-gradient(ellipse 50% 40% at 100% 10%, rgba(95, 179, 217, 0.04), transparent);
}

.hero__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: var(--gap);
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 62rem) {
  .hero__inner {
    grid-template-columns: minmax(0, 25rem) minmax(0, 1fr);
  }
}

.hero__kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
  margin: 0 0 0.6rem;
}

.wordmark {
  font-size: clamp(2.6rem, 1.6rem + 5vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
}

.lede {
  font-size: 1.08rem;
  color: var(--ink);
  max-width: 34ch;
  margin: 0 0 0.9rem;
}
.lede--quiet { color: var(--ink-dim); font-size: 0.98rem; }

.actions {
  display: flex;
  gap: 0.7rem;
  margin: 1.4rem 0 0.9rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--bg-panel-raised);
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.button:hover { border-color: var(--amber-dim); background: #1c2229; }
.button--primary {
  background: var(--amber);
  color: #1a1206;
  border-color: transparent;
}
.button--primary:hover { background: #ffc478; }

.fineprint { font-size: 0.84rem; color: var(--ink-faint); max-width: 34ch; }

/* --- Terminal panel ------------------------------------------------------ */

.term {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-panel-raised);
  border-bottom: 1px solid var(--line);
}
.term__dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--line); }
.term__title {
  margin-left: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
}

.term__body {
  margin: 0;
  padding: 1.1rem 1.2rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--ink-dim);
}

.term__prompt { color: var(--blue); }
.term__row { display: block; white-space: pre; color: var(--ink-dim); }
.term__id { color: var(--ink); }
.term__kind { color: var(--blue); }
.term__present { color: var(--green); }
.term__absent { color: var(--red-dim); }
.term__ellipsis { display: block; color: var(--ink-faint); font-style: italic; margin: 0.2rem 0; }
.term__summary { display: block; color: var(--amber); margin-top: 0.3rem; }
.term__summary strong { color: var(--amber); }

.term__cursor {
  animation: blink 1.1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .term__cursor { animation: none; }
}
@keyframes blink {
  50% { opacity: 0; }
}

/* --- Sections ------------------------------------------------------------ */

.bay {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 5.5rem) var(--gap);
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
}

@media (min-width: 62rem) {
  .bay { grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); }
  .bay--quiet, .bay--stack, .bay--limits, .bay--proof { grid-template-columns: 1fr; }
}

.bay--quiet, .bay--proof { background: var(--bg-panel); }

.bay__measure, .bay__wide {
  max-width: var(--measure);
}
.bay--quiet .bay__wide, .bay--proof .bay__wide, .bay--stack .bay__measure, .bay--limits .bay__measure {
  max-width: 42rem;
}

.bay h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.bay p { color: var(--ink-dim); margin: 0 0 1rem; }
.bay p:last-child { margin-bottom: 0; }
.bay code { color: var(--ink); background: var(--bg-panel-raised); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }

.statement { font-size: 1.2rem; color: var(--ink); line-height: 1.5; }

.snap { border: none; border-top: 1px solid var(--line); margin: 0; }

/* --- Diagram -------------------------------------------------------------- */

.plate { margin: 0; }
.diagram { width: 100%; height: auto; }
.plate figcaption { margin-top: 0.9rem; font-size: 0.86rem; color: var(--ink-faint); }

/* --- Steps ----------------------------------------------------------------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.8rem;
}

.step {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 1rem;
  align-items: start;
}

.step__num {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--amber);
  font-size: 1.1rem;
}

.step h3 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.step p { color: var(--ink-dim); }

.code-block {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--ink-dim);
}
.code-block .kw { color: var(--blue); }
.code-block .str { color: var(--green); }
.code-block .cm { color: var(--ink-faint); }

/* --- Limits ---------------------------------------------------------------- */

.limits {
  margin: 0;
  display: grid;
  gap: 1.6rem;
}
.limits dt {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.limits dd {
  margin: 0;
  color: var(--ink-dim);
  max-width: 42rem;
}

/* --- Footer ----------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: clamp(2rem, 5vh, 3rem) var(--gap);
}
.foot__inner {
  max-width: var(--shell);
  margin: 0 auto;
  font-size: 0.86rem;
  color: var(--ink-faint);
}
.foot__inner p { margin: 0 0 0.5rem; }
.foot__fine { font-size: 0.8rem; }

/* --- Responsive tightening --------------------------------------------------- */

@media (max-width: 30rem) {
  .term__body { font-size: 0.7rem; }
}
