/* Hallmark v2.0.0 · theme: Coral, dealt 1/3 · genre: modern-minimal · shape: app screen · scope: app
 * nav: searchable document index · footer: project record · signature: result structure with roles and section comments
 * material: verified meeting notes and work programme · imagery: none, this product is a working document
 * Cyrillic system typography and flat paper replace decorative stationery for sustained professional reading. */
/* Hallmark · pre-emit critique: P4 H4 E4 S5 R5 V4 · weakest: H, long result names; split navigation from the selected document. */
@import url("./tokens.css");
:root {
  --s4: 4px;
  --s8: 8px;
  --s12: 12px;
  --s16: 16px;
  --s20: 20px;
  --s24: 24px;
  --s28: 28px;
  --s32: 32px;
  --s40: 40px;
  --s48: 48px;
  --s60: 60px;
  --s80: 80px;
  --color-paper: #f6f5f2;
  --color-canvas: #ffffff;
  --color-ink: #252721;
  --color-muted: #62655c;
  --color-rule: #d9dbd2;
  --color-soft: #eeeee8;
  --color-accent: #ab443c;
  --color-focus: #9f3730;
  --color-inverse: #ffffff;
  --color-error: #a3332a;
  --color-error-paper: #faf0ee;
  --font-body: Arial, "Segoe UI", sans-serif;
  --font-display: var(--font-body);
  --font-label: var(--font-body);
  --container: 1440px;
  --radius: 8px;
  --space: 8px;
  --gutter: clamp(20px, 3.5vw, 56px);
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { background: var(--color-paper); color: var(--color-ink); font: 16px/1.55 var(--font-body); }
body { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--color-ink); line-height: 1.2; font-weight: 600; overflow-wrap: break-word; min-width: 0; }
h1 { text-wrap: balance; font-size: clamp(28px, 2.8vw, 40px); letter-spacing: -.025em; margin: 0 0 var(--s24); }
h2 { font-size: 24px; margin: var(--s32) 0 var(--s16); }
h3 { font-size: 19px; margin: 0 0 var(--s12); }
p { margin: 0 0 var(--s16); }
ul { padding-left: var(--s24); margin: var(--s12) 0 var(--s20); }
li { margin-bottom: var(--s8); }
a { color: var(--color-ink); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--color-accent); }
button, input, textarea, select { font: inherit; }
input, textarea, select { color: var(--color-ink); background: var(--color-canvas); border: 1px solid var(--color-muted); border-radius: 6px; padding: var(--s12) var(--s12); width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 100px; }
input::placeholder, textarea::placeholder { color: var(--color-muted); opacity: 1; }
label { display: block; font-size: 15px; font-weight: 500; }
label > input, label > textarea, label > select { display: block; margin-top: var(--s8); }
.field > input, .field > textarea, .field > select { margin-top: var(--s8); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
main:focus-visible { outline-offset: -4px; }
[hidden] { display: none !important; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: var(--s8) var(--s16); border: 1px solid var(--color-ink); border-radius: var(--radius); color: var(--color-ink); background: transparent; font-weight: 500; text-decoration: none; cursor: pointer; transition: background-color 140ms, transform 100ms; }
.button:hover { background: var(--color-soft); color: var(--color-ink); }
.button.primary { background: var(--color-ink); color: var(--color-inverse); }
.button.primary:hover { background: var(--color-muted); }
.button:active { transform: translateY(1px); }
.button:disabled { background: var(--color-soft); color: var(--color-muted); border-color: var(--color-rule); cursor: wait; transform: none; }
.button.quiet { border-color: var(--color-rule); }
.text-button { appearance: none; background: transparent; border: 0; padding: var(--s8) 0; color: var(--color-ink); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-button:hover { color: var(--color-accent); }
.skip-link { position: fixed; left: 16px; top: 12px; transform: translateY(-200%); background: var(--color-canvas); padding: var(--s8) var(--s12); z-index: 10; }
.skip-link:focus { transform: none; }
.topbar { max-width: var(--container); margin: auto; padding: var(--s24) var(--gutter); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s12) var(--s24); }
.brand { font-weight: 600; font-size: 22px; text-decoration: none; letter-spacing: -.02em; }
.workspace-name { color: var(--color-muted); font-size: 15px; }
.top-actions { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: var(--s8) var(--s16); }
.top-actions form { margin: 0; }
.top-actions .button { font-size: 14px; min-height: 44px; }
.workspace { max-width: var(--container); margin: 0 auto; padding: var(--s16) var(--gutter) var(--s60); display: grid; grid-template-columns: 286px minmax(0, 1fr); gap: var(--s32); align-items: start; }
.sidebar { min-width: 0; position: sticky; top: 20px; max-height: calc(100dvh - 40px); overflow-y: auto; scrollbar-gutter: stable; padding-right: var(--s12); }
.nav-collapse > summary { display: none; }
.search-form { margin: 0 0 var(--s24); }
.search-form label { font-size: 14px; color: var(--color-muted); margin-bottom: var(--s8); }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s8); }
.search-row input { font-size: 14px; padding: var(--s8) var(--s8); }
.search-row .button { font-size: 14px; padding: var(--s8) var(--s8); }
.stage-nav { display: flex; flex-direction: column; gap: var(--s4); padding-bottom: var(--s24); border-bottom: 1px solid var(--color-rule); }
.stage-nav a { padding: var(--s8) var(--s8); font-size: 14px; text-decoration: none; border-radius: 6px; }
.stage-nav a:hover, .stage-nav a[aria-current] { background: var(--color-soft); color: var(--color-ink); }
.result-nav h2 { font-size: 14px; color: var(--color-muted); line-height: 1.4; margin: var(--s24) var(--s8) var(--s8); }
.result-nav a { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: var(--s8); padding: var(--s8) var(--s8); margin: 0 0; border-radius: 6px; font-size: 14px; line-height: 1.45; text-decoration: none; }
.result-code { color: var(--color-muted); font-variant-numeric: tabular-nums; }
.result-nav a[aria-current] { background: var(--color-ink); color: var(--color-inverse); }
.result-nav a[aria-current] .result-code { color: var(--color-inverse); }
.result-nav a:hover:not([aria-current]) { background: var(--color-soft); color: var(--color-ink); }
.comment-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.document { min-width: 0; background: var(--color-canvas); border: 1px solid var(--color-rule); border-radius: var(--radius); padding: clamp(var(--s24), 3vw, var(--s48)); }
.lead { font-size: 18px; line-height: 1.55; }
.meta-row { display: flex; flex-wrap: wrap; gap: var(--s8) var(--s24); color: var(--color-muted); font-size: 13px; margin: var(--s24) 0 var(--s24); }
.overview-steps { margin-top: var(--s32); }
.stage-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--s20); padding: var(--s20) 0 var(--s8); border-top: 1px solid var(--color-rule); }
.stage-row h3 { font-size: 18px; }
.stage-row p { font-size: 15px; }
.stage-row .muted { font-size: 14px; }
.document-tabs { display: flex; flex-wrap: wrap; gap: var(--s8) var(--s24); margin: var(--s24) 0; padding: 0 0 var(--s16); border-bottom: 1px solid var(--color-rule); }
.document-tabs a { text-decoration: none; padding: var(--s8) 0; font-size: 15px; }
.document-tabs a[aria-current] { font-weight: 600; color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 2px; }
.content-section { padding: var(--s20) 0; border-bottom: 1px solid var(--color-rule); }
.content-section summary { cursor: pointer; font-size: 18px; font-weight: 500; line-height: 1.4; padding-right: var(--s8); }
.content-section[open] summary { margin-bottom: var(--s16); }
.content-section > p, .content-section > ul { margin-top: var(--s16); }
.example { color: var(--color-muted); font-size: 15px; }
.example strong { font-weight: 500; color: var(--color-ink); }
.roles-section h2 { font-size: 21px; margin-top: var(--s28); }
.dependency-list, .sources ul { font-size: 14px; }
.sources { margin: var(--s32) 0 var(--s16); }
.sources h2 { font-size: 20px; }
.document-footer { margin-top: var(--s40); border-top: 1px solid var(--color-rule); padding-top: var(--s24); color: var(--color-muted); }
.document-footer p { margin: 0 0 var(--s4); }
.small { font-size: 13px; }
.muted { color: var(--color-muted); }
.discussion { padding-top: var(--s12); scroll-margin-top: 16px; }
.discussion h2 { font-size: 24px; }
.empty-state { color: var(--color-muted); padding: var(--s12) 0; }
.comment { padding: var(--s16) 0; border-bottom: 1px solid var(--color-rule); }
.comment-meta { display: flex; flex-wrap: wrap; gap: var(--s8) var(--s16); align-items: baseline; font-size: 13px; margin-bottom: var(--s8); }
.comment-meta strong { font-size: 16px; }
.comment-meta time { color: var(--color-muted); }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.resolved .comment-body { color: var(--color-muted); }
.comment-form { margin-top: var(--s28); padding-top: var(--s24); }
.stack { display: flex; flex-direction: column; gap: var(--s20); }
.stack > p { margin: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s20); }
.submit-status { font-size: 14px; color: var(--color-muted); }
.submit-status:empty { display: none; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: var(--s32); }
.login-panel { max-width: 480px; width: 100%; padding: var(--s40); background: var(--color-canvas); border: 1px solid var(--color-rule); border-radius: var(--radius); }
.login-panel h1 { font-size: 32px; }
.login-panel > p { color: var(--color-muted); margin-bottom: var(--s28); }
.error { color: var(--color-error); background: var(--color-error-paper); padding: var(--s12); }
.editor { max-width: 900px; padding: var(--s40) var(--gutter) var(--s80); margin: var(--s20) auto; }
.editor > a { display: inline-block; margin-bottom: var(--s24); }
.editor .stack > h2 { margin-bottom: 0; }
.edit-section { padding: var(--s24); margin: 0; border: 1px solid var(--color-rule); border-radius: var(--radius); display: flex; flex-direction: column; gap: var(--s16); background: var(--color-canvas); }
.edit-section legend { padding: 0 var(--s8); font-weight: 600; }
.editor-actions { display: flex; flex-wrap: wrap; gap: var(--s16); }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr); gap: var(--s24); }
  .stage-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .topbar { gap: var(--s12) var(--s20); }
}
@media (max-width: 800px) {
  .workspace { display: block; padding-top: var(--s8); }
  .sidebar { position: static; max-height: none; padding: 0; overflow: visible; margin-bottom: var(--s16); }
  .nav-collapse > summary { display: list-item; padding: var(--s12) 0; cursor: pointer; font-weight: 500; }
  .result-nav { max-height: 320px; overflow-y: auto; padding-bottom: var(--s16); }
  .search-form { margin-top: var(--s8); }
  .topbar { padding-top: var(--s20); padding-bottom: var(--s16); }
  .workspace-name { display: none; }
  .top-actions { width: 100%; margin-left: 0; gap: var(--s8); }
  .top-actions .button { padding: var(--s8) var(--s12); font-size: 13px; }
  .top-actions form { margin-left: auto; }
  .document { padding: var(--s24) var(--s20); }
  .document-tabs { gap: var(--s4) var(--s16); }
  .document-tabs a { font-size: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .login-panel { padding: var(--s24); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .document-tabs, .comment-form, .document-footer, .skip-link { display: none; }
  html, body { background: var(--color-canvas); }
  .workspace, .document { display: block; padding: 0; margin: 0; border: 0; }
  a { text-decoration: none; }
  h1, h2, h3, summary { break-after: avoid; }
}

html { scrollbar-color: var(--color-rule) var(--color-paper); }
::selection { background: var(--color-accent); color: var(--color-inverse); }
