/* =========================================================================
   Prison Simulator — Inmate Handbook
   An official-document aesthetic: editorial, typographic, restrained.
   One institutional accent. No gradients, no glow, no card-grid filler.
   ========================================================================= */

:root {
  --bg: #0c0d0f;
  --bg-rule: #141518;
  --ink: #d9d6ce;          /* warm off-white body text */
  --ink-strong: #f1eee7;
  --muted: #8d8a83;
  --faint: #5d5b56;

  --accent: #c8923a;        /* desaturated institutional amber */
  --accent-dim: #8a6a32;
  --danger: #b8463c;

  --line: rgba(217, 214, 206, 0.12);
  --line-strong: rgba(217, 214, 206, 0.26);

  --display: "Oswald", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --measure: 70ch;
  --gutter: 64px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 56px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.72;
  font-weight: 380;
  -webkit-font-smoothing: antialiased;
}

/* Faint paper grit, kept extremely subtle. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(200, 146, 58, 0.3);
  color: var(--ink-strong);
}

a {
  color: var(--ink-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.15s, color 0.15s;
}
a:hover {
  color: #fff;
  border-color: var(--accent);
}

strong { color: var(--ink-strong); font-weight: 600; }
em { color: var(--ink-strong); font-style: italic; }

.mono {
  font-family: var(--mono);
  font-weight: 400;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------- document strip */
.docbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.docbar .shell {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 46px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.docbar a { border: none; color: var(--muted); }
.docbar a:hover { color: var(--ink-strong); }
.docbar-brand { display: inline-flex; align-items: center; }
.docbar-brand img {
  height: 17px;
  width: auto;
  display: block;
  opacity: 0.92;
}
.docbar .sep { color: var(--faint); }
.docbar .right {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}

/* ----------------------------------------------------------- masthead */
.masthead {
  border-bottom: 1px solid var(--line-strong);
  padding: 64px 0 40px;
}
.masthead .wordmark {
  height: clamp(64px, 11vw, 104px);
  width: auto;
  display: block;
  margin: 0 auto 36px;
}
.masthead .class-line {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
}
.masthead .class-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.92;
  font-size: clamp(46px, 9.5vw, 116px);
  color: var(--ink-strong);
  margin: 22px 0 0;
}
.masthead h1 .sub {
  display: block;
  font-weight: 300;
  font-size: clamp(20px, 3.6vw, 40px);
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-top: 2px;
}
.masthead .abstract {
  margin: 26px 0 0;
  max-width: 60ch;
  font-size: 19px;
  color: var(--ink);
}
.masthead .abstract .lead-cap::first-letter { /* no-op hook */ }
.masthead .actions {
  margin-top: 30px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* flat, square, institutional buttons */
.act {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink-strong);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.act:hover {
  border-color: var(--accent);
  background: rgba(200, 146, 58, 0.06);
  color: #fff;
}
.act.solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #15110a;
}
.act.solid:hover {
  background: #d8a14a;
  border-color: #d8a14a;
  color: #15110a;
}

/* --------------------------------------------------------- body layout */
.layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: var(--gutter);
  padding: 56px 0 96px;
  align-items: start;
}

/* table of contents */
.toc {
  position: sticky;
  top: 28px;
}
.toc .toc-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border: none;
  padding: 7px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--faint);
  font-size: 11px;
  flex: none;
}
.toc a:hover { color: var(--ink-strong); }
.toc a.active { color: var(--accent); }
.toc a.active::before { color: var(--accent); }

/* ----------------------------------------------------------- articles */
.body { min-width: 0; }
.body > .article:first-child { padding-top: 0; }

.article {
  padding: 14px 0 46px;
  margin-bottom: 46px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 56px;
}
.article:last-child { border-bottom: none; }

.article-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 22px;
}
.article-head .no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.08em;
  padding-top: 6px;
}
.article-head h2 {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.04;
  color: var(--ink-strong);
  margin: 0;
}

/* text column is offset to align under the title */
.article-body { padding-left: 80px; }
.article-body > * { max-width: var(--measure); }

.article-body p { margin: 0 0 18px; }
.article-body .lede {
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink-strong);
}
.article-body h3 {
  font-family: var(--display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 14px;
  color: var(--accent);
  margin: 34px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  max-width: none;
}

.article-body ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.article-body ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 9px;
}
.article-body ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 13px;
  width: 7px;
  height: 1px;
  background: var(--accent);
}

/* ordered procedure */
ol.procedure {
  list-style: none;
  counter-reset: p;
  margin: 0 0 18px;
  padding: 0;
}
ol.procedure li {
  counter-increment: p;
  position: relative;
  padding: 0 0 16px 46px;
  min-height: 30px;
}
ol.procedure li::before {
  content: counter(p, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
}
ol.procedure li strong { display: block; margin-bottom: 2px; }

/* definition / spec table */
table.specs {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 20px;
  max-width: var(--measure);
}
table.specs th,
table.specs td {
  text-align: left;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.specs th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  width: 38%;
  white-space: nowrap;
}
table.specs td {
  color: var(--ink-strong);
}
table.specs td .em {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.95em;
}

/* reference table (controls, commands) */
.ref {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 20px;
  max-width: var(--measure);
}
.ref table { width: 100%; border-collapse: collapse; }
.ref thead th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-rule);
}
.ref tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  color: var(--ink);
}
.ref tbody tr:last-child td { border-bottom: none; }
.ref tbody td:first-child { color: var(--ink-strong); white-space: nowrap; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 2px 7px;
  background: var(--bg-rule);
  white-space: nowrap;
}

code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: var(--accent);
  background: rgba(200, 146, 58, 0.08);
  padding: 1px 6px;
  border-radius: 2px;
}

/* notice / stamp block */
.notice {
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--danger);
  border-radius: 2px;
  padding: 16px 18px;
  margin: 6px 0 18px;
  max-width: var(--measure);
}
.notice .tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--danger);
  margin-bottom: 6px;
}
.notice.amber { border-left-color: var(--accent); }
.notice.amber .tag { color: var(--accent); }
.notice p { margin: 0; font-size: 16px; }

/* contract field */
.field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  margin: 6px 0 18px;
  max-width: var(--measure);
  overflow: hidden;
}
.field .field-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-rule);
  white-space: nowrap;
}
.field .field-val {
  flex: 1;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-strong);
  padding: 12px 14px;
  word-break: break-all;
  min-width: 0;
}
.field button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-strong);
  background: transparent;
  border: none;
  border-left: 1px solid var(--line);
  padding: 0 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, color 0.15s;
}
.field button:hover { background: rgba(200, 146, 58, 0.1); color: var(--accent); }

/* FAQ as numbered queries */
.queries { max-width: var(--measure); }
.queries details {
  border-top: 1px solid var(--line);
}
.queries details:last-child { border-bottom: 1px solid var(--line); }
.queries summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 28px 16px 0;
  position: relative;
  color: var(--ink-strong);
  font-size: 18px;
}
.queries summary::-webkit-details-marker { display: none; }
.queries summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 14px;
  font-family: var(--mono);
  color: var(--accent);
  font-size: 18px;
}
.queries details[open] summary::after { content: "\2212"; }
.queries details p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}

/* ------------------------------------------------------------- footer */
.foot {
  border-top: 1px solid var(--line-strong);
  padding: 30px 0 60px;
}
.foot .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.foot a { border: none; color: var(--muted); }
.foot a:hover { color: var(--ink-strong); }
.foot .foot-brand { display: inline-flex; align-items: center; gap: 10px; }
.foot .foot-brand img { height: 15px; width: auto; opacity: 0.7; }
.foot .foot-links { display: flex; gap: 18px; }
.foot .disclaimer {
  width: 100%;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 11px;
  color: var(--faint);
  line-height: 1.6;
  max-width: 80ch;
}

/* --------------------------------------------------------- responsive */
@media (max-width: 880px) {
  .shell { padding: 0 24px; }
  .layout {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 36px 0 72px;
  }
  .toc {
    position: static;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 16px 18px;
  }
  .toc ol { columns: 2; column-gap: 24px; }
  .article-body { padding-left: 0; }
  .article-head { grid-template-columns: 1fr; gap: 4px; }
  .article-head .no { padding-top: 0; }
}
@media (max-width: 520px) {
  .docbar .hide-xs { display: none; }
  .toc ol { columns: 1; }
  body { font-size: 17px; }
}
