/* ============================================================
   FUCKTOORIO — Anti-Factory Engineering Hub
   Industrial operator console stylesheet
   Self-contained. No external assets, fonts or CDNs.
   ============================================================ */

:root {
  --bg: #1a1b1e;
  --bg-2: #202125;
  --bg-3: #26272c;
  --panel: #232428;
  --panel-2: #2b2c31;
  --border: #3a3b41;
  --border-strong: #4c4d54;
  --accent: #e58e26;
  --accent-dim: #b46e1a;
  --accent-soft: rgba(229, 142, 38, 0.14);
  --warn: #e5c526;
  --danger: #d04a3a;
  --ok: #7cb342;
  --info: #4d9de0;
  --text: #d8d9dc;
  --muted: #9a9b9f;
  --dim: #6f7075;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "Fira Mono",
          Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(229, 142, 38, 0.06), transparent 40%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ---------- Hazard tape ---------- */
.hazard {
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 12px,
    #141414 12px 24px
  );
  border-bottom: 1px solid #000;
}

/* ---------- Top masthead ---------- */
.masthead {
  border-bottom: 2px solid var(--border);
  background: linear-gradient(180deg, #1f2023 0%, #1a1b1e 100%);
}

.masthead .bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand .mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 2px solid var(--accent);
  background: var(--bg);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -1px;
}

.brand h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.brand h1 span {
  color: var(--accent);
}

.brand .tagline {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.acronym {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.4px;
}

.acronym b {
  color: var(--accent-dim);
  font-weight: 600;
}

/* ---------- Nav ---------- */
nav.site-nav {
  border-bottom: 1px solid var(--border);
  background: #1d1e21;
  position: sticky;
  top: 0;
  z-index: 50;
}

nav.site-nav .inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 0 20px;
  overflow-x: auto;
}

nav.site-nav a {
  display: inline-block;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

nav.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

nav.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Layout ---------- */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

section {
  margin-bottom: 34px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.section-head h2::before {
  content: "// ";
  color: var(--accent);
}

.section-head .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

/* ---------- Panels & cards ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
}

.panel + .panel {
  margin-top: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 14px 16px;
}

.stat .label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.stat .value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.stat .value small {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.stat .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}

.btn:hover {
  background: var(--accent);
  color: #141414;
}

.btn.solid {
  background: var(--accent);
  color: #141414;
  font-weight: 700;
}

.btn.solid:hover {
  background: #f59b2f;
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}

table.data th {
  background: var(--bg-3);
  color: var(--accent);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 10.5px;
  padding: 9px 12px;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

table.data td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

table.data tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

table.data tbody tr:hover {
  background: var(--accent-soft);
}

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.danger { color: var(--danger); border-color: var(--danger); }
.badge.accent { color: var(--accent); border-color: var(--accent); }

/* ---------- Forms ---------- */
label.field {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 9px 10px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* ---------- Calculator output ---------- */
.calc-readout {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px;
  font-family: var(--mono);
}

.calc-readout .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}

.calc-readout .line:last-child {
  border-bottom: none;
}

.calc-readout .key {
  color: var(--muted);
  font-size: 12px;
}

.calc-readout .val {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  text-align: right;
}

.calc-readout .val.alert {
  color: var(--danger);
}

/* ---------- Blueprint cards ---------- */
.bp-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bp-card .bp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.bp-card h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--text);
}

.bp-card .bp-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.bp-card .bp-string {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  padding: 10px;
  word-break: break-all;
  max-height: 96px;
  overflow: hidden;
  position: relative;
}

.bp-card .bp-string::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg));
}

.bp-card .bp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.filter-bar .chip {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
}

.filter-bar .chip.active {
  color: #141414;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Charts ---------- */
.chart-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px;
}

.chart-box svg, .chart-box canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Article ---------- */
article.longread {
  max-width: 820px;
}

article.longread h3 {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 28px;
  color: var(--accent);
}

article.longread p {
  color: var(--text);
  font-size: 15px;
}

article.longread .lede {
  font-size: 17px;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  font-style: italic;
}

blockquote.note {
  border: 1px dashed var(--accent-dim);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  border-radius: 3px;
}

/* ---------- Log / terminal ---------- */
.term {
  background: #141517;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 14px;
  color: var(--muted);
  overflow-x: auto;
}

.term .t-accent { color: var(--accent); }
.term .t-danger { color: var(--danger); }
.term .t-ok { color: var(--ok); }

/* ---------- Footer ---------- */
footer.site {
  border-top: 2px solid var(--border);
  background: #1d1e21;
  margin-top: 40px;
}

footer.site .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

footer.site .inner b {
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Status strip ---------- */
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 14px;
}

.status-strip .led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.led.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.led.warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.led.danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
