/* ShopFloorOps: light by default, dark on toggle */
:root,
:root[data-theme="light"] {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --band: #E9EDF2;
  --line: #D7DDE5;
  --line2: #CBD3DD;
  --chipline: #9AA9BB;
  --text: #0D1B2A;
  --text2: #3F5068;
  --muted: #5B6B7F;
  --ink: #6E5C2A;
  --grid: rgba(13, 27, 42, 0.06);
  --panel: #F1F4F8;
}
:root[data-theme="dark"] {
  --bg: #0D1B2A;
  --surface: #112238;
  --band: #0A1622;
  --line: #22384F;
  --line2: #2A4160;
  --chipline: #3A557A;
  --text: #E8EDF3;
  --text2: #B8C6D6;
  --muted: #8DA0B5;
  --ink: #C9A84C;
  --grid: rgba(201, 168, 76, 0.07);
  --panel: #0B1828;
}
:root {
  --gold: #C9A84C;
  --navy: #0D1B2A;
  --navy2: #10223A;
  --navy3: #0B1828;
  --navyline: #2A4160;
  --ok: #4ADE9B;
  --warn: #F2C14E;
  --bad: #F28B6E;
  --display: 'Bricolage Grotesque', 'Arial Narrow', Arial, sans-serif;
  --body: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
}
img, svg { max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
}
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 50; background: var(--gold); color: var(--navy); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 900px) { .wrap { padding: 0 48px; } }
.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 14px;
}

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.hrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--gold); display: grid; place-items: center; flex: none; }
.brand span b { color: var(--ink); font-weight: 800; }
.nav { display: none; align-items: center; gap: 28px; font-weight: 500; font-size: 15px; color: var(--text2); }
.nav a { text-decoration: none; padding: 6px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.actions { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--chipline); border-radius: 10px;
  background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer;
}
:root[data-theme="light"] .i-sun, :root:not([data-theme]) .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: none; }
.menu { position: relative; }
.menu summary { list-style: none; width: 44px; height: 44px; border: 1px solid var(--chipline); border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; right: 0; top: 54px; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 18px 40px rgba(13, 27, 42, 0.18); display: flex; flex-direction: column; }
.menu nav a { text-decoration: none; padding: 12px 14px; border-radius: 8px; font-weight: 500; }
.menu nav a:hover { background: var(--band); }
.btn.hstart { display: none; }
@media (min-width: 980px) {
  .nav { display: flex; }
  .menu { display: none; }
  .btn.hstart { display: inline-flex; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 12px;
  font: 600 16px/1 var(--body); text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
}
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #D6B65C; }
.btn-line { border-color: var(--chipline); color: var(--text); background: transparent; }
.btn-line:hover { border-color: var(--gold); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }

/* Ticker */
.ticker { border-bottom: 1px solid var(--line); background: var(--band); overflow: hidden; }
.ticker p { margin: 0; padding: 11px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 500 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ticker i { font-style: normal; color: var(--ink); padding: 0 14px; }

/* Hero */
.hero {
  padding: 64px 0 72px;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
}
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 1040px) { .hero { padding: 96px 0; } .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 64px; } }
.hero h1 { font-size: clamp(46px, 7vw, 90px); line-height: 0.98; letter-spacing: -0.035em; margin-bottom: 26px; }
.hero h1 em { font-style: normal; color: var(--ink); }
.hero .lede { font-size: 20px; line-height: 1.55; color: var(--text2); max-width: 34em; margin-bottom: 34px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 14px; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 40px; font: 500 12px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0; list-style: none; }
.hero .facts li { display: inline-flex; align-items: center; gap: 8px; }
.hero .facts li::before { content: ""; width: 6px; height: 6px; background: var(--gold); }

/* Router card: navy in both themes */
.router { background: var(--navy2); color: #E8EDF3; border: 1px solid var(--navyline); border-radius: 18px; overflow: hidden; box-shadow: 0 34px 80px rgba(13, 27, 42, 0.28); }
.router-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; background: var(--navy3); border-bottom: 1px solid #22384F; font: 500 12px/1.4 var(--mono); letter-spacing: 0.12em; }
.router-top span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.router-top span:first-child::before { content: ""; width: 9px; height: 9px; background: var(--gold); }
.router-top span:last-child { color: #8DA0B5; }
.router-body { padding: 24px 22px; display: flex; flex-direction: column; gap: 20px; }
.router h2 { font-size: 30px; font-weight: 700; color: #E8EDF3; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .chips { gap: 10px; } }
.chip {
  display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 54px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  background: var(--navy3); color: #E8EDF3; border: 1px solid var(--navyline);
  font: 500 15px/1.25 var(--body);
}
.chip span { font: 600 12px/1 var(--mono); color: #8DA0B5; }
.chip[aria-pressed="true"] { border-color: var(--gold); background: #1B2F4A; }
.chip[aria-pressed="true"] span { color: var(--gold); }
.rpanel { border-top: 1px dashed var(--navyline); padding-top: 18px; }
.js .rpanel[hidden] { display: none; }
.rlabel { font: 500 11px/1.4 var(--mono); letter-spacing: 0.14em; color: #8DA0B5; margin: 0 0 6px; text-transform: uppercase; }
.rpanel h3 { font: 600 13px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
.rfirst { font-size: 18px; line-height: 1.4; margin: 0 0 14px; color: #E8EDF3; }
.rpath { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 500 12px/1.3 var(--mono); }
.rpath li { border: 1px solid #3A557A; border-radius: 6px; padding: 6px 10px; color: #E8EDF3; }
.rpath li:first-child { border-color: var(--gold); }
.rpath li + li::before { content: none; }
.router .btn { width: 100%; }
.js .router-static-note { display: none; }

/* Sections */
.sec { padding: 80px 0; border-top: 1px solid var(--line); }
.sec.band { background: var(--band); }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 40px; }
.sec-head h2 { font-size: clamp(36px, 5vw, 56px); line-height: 1; }
.sec-head p { max-width: 26em; margin: 0; color: var(--text2); }

.tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 12px; padding: 26px; min-height: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.tile:hover { border-color: var(--gold); }
.tile .n { font: 600 14px/1 var(--mono); letter-spacing: 0.1em; color: var(--ink); }
.tile h3 { font-size: 27px; font-weight: 700; line-height: 1.1; }
.tile p { color: var(--text2); margin: 0; flex: 1; }
.tile .tools { font: 500 12px/1.5 var(--mono); letter-spacing: 0.08em; color: var(--muted); padding-top: 12px; border-top: 1px dashed var(--line2); text-transform: uppercase; }

.chain { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); counter-reset: step; }
.chain li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px; counter-increment: step; }
.chain li::before { content: counter(step, decimal-leading-zero); display: block; font: 600 12px/1 var(--mono); letter-spacing: 0.1em; color: var(--ink); margin-bottom: 10px; }
.chain b { display: block; font-weight: 600; line-height: 1.25; }
.chain small { color: var(--muted); font-size: 14px; }

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.card .kind { font: 500 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); margin: 0; }
.card h3 { font-size: 25px; font-weight: 700; line-height: 1.12; }
.card p { color: var(--text2); margin: 0; }
.card .foot { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }

.press { background: #ECE7DB; color: #1B1A17; padding: 72px 0; }
.press .mast { border-top: 4px double #1B1A17; border-bottom: 1px solid #1B1A17; padding: 18px 0; text-align: center; }
.press .mast h2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 900; font-size: clamp(34px, 6vw, 72px); text-transform: uppercase; letter-spacing: 0.02em; }
.press .mast p { margin: 10px 0 0; font: 500 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #4A463D; }
.press-row { display: grid; gap: 32px; margin-top: 36px; align-items: center; }
@media (min-width: 900px) { .press-row { grid-template-columns: 1.3fr 1fr; gap: 56px; } }
.press-row p { font-size: 18px; color: #3A372F; margin: 0; }
.press-box { background: var(--navy); color: #E8EDF3; border-radius: 16px; padding: 26px; }
.press-box h3 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.press-box p { color: #B8C6D6; font-size: 15px; margin-bottom: 18px; }

/* Footer: navy in both themes */
.site-footer { background: #08121C; color: #E8EDF3; padding: 56px 0 32px; }
.fgrid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px; }
.fbrand { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; margin-bottom: 10px; }
.fbrand b { color: var(--gold); }
.site-footer p { color: #B8C6D6; max-width: 26em; }
.fcols { display: flex; flex-wrap: wrap; gap: 48px; }
.fcols h2 { font: 500 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.fcols ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fcols a { color: #B8C6D6; text-decoration: none; }
.fcols a:hover { color: #FFFFFF; text-decoration: underline; }
.fbase { margin-top: 44px; padding-top: 18px; border-top: 1px solid #22384F; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; color: #8DA0B5; }

/* Inner pages */
.page-head { padding: 48px 0 36px; border-bottom: 1px solid var(--line); background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 48px 48px; }
.crumbs { font: 500 13px/1.4 var(--mono); color: var(--muted); margin-bottom: 18px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--chipline); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head h1 { font-size: clamp(38px, 5.6vw, 64px); max-width: 16em; margin-bottom: 16px; }
.page-head .sub { font-size: 19px; color: var(--text2); max-width: 38em; margin: 0; }
.byline { margin-top: 18px; font-size: 14px; color: var(--muted); }
.byline a { color: var(--text2); }

.article { max-width: 760px; padding: 48px 0 80px; }
.article h2 { font-size: 32px; font-weight: 700; margin: 48px 0 16px; }
.article h3 { font-size: 22px; font-weight: 700; margin: 28px 0 10px; letter-spacing: -0.015em; }
.article p, .article li { color: var(--text2); }
.article strong { color: var(--text); }
.article a { color: var(--text); text-decoration-color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.answer { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; padding: 20px 22px; margin: 0 0 32px; }
.answer p { color: var(--text); font-size: 18px; margin: 0; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.steps > li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 18px 64px; position: relative; }
.steps > li::before { content: counter(s); position: absolute; left: 18px; top: 16px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center; font: 600 13px/1 var(--mono); color: var(--ink); }
.steps h3 { margin: 0 0 6px; font-size: 20px; }
.steps p { margin: 0; }
.tbl { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; }
.tbl table { border-collapse: collapse; width: 100%; min-width: 560px; background: var(--surface); }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.tbl th { font: 600 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); background: var(--band); }
.tbl td { color: var(--text2); }
.tbl tr:last-child td { border-bottom: 0; }
.faq h3 { margin-top: 24px; }
.next { margin-top: 48px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.next h2 { margin: 0 0 12px; font-size: 24px; }
.next ul { margin: 0; padding-left: 20px; }
.note { font-size: 14px; color: var(--muted); }

.grid-list { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); padding: 48px 0 80px; }

/* PFMEA to Control Plan check */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 0 0 24px; }
.tool .rows { display: flex; flex-direction: column; gap: 12px; }
.trow { display: grid; gap: 10px; grid-template-columns: 1fr; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
@media (min-width: 760px) { .trow { grid-template-columns: 2fr 0.7fr 0.7fr 2fr 44px; align-items: end; } }
.trow label { display: flex; flex-direction: column; gap: 4px; font: 500 12px/1.3 var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.trow input { min-height: 44px; border: 1px solid var(--line2); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--text); font: 400 15px var(--body); width: 100%; }
.trow .del { width: 44px; height: 44px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--text2); cursor: pointer; font-size: 20px; }
.tool .bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.results { margin-top: 20px; }
.results:empty { display: none; }
.rsum { font-weight: 600; color: var(--text); margin: 0 0 12px; }
.ritem { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.ritem p { margin: 0; color: var(--text2); font-size: 15px; }
.ritem b { color: var(--text); display: block; }
.tag { font: 600 11px/1 var(--mono); letter-spacing: 0.06em; border-radius: 5px; padding: 5px 8px; white-space: nowrap; color: #0D1B2A; }
.tag.ok { background: var(--ok); }
.tag.warn { background: var(--warn); }
.tag.bad { background: var(--bad); }
.tag.na { background: var(--line2); }

.dl { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 28px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .site-header, .ticker, .site-footer, .router, .toggle { display: none !important; } body { background: #fff; color: #000; } }

/* Small phones: keep logo, toggle and menu on one row */
@media (max-width: 440px) {
  .hrow { gap: 8px; }
  .brand { font-size: 19px; gap: 8px; min-width: 0; }
  .brand .mark { width: 30px; height: 30px; }
  .actions { gap: 8px; }
  .menu nav { right: 0; max-width: calc(100vw - 32px); }
}
