/* tellatribe docs — a Read surface in the Title-Card Wall world (DESIGN.md).
   Tokens come from .impeccable/design.json. The accent is spent on the focus
   stand-in (the current sidebar item, :focus-visible, selection) and the one
   primary action (the gate button). Nothing else. */

:root {
  color-scheme: dark;
  --ground: #0F1114;
  --surface: #171A1F;
  --surface-2: #1F242B;
  --surface-3: #272D36;
  --line: #2A3039;
  --fg: #ECECEA;
  --fg-2: #A6ABB3;
  --fg-3: #7F858F;
  --accent: #4D7CFF;
  --accent-fill: #3761E0;
  --warn: #FF6B57;
  --ink: #111111;

  --display: "Big Shoulders Display", "Archivo Narrow", "Arial Narrow", Impact, sans-serif;
  --ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 56px;
  --sidebar-w: 272px;
  --gutter: 16px;
  --measure: 72ch;
  --shadow-ambient: 0 8px 24px rgba(0, 0, 0, .45);
}

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

html { background: var(--ground); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--fg);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--accent); color: #fff; }

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

a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--fg-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg); }

/* ---------- header ---------- */

.hdr {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--gutter);
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}
.hdr .wordmark {
  font-family: var(--display);
  font-weight: 700; font-size: 24px; line-height: 1; letter-spacing: .03em;
  text-transform: uppercase; text-decoration: none; color: var(--fg);
  white-space: nowrap;
}
.hdr .wordmark b { font-weight: inherit; color: var(--fg-2); }
.hdr .section { color: var(--fg-3); font-size: 14px; font-weight: 500; margin-top: 2px; }
.hdr .status { margin-left: auto; font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.hdr .status span { color: var(--fg-3); }
.menu-btn {
  display: none;
  width: 40px; height: 40px; margin-left: -8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--fg);
  cursor: pointer; align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.side {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 18px 14px 32px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.side h2 {
  margin: 18px 10px 6px;
  font-family: var(--ui);
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-3);
}
.side h2:first-child { margin-top: 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a {
  display: block; position: relative;
  padding: 7px 10px; border-radius: 8px;
  color: var(--fg-2); font-size: 14px; line-height: 1.3; text-decoration: none;
}
.side a:hover { background: var(--surface); color: var(--fg); }
.side a[aria-current="page"] { background: var(--surface); color: var(--fg); font-weight: 600; }
.side a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  border-radius: 2px; background: var(--accent);
}
.scrim { display: none; }

.main { min-width: 0; padding: 36px 32px 96px; }
.article { max-width: var(--measure); }

/* ---------- document typography ---------- */

.article h1 {
  font-family: var(--display);
  font-weight: 700; font-size: 44px; line-height: .95; letter-spacing: .005em;
  text-transform: uppercase; text-wrap: balance;
  margin: 0 0 22px;
}
.article h2 {
  font-family: var(--display);
  font-weight: 700; font-size: 24px; line-height: 1; letter-spacing: .03em;
  text-transform: uppercase;
  margin: 52px 0 14px; padding-top: 18px; border-top: 1px solid var(--line);
}
.article hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }
.article h3 { font-size: 18px; font-weight: 600; line-height: 1.3; margin: 34px 0 10px; }
.article h4 { font-size: 16px; font-weight: 600; margin: 26px 0 8px; }
.article h5, .article h6 { font-size: 15px; font-weight: 600; margin: 20px 0 6px; color: var(--fg-2); }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 24px; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 6px 0 0; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.article strong { font-weight: 600; color: var(--fg); }
.article img { max-width: 100%; height: auto; border-radius: 12px; }

.article blockquote {
  margin: 0 0 16px; padding: 2px 0 2px 18px;
  border-left: 2px solid var(--line); color: var(--fg-2);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); color: var(--fg);
  padding: .1em .4em; border-radius: 5px;
}
.article pre {
  margin: 0 0 18px; padding: 16px 18px;
  background: var(--surface); border-radius: 12px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.55;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.article pre code { background: none; padding: 0; font-size: inherit; color: var(--fg); }

.article .table-wrap {
  margin: 0 0 20px; overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.article table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.45; }
.article th {
  text-align: left; padding: 8px 12px 8px 0; vertical-align: bottom;
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-3); border-bottom: 1px solid var(--line);
}
.article td { padding: 10px 14px 10px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.article tr > :last-child { padding-right: 0; }
.article td code { white-space: nowrap; }
.article .path { font-family: var(--mono); font-size: .88em; color: var(--fg-2); }

.article .doc-meta { margin: 0 0 24px; font-size: 13px; color: var(--fg-3); }
.article .doc-meta code { background: none; padding: 0; color: var(--fg-3); }
.article .doc-foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-3); }

/* ---------- overview: document list ---------- */

.doclist { list-style: none; padding: 0; margin: 0 0 24px; }
.doclist li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.doclist a { font-weight: 600; text-decoration: none; }
.doclist a:hover { text-decoration: underline; }
.doclist p { margin: 2px 0 0; color: var(--fg-2); font-size: 14.5px; }

/* ---------- status page ---------- */

.timeline { list-style: none; margin: 0 0 28px; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.timeline .when { font-size: 13px; font-weight: 600; color: var(--fg-2); padding-top: 2px; font-variant-numeric: tabular-nums lining-nums; }
.timeline .what p { margin: 0; }
.timeline .what code { white-space: nowrap; }

.decisions { list-style: none; margin: 0 0 28px; padding: 0; counter-reset: none; }
.decisions li { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.decisions .n { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1; color: var(--fg-3); padding-top: 2px; }
.decisions .q { font-size: 13px; color: var(--fg-3); margin: 0 0 4px; }
.decisions .d { margin: 0 0 6px; font-weight: 500; }
.decisions .note { margin: 0; font-size: 14.5px; color: var(--fg-2); }

/* ---------- screens gallery ---------- */

.gallery { max-width: none; }
.gallery .article-head { max-width: var(--measure); }
.gallery h2 { margin-top: 44px; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.shot { margin: 0; background: var(--surface); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.shot a { display: block; background: var(--surface-2); }
.shot img { display: block; width: 100%; height: auto; max-height: 540px; object-fit: contain; object-position: top; }
.shot figcaption { padding: 12px 14px 14px; }
.shot .t { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.shot .c { font-size: 14px; color: var(--fg-2); margin: 0 0 8px; }
.shot .p { font-size: 12px; color: var(--fg-3); margin: 0; }
.gallery .empty { border: 1px dashed var(--line); border-radius: 12px; padding: 28px; color: var(--fg-2); max-width: var(--measure); }

/* ---------- gate ---------- */

.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--ground);
}
.gate.off { display: none; }
.gate form {
  width: min(100%, 380px);
  padding: 28px 24px 24px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-ambient);
  text-align: center;
}
.gate .wordmark {
  font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .03em; text-transform: uppercase;
  margin: 0 0 6px;
}
.gate .wordmark b { font-weight: inherit; color: var(--fg-2); }
.gate p { margin: 0 0 20px; color: var(--fg-2); font-size: 14px; }
.gate .row { display: flex; gap: 10px; justify-content: center; }
.gate input {
  width: 150px; padding: 12px 10px 12px 18px;
  font-family: var(--mono); font-size: 22px; letter-spacing: .4em; text-align: center;
  background: var(--surface-2); color: var(--fg);
  border: 0; border-radius: 12px;
  font-variant-numeric: tabular-nums lining-nums;
}
.gate button {
  padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent-fill); color: #fff; font: 600 15px/1 var(--ui);
}
.gate button:hover { filter: brightness(1.08); }
.gate .err { height: 20px; margin: 12px 0 0; font-size: 13px; color: var(--warn); }
.gate form.shake { animation: shake .4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ---------- responsive ---------- */

@media (min-width: 900px) {
  .hdr { padding: 0 28px; }
}

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .side {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 50;
    width: min(var(--sidebar-w), 86vw); height: auto;
    background: var(--ground);
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .side { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 45; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { padding: 24px var(--gutter) 72px; }
  .article h1 { font-size: 36px; }
  .article h2 { font-size: 22px; margin-top: 40px; }
  .timeline li { grid-template-columns: 56px 1fr; gap: 12px; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 639px) {
  .hdr .status { display: none; }
  .hdr .section { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .side, .scrim { transition: none; }
  .gate form.shake { animation: none; }
}
