/* ==========================================================================
   PLC101.com — industrial console design system
   Jair Vargas · Automation & OT Cybersecurity
   Single stylesheet, no external dependencies. Dark by default, light opt-in.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --bg:            #080b11;
  --bg-grid:       rgba(255, 255, 255, .022);
  --surface:       #10151f;
  --surface-2:     #161d2b;
  --surface-3:     #1e2637;
  --line:          #24304a;
  --line-soft:     #1a2233;

  --text:          #e6edf7;
  --text-dim:      #96a3ba;
  --text-faint:    #63718a;

  --accent:        #22d3ee;   /* cyan — primary / links */
  --accent-2:      #38bdf8;
  --accent-ink:    #04141a;
  --run:           #34e5a5;   /* green — ok / running */
  --warn:          #fbbf24;   /* amber — caution */
  --alarm:         #fb5f6d;   /* red — fault */
  --violet:        #a78bfa;

  --glow:          0 0 0 1px rgba(34, 211, 238, .35), 0 0 26px -6px rgba(34, 211, 238, .55);
  --shadow:        0 18px 40px -22px rgba(0, 0, 0, .95);

  --radius:        14px;
  --radius-sm:     9px;
  --maxw:          1180px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans Arabic",
          "Segoe UI Arabic", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo,
          Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg:            #eef2f8;
  --bg-grid:       rgba(0, 0, 0, .03);
  --surface:       #ffffff;
  --surface-2:     #f5f8fc;
  --surface-3:     #e9eff7;
  --line:          #cfdae9;
  --line-soft:     #e2e9f3;
  --text:          #10192a;
  --text-dim:      #4b5a72;
  --text-faint:    #7286a1;
  --accent:        #0369a1;
  --accent-2:      #0284c7;
  --accent-ink:    #ffffff;
  --run:           #047857;
  --warn:          #a16207;
  --alarm:         #be123c;
  --violet:        #6d28d9;
  --shadow:        0 16px 36px -26px rgba(15, 30, 60, .5);
  --glow:          0 0 0 1px rgba(3, 105, 161, .3), 0 8px 24px -12px rgba(3, 105, 161, .45);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: var(--accent-ink);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { inset-inline-start: 0; }

/* ---------- 3. Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.section { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4.5rem); }
.section--tight { padding-block: clamp(1.6rem, 1rem + 2vw, 2.6rem); }

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.eyebrow {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .7rem;
  display: flex; align-items: center; gap: .6rem;
}
.eyebrow::before {
  content: ""; width: 26px; height: 1px; background: currentColor; opacity: .6; flex: none;
}
.lede { font-size: 1.08rem; color: var(--text-dim); max-width: 62ch; }

/* ---------- 4. Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav {
  display: flex; align-items: center; gap: 10px;
  min-height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-weight: 700; letter-spacing: .04em;
  color: var(--text); text-decoration: none; margin-inline-end: auto; flex: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--violet));
  color: var(--accent-ink); font-size: .72rem; font-weight: 800; letter-spacing: 0;
}
.brand__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--run);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .22);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--run) 22%, transparent);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__link {
  position: relative;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .8rem; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: .93rem; font-weight: 500;
  background: none; border: 0; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.nav__link:hover, .nav__link:focus-visible { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--accent); }
.nav__link[aria-current="page"]::after {
  content: ""; position: absolute; inset-inline: .8rem; bottom: .15rem;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.nav__caret { width: 9px; height: 9px; opacity: .65; transition: transform .18s; }
.has-drop[aria-expanded="true"] .nav__caret { transform: rotate(180deg); }

.drop {
  position: absolute; top: calc(100% + 6px);
  inset-inline-end: 0; inset-inline-start: auto;
  width: min(680px, calc(100vw - 32px));
  max-height: min(74vh, 620px); overflow-y: auto; padding: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: none; z-index: 70;
}
.drop[data-open="true"] { display: block; animation: dropIn .16s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-5px) } }
.nav__item { position: relative; }
.drop__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.drop__group-title {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); padding: .55rem .6rem .3rem; grid-column: 1 / -1;
}
.drop__link {
  display: block; padding: .45rem .6rem; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: .88rem;
}
.drop__link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.drop__link b { display: block; color: var(--text); font-weight: 600; font-size: .9rem; }
.drop__link span { font-size: .78rem; color: var(--text-faint); }
.drop__all {
  grid-column: 1 / -1; position: sticky; bottom: -14px; z-index: 2;
  margin: 8px -14px -14px; padding: 11px 14px;
  background: var(--surface); border-top: 1px solid var(--line-soft);
  text-align: center; font-size: .85rem;
}
@media (max-width: 940px) { .drop__all { position: static; margin: 8px 0 0; } }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-dim); cursor: pointer; font-family: var(--mono); font-size: .78rem;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
/* The legacy tool pages carry a global `svg { width:100%; height:300px }` rule for
   their diagrams. Pin the chrome icons so they cannot inherit it. */
.site-header svg, .site-footer svg, .icon-btn svg, .nav__link svg {
  width: 16px; height: 16px; background: none; border: 0; margin: 0; flex: none;
}
.nav__caret { width: 9px; height: 9px; }

.lang { position: relative; flex: none; }
.lang__btn { gap: .35rem; border: 1px solid var(--line); background: var(--surface); height: 36px; }
.lang__menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 168px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 70;
}
.lang__menu[data-open="true"] { display: block; }
.lang__menu a { display: flex; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text-dim); font-size: .88rem; }
.lang__menu a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.lang__menu a[aria-current="true"] { color: var(--accent); }
.lang__menu code { font-family: var(--mono); font-size: .74rem; color: var(--text-faint); }

.burger { display: none; }

@media (max-width: 940px) {
  .burger { display: inline-grid; }
  .nav__links {
    position: fixed; inset: 62px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 12px 16px 20px; max-height: calc(100vh - 62px); overflow-y: auto;
    box-shadow: var(--shadow);
    display: none;
  }
  .nav__links[data-open="true"] { display: flex; }
  .nav__link { padding: .7rem .6rem; font-size: 1rem; }
  .nav__link[aria-current="page"]::after { display: none; }
  .drop {
    position: static; width: auto; max-height: none; display: none; box-shadow: none;
    background: var(--surface-2); margin: 4px 0 8px;
  }
  .drop__grid { grid-template-columns: 1fr; }
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.25rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .94rem; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { box-shadow: var(--glow); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: .45rem .85rem; font-size: .84rem; }
.btn--block { width: 100%; }

/* ---------- 6. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card--link { display: block; color: inherit; }
.card--link:hover {
  text-decoration: none; transform: translateY(-3px);
  border-color: var(--accent); box-shadow: var(--shadow);
}
.card__tag {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent); display: inline-block; margin-bottom: .55rem;
}
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--text-dim); font-size: .93rem; margin: 0; }
.card__thumb {
  border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
  margin-bottom: 14px; background: var(--surface-3); aspect-ratio: 16 / 10; object-fit: cover; width: 100%;
}
.card__icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line);
  margin-bottom: 14px; font-size: 1.15rem;
}

/* ---------- 7. Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(3rem, 2rem + 5vw, 6rem); }
.hero::before {
  content: ""; position: absolute; inset-inline-start: 50%; top: -30%;
  width: 900px; height: 900px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(34, 211, 238, .16) 0%, transparent 62%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 62%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero__grid { display: grid; gap: 40px; grid-template-columns: 1.25fr .75fr; align-items: center; }
@media (max-width: 880px) { .hero__grid { grid-template-columns: 1fr; } }
.hero h1 .g {
  background: linear-gradient(100deg, var(--accent), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-top: 2.4rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.stat__v { font-family: var(--mono); font-size: 1.45rem; font-weight: 700; color: var(--accent); line-height: 1.15; }
.stat__l { font-size: .78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .09em; }

/* HMI-style panel used in the hero */
.hmi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.hmi__bar {
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: .74rem; color: var(--text-faint); letter-spacing: .08em;
}
.hmi__led { width: 8px; height: 8px; border-radius: 50%; background: var(--run); box-shadow: 0 0 8px var(--run); }
.hmi__body { padding: 16px; display: grid; gap: 10px; }
.hmi__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: .82rem;
}
.hmi__row span:first-child { color: var(--text-dim); }
.hmi__val { color: var(--run); font-weight: 700; }
.hmi__val--warn { color: var(--warn); }
.hmi__val--acc { color: var(--accent); }
.hmi__bars { display: flex; gap: 3px; align-items: flex-end; height: 46px; padding: 0 .3rem; }
.hmi__bars i {
  flex: 1; background: linear-gradient(180deg, var(--accent), transparent);
  border-radius: 2px 2px 0 0; opacity: .8;
  animation: bar 2.4s ease-in-out infinite;
}
@keyframes bar { 0%, 100% { height: 30% } 50% { height: 100% } }

/* ---------- 8. Forms / calculators ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label, .label {
  display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim);
  margin-bottom: .35rem; letter-spacing: .01em;
}
.hint { font-size: .76rem; color: var(--text-faint); margin-top: .3rem; }

/* match on the effective type too: an <input> with no type attribute is a text
   box, and a bare attribute selector would leave it with the browser default */
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], input[type="url"], input:not([type]),
select, textarea {
  width: 100%; padding: .62rem .8rem;
  font-family: var(--mono); font-size: .95rem;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .18);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
                    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-inline-end: 2rem;
}
html[dir="rtl"] select { background-position: left 15px center, left 10px center; }
input[type="range"] { accent-color: var(--accent); padding: 0; background: none; border: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: auto; }

.field { min-width: 0; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; padding: .45rem .7rem; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-family: inherit; font-size: .85rem; font-weight: 600;
  white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* result readout */
.readout {
  background: var(--surface-2); border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 6px;
}
.readout__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); }
.readout__value { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--accent); word-break: break-all; }
.readout--ok { border-inline-start-color: var(--run); }
.readout--ok .readout__value { color: var(--run); }
.readout--warn { border-inline-start-color: var(--warn); }
.readout--warn .readout__value { color: var(--warn); }
.readout--bad { border-inline-start-color: var(--alarm); }
.readout--bad .readout__value { color: var(--alarm); }

/* the value column has to be allowed to shrink and wrap: a long mono value
   like a binary mask otherwise widens the page on a phone */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto);
      gap: 2px 14px; font-family: var(--mono); font-size: .88rem; }
.kv dt { color: var(--text-dim); padding: .3rem 0; border-bottom: 1px dashed var(--line-soft); min-width: 0; overflow-wrap: anywhere; }
.kv dd { margin: 0; padding: .3rem 0; text-align: end; color: var(--text); font-weight: 600;
         border-bottom: 1px dashed var(--line-soft); min-width: 0; overflow-wrap: anywhere; }

.note {
  border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .87rem;
  background: rgba(34, 211, 238, .09);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid rgba(34, 211, 238, .28);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text-dim);
}
.note--warn { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .32); }
.note--warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.note--bad  { background: rgba(244, 63, 94, .10); border-color: rgba(244, 63, 94, .32); }
.note--bad  { background: color-mix(in srgb, var(--alarm) 10%, transparent); border-color: color-mix(in srgb, var(--alarm) 32%, transparent); }
.note strong { color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .85rem; }
table.data th, table.data td { padding: .55rem .8rem; text-align: start; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data th { background: var(--surface-2); color: var(--text-dim); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }

.copy-btn { cursor: pointer; }

/* ---------- 8b. Settings modal ---------- */
.cfg-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-dim); font-family: inherit; font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.cfg-btn:hover { border-color: var(--accent); color: var(--accent); }
.modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 18px; background: rgba(3, 7, 14, .68);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal[data-open="true"] { display: flex; }
.modal__box {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  animation: modalIn .16s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.modal__head h3 { margin: 0; font-size: 1.05rem; }
.modal__close {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex: none;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-dim); font-size: 1rem; cursor: pointer; line-height: 1;
}
.modal__close:hover { color: var(--text); border-color: var(--accent); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cfg-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: 4px; }
.cfg-summary {
  font-size: .78rem; color: var(--text-faint); font-family: var(--mono);
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}

/* ---------- 9. Tool page shell ---------- */
.tool-head { border-bottom: 1px solid var(--line-soft); padding-block: 26px 22px; }
.crumbs { font-family: var(--mono); font-size: .78rem; color: var(--text-faint); margin-bottom: .5rem; }
.crumbs a { color: var(--text-faint); }
.crumbs a:hover { color: var(--accent); }
.tool-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
/* 1fr means minmax(auto,1fr): the track refuses to shrink below its widest
   child, so one long <option> dragged the whole panel off a phone screen */
@media (max-width: 860px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
.panel {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px;
}
.panel__title {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 14px; display: flex; align-items: center; gap: .5rem;
}
.panel__title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* one row per block parameter in the FB builder's pin list */
.pinrow {
  display: flex; align-items: center; gap: 10px;
  padding: .5rem .6rem; margin-bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); cursor: pointer;
}
.pinrow:hover { border-color: var(--line); }
.pinrow__acts { display: flex; gap: 4px; flex: none; }
/* 40px so a thumb hits the button and not the row underneath it */
.pinrow .btn--sm {
  padding: 0; min-width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1;
}
.pinrow .btn--sm.is-armed {
  background: var(--alarm); border-color: var(--alarm); color: #fff;
}
@media (max-width: 480px) {
  .pinrow { flex-wrap: wrap; }
  .pinrow__acts { width: 100%; justify-content: flex-end; }
}

/* search hits inside a table: the browser default yellow burns on a dark page */
mark {
  background: rgba(34, 211, 238, .26);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--text); border-radius: 3px; padding: 0 .15em;
}

/* code the visitor is meant to copy into an editor: never wrap it, scroll it */
pre.code {
  font-family: var(--mono); font-size: .82rem; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 16px;
  color: var(--text-dim); overflow-x: auto; white-space: pre;
  direction: ltr; text-align: left;
}

/* ---------- 10. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft); background: var(--surface);
  padding-block: 40px 26px; margin-top: 40px;
}
.footer__grid { display: grid; gap: 26px; grid-template-columns: 1.4fr 1fr 1fr 1fr; }
@media (max-width: 780px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
.footer__grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); font-family: var(--mono); }
.footer__grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.footer__grid a { color: var(--text-dim); font-size: .9rem; }
.footer__grid a:hover { color: var(--accent); }
.footer__bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  font-size: .82rem; color: var(--text-faint); font-family: var(--mono);
}

/* status strip */
.statusbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem;
  font-family: var(--mono); font-size: .74rem; color: var(--text-faint);
  padding: .5rem 0; border-top: 1px solid var(--line-soft);
}
.statusbar b { color: var(--run); font-weight: 600; }

/* ---------- 11. Utilities ---------- */
.mono { font-family: var(--mono); }
.dim { color: var(--text-dim); }
.center { text-align: center; }
.mt0 { margin-top: 0 } .mt1 { margin-top: .5rem } .mt2 { margin-top: 1rem } .mt3 { margin-top: 1.6rem }
.mb0 { margin-bottom: 0 } .mb2 { margin-bottom: 1rem } .mb3 { margin-bottom: 1.6rem }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: var(--mono); font-size: .76rem; padding: .28rem .6rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-dim);
}
.chip--on { border-color: var(--accent); color: var(--accent); }

/* quick-jump chips on the tools gallery */
.chips--jump { gap: 8px; }
.chip--jump {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .42rem .8rem; font-family: var(--font); font-size: .85rem;
  color: var(--text-dim); text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.chip--jump:hover { text-decoration: none; color: var(--text); border-color: var(--accent); background: var(--surface-3); }
.chip--jump b { font-family: var(--mono); font-size: .74rem; color: var(--text-faint); font-weight: 600; }
.chip--jump.chip--on b { color: var(--accent); }
[data-cat] { scroll-margin-top: 78px; }
@media (max-width: 620px) {
  .chips--jump { gap: 6px; }
  .chip--jump { font-size: .82rem; padding: .4rem .7rem; }
}

@media print {
  .site-header, .site-footer, .btn, .burger { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
