/* Dead Machines site styles.
   Layout: one centered column with a machine-panel header band; docs pages add a side index on wide screens.
   Dark-first (gunmetal and bone, verdigris accent, rust for warnings and TBD), with a light variant. */

:root {
  color-scheme: dark;
  --bg: #121518;
  --panel: #1a1f23;
  --panel-2: #20262b;
  --line: #2d353b;
  --fg: #dcd8cc;
  --muted: #9ba29f;
  --accent: #74b9a7;
  --accent-ink: #0e1a17;
  --rust: #d07c48;
  --pass: #74b9a7;
  --warn: #d9a441;
  --fail: #d9675a;
  --motion-fast: 140ms;
  --motion: 200ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.8rem, 9vw, 5.2rem);

  --wrap: 72rem;
  --measure: 66ch;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef0ee;
    --panel: #ffffff;
    --panel-2: #f5f7f6;
    --line: #cdd4d2;
    --fg: #1a1f23;
    --muted: #535d5b;
    --accent: #2c7666;
    --accent-ink: #ffffff;
    --rust: #9c4c1f;
    --pass: #2c7666;
    --warn: #8a5f00;
    --fail: #a8352a;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0ee;
  --panel: #ffffff;
  --panel-2: #f5f7f6;
  --line: #cdd4d2;
  --fg: #1a1f23;
  --muted: #535d5b;
  --accent: #2c7666;
  --accent-ink: #ffffff;
  --rust: #9c4c1f;
  --pass: #2c7666;
  --warn: #8a5f00;
  --fail: #a8352a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}

img, svg { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--panel); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 0.9rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.brand svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

/* Type */
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 2.6rem 0 0.6rem;
  scroll-margin-top: 1rem;
}
h3 { font-size: var(--step-1); font-weight: 600; margin: 1.8rem 0 0.4rem; scroll-margin-top: 1rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: var(--measure); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}

/* Main */
main { padding-block: 2.5rem 4rem; }
.prose { max-width: var(--measure); min-width: 0; }

/* TBD and status marks */
.tbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust);
  border: 1px solid var(--rust);
  border-radius: 3px;
  padding: 0 0.35em;
  vertical-align: 0.12em;
  white-space: nowrap;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  background: var(--panel);
  padding: 0.8rem 1rem;
  border-radius: 3px;
  margin: 0 0 1.5rem;
  max-width: var(--measure);
}
.notice p:last-child { margin-bottom: 0; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.btn {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  padding: 0.65rem 1.1rem;
  border-radius: 3px;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn[aria-disabled="true"] { opacity: 0.75; }

/* Home hero */
.hero { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: start; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.1fr 1fr; } }
.hero > * { min-width: 0; }
.hero h1 { font-size: var(--step-4); line-height: 0.95; margin-bottom: 1rem; }

/* Machine panel: the self-test readout */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.readout { list-style: none; margin: 0; padding: 0.4rem 0; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.5; }
.readout li { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0.6rem; padding: 0.45rem 0.9rem; margin: 0; }
.readout li + li { border-top: 1px dashed var(--line); }
.readout .k { display: block; color: var(--fg); }
.readout .m { color: var(--muted); }
.mark { font-weight: 500; }
.mark.pass { color: var(--pass); }
.mark.warn { color: var(--warn); }
.mark.fail { color: var(--fail); }
.mark.skip { color: var(--muted); }
.panel-foot { font-size: 0.78rem; color: var(--muted); padding: 0.55rem 0.9rem; border-top: 1px solid var(--line); }

/* Feature grid */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 1rem 0 2rem; }
.features > div { background: var(--bg); padding: 1.1rem 1.2rem; min-width: 0; }
.features h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.features p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Facts list */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.45rem 1.4rem; margin: 0 0 1.5rem; max-width: var(--measure); }
.facts dt { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding-top: 0.15rem; }
.facts dd { margin: 0; }
@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .facts dd { margin-bottom: 0.7rem; }
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; max-width: var(--measure); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); }
th { font-family: var(--font-mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Docs layout: side index on wide screens */
.docs { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.docs > * { min-width: 0; }
@media (min-width: 980px) {
  .docs { grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; }
  .docs .toc { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}
.toc {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
}
.toc p { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem; }
.toc ol { margin: 0; padding-left: 1.3rem; }
.toc li { margin-bottom: 0.25rem; }
.toc a { color: var(--fg); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Q&A */
.qa details { border-bottom: 1px solid var(--line); padding: 0.2rem 0; }
.qa summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.7rem 0;
  list-style-position: outside;
}
.qa details[open] summary { color: var(--accent); }
.qa details > div { padding: 0 0 0.9rem; }
.qa details > div > :last-child { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 1.5rem; }
.site-footer a { color: var(--muted); }


/* Newsletter sign-up */
.signup { margin-top: 1rem; max-width: 32rem; }
.signup label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.signup-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.signup input[type="email"] { flex: 1 1 14rem; min-width: 0; padding: 0.6rem 0.75rem; font: inherit; color: var(--fg); background: transparent; border: 1px solid currentColor; border-radius: 6px; }
.signup-note { font-size: 0.9em; opacity: 0.8; margin-top: 0.5rem; }

/* L337 Override: the word OVERRIDE in the footer toggles leet speak (js/override.js).
   Styled like the footer's other text so it stays hidden in plain sight. */
.footer-plate { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.9rem; }
.override {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.override[hidden] { display: none; }
.override:hover, .override[aria-pressed="true"] { color: var(--fg); }
/* While overridden, the accent runs rust. The text itself swaps instantly. */
.is-overridden body { --accent: var(--rust); }

/* Motion.
   Standing rule: anything that changes on hover, focus or open/close changes
   with a short transition, never a jump. Keep timings to the variables in
   :root. Reduced-motion settings switch it all off (last block). */
a {
  transition: color var(--motion-fast) var(--ease),
              text-decoration-color var(--motion-fast) var(--ease),
              text-decoration-thickness var(--motion-fast) var(--ease);
}
:focus-visible { transition: outline-offset var(--motion-fast) var(--ease); }
.site-nav a {
  transition: color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.site-nav a:hover { box-shadow: inset 0 -2px 0 var(--line); }
.site-nav a[aria-current="page"]:hover { box-shadow: inset 0 -2px 0 var(--accent); }
.btn {
  transition: background-color var(--motion) var(--ease),
              color var(--motion) var(--ease),
              border-color var(--motion) var(--ease),
              box-shadow var(--motion) var(--ease),
              transform var(--motion-fast) var(--ease);
}
.btn:not([aria-disabled="true"]):hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.btn.primary:not([aria-disabled="true"]):hover { background: color-mix(in srgb, var(--accent) 85%, var(--fg)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn:not([aria-disabled="true"]):active { transform: translateY(1px); }
.btn[aria-disabled="true"] { cursor: not-allowed; }
.toc a, .site-footer a { transition: color var(--motion-fast) var(--ease); }
.site-footer a:hover { color: var(--fg); }
.qa summary { transition: color var(--motion) var(--ease); }
.qa summary:hover { color: var(--accent); }
.qa details[open] > div { animation: dm-reveal var(--motion) var(--ease); }
@keyframes dm-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.signup input[type="email"] {
  transition: border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.signup input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); outline: none; }

.override { transition: color var(--motion-fast) var(--ease); }
.brand svg, .eyebrow { transition: color var(--motion) var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
