/* LOTO Procedure — the visual language of safety signage (ANSI Z535 colors), kept quiet
   everywhere except the DANGER tag. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #f4f6f8;       /* brushed steel white */
  --panel: #ffffff;
  --ink: #14213d;         /* navy ink */
  --ink-soft: #3d4a63;
  --steel: #7d8898;
  --line: #d6dce4;
  --danger: #c8102e;      /* ANSI safety red */
  --signal: #ffc72c;      /* ANSI safety yellow */
  --signal-deep: #e0a800;
  --ok: #1b7f4c;
  --radius-s: 4px;
  --radius-m: 8px;
  --measure: 68ch;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* flex/grid rules must not override the hidden attribute */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.55 "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-stretch: 100%;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--danger); }
:focus-visible { outline: 3px solid var(--signal-deep); outline-offset: 2px; }
h1, h2, h3 { font-stretch: 112%; line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 800; margin: 0 0 .5em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 750; margin: 1.8em 0 .5em; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 1.4em 0 .4em; }
p, li { max-width: var(--measure); }
.muted { color: var(--steel); }
.small { font-size: .85rem; }
.lead { font-size: 1.2rem; color: var(--ink-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5em; padding: .8em 1.3em;
  background: var(--signal); color: var(--ink); border: 2px solid var(--ink);
  border-radius: var(--radius-s); font: inherit; font-weight: 700; font-stretch: 105%;
  text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn-quiet { background: var(--panel); box-shadow: none; border-width: 1.5px; }
.btn-quiet:hover { box-shadow: none; transform: none; background: var(--paper); }
.btn-small { padding: .45em .9em; font-size: .9rem; box-shadow: 2px 2px 0 var(--ink); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; }

/* Header and footer */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: var(--panel); }
.site-head nav { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.site-head nav a:not(.btn) { text-decoration: none; font-weight: 600; color: var(--ink-soft); }
.site-head nav a:not(.btn):hover { color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-stretch: 118%;
  text-decoration: none; font-size: 1.1rem; margin: 0; }
.brand-mark { width: 22px; height: 26px; border: 3px solid var(--ink); border-radius: 11px 11px 3px 3px;
  position: relative; display: inline-block; }
.brand-mark::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: -3px; height: 14px;
  background: var(--danger); border-radius: 3px; }
.site-foot { margin-top: 5rem; padding: 2.5rem clamp(1rem, 4vw, 3rem); background: var(--ink); color: #dfe5ee;
  display: grid; gap: 1.5rem; grid-template-columns: 1fr auto; }
.site-foot .brand, .site-foot a { color: #fff; }
.site-foot .brand-mark { border-color: #fff; }
.site-foot .muted { color: #a9b4c4; }
.foot-links { display: flex; flex-direction: column; gap: .4rem; }
.site-foot .small { grid-column: 1 / -1; }
@media (max-width: 700px) { .site-foot { grid-template-columns: 1fr; } }

main { padding: 0 clamp(1rem, 4vw, 3rem); }

/* Hero with the live DANGER tag */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem);
  align-items: center; padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem); max-width: 1180px; margin: 0 auto; }
.hero p.lead { margin-bottom: 1.6rem; }
.hero-proof { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 1.4rem; padding: 0; list-style: none;
  color: var(--ink-soft); font-size: .95rem; }
.hero-proof li::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .5em;
  background: var(--ok); border-radius: 50%; vertical-align: .1em; }
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-tag { justify-self: center; width: min(300px, 72vw); }
  .hero-tag .tag { transform: rotate(-2.5deg); }
}
main { overflow-x: clip; }   /* the rotated tag must never cause a sideways scroll */

.hero-tag { position: relative; justify-self: end; width: min(320px, 78vw); }
.hero-tag .shackle { width: 92px; height: 86px; margin: 0 auto -26px; border: 14px solid #9aa4b2;
  border-bottom: 0; border-radius: 46px 46px 0 0; position: relative; z-index: 1; }
.hero-tag .lock { width: 128px; height: 104px; margin: 0 auto; background: var(--danger); border-radius: 12px;
  position: relative; z-index: 2; box-shadow: inset 0 -8px 0 rgba(0,0,0,.15); }
.hero-tag .lock::after { content: ""; position: absolute; left: 50%; top: 38px; width: 16px; height: 26px;
  margin-left: -8px; background: #6a0817; border-radius: 8px 8px 3px 3px; }
.hero-tag .tag { transform: rotate(-4deg); transform-origin: top center; margin-top: -10px; }

/* The DANGER tag: used in the hero and in printed tags */
.tag { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 0 0 1rem; text-align: center;
  font-stretch: 100%; overflow: hidden; position: relative; }
.tag-hole { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); margin: .7rem auto .5rem;
  background: var(--paper); }
.tag-danger { background: var(--danger); color: #fff; font-weight: 900; font-stretch: 125%; font-size: 1.9rem;
  letter-spacing: .06em; padding: .25rem 0; border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.tag-title { font-weight: 900; font-stretch: 85%; font-size: 1.6rem; margin: .6rem .8rem .2rem; line-height: 1.05; }
.tag p { font-size: .8rem; margin: .3rem auto .6rem; padding: 0 1rem; color: var(--ink-soft); }
.tag dl { text-align: left; margin: 0 1rem; font-size: .8rem; }
.tag dt { font-weight: 700; margin-top: .45rem; }
.tag dd { margin: .1rem 0 0; min-height: 1.3em; border-bottom: 1px solid var(--ink); }
.tag dd.live { border-bottom: 0; font-weight: 700; font-size: 1rem; color: var(--ink); }

/* Sections */
.band { max-width: 1180px; margin: 0 auto; padding: 2.5rem 0; }
.band > h2:first-child { margin-top: 0; }

/* Builder: a real three-step sequence */
.builder { background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-m);
  padding: clamp(1.2rem, 3vw, 2.2rem); box-shadow: 6px 6px 0 var(--ink); }
.step { border-top: 1px solid var(--line); padding-top: 1.4rem; margin-top: 1.4rem; }
.step:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.step-head { display: flex; gap: .9rem; align-items: baseline; }
.step-num { flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .95rem; transform: translateY(.15rem); }
.step-head h2 { margin: 0 0 .3rem; font-size: 1.35rem; }
.step-head p { margin: 0; color: var(--steel); }

.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; margin-top: 1rem; }
.machine-option, .machine-card { text-align: left; padding: .85rem 1rem; border: 1.5px solid var(--line);
  border-radius: var(--radius-m); background: var(--panel); cursor: pointer; font: inherit; color: var(--ink);
  display: flex; flex-direction: column; gap: .3rem; text-decoration: none; }
.machine-option:hover, .machine-card:hover { border-color: var(--ink); }
.machine-option[aria-pressed="true"] { border-color: var(--ink); background: #fffbea;
  box-shadow: inset 0 0 0 1.5px var(--ink); }
.machine-option strong, .machine-card strong { font-stretch: 108%; }
.machine-option span, .machine-card span { font-size: .85rem; color: var(--steel); }
.energies { display: flex; flex-wrap: wrap; gap: .3rem; }
.energy { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12em .5em; border-radius: 3px;
  border: 1px solid currentColor; white-space: nowrap; }
.energy-electrical { color: #1f4fa3; } .energy-pneumatic { color: #0f7280; } .energy-hydraulic { color: #5b3fa0; }
.energy-gas { color: #b8410e; } .energy-thermal { color: var(--danger); } .energy-mechanical { color: #44505f; }
.energy-gravity { color: #7a5a00; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.2rem; margin-top: 1rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label .hint { font-weight: 400; color: var(--steel); font-size: .8rem; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--panel);
  border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: .55em .7em; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px #ffe8a3; }
textarea { min-height: 4.5em; resize: vertical; }
.wide { grid-column: 1 / -1; }

.energy-rows { margin-top: 1.2rem; display: grid; gap: .7rem; }
.energy-row { display: grid; grid-template-columns: 180px 1fr 1fr 1fr auto; gap: .5rem; align-items: start;
  padding: .7rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: #fafbfc; }
.energy-row textarea { min-height: 2.6em; field-sizing: content; }
.energy-row label { font-size: .78rem; color: var(--ink-soft); }
.energy-row select, .energy-row textarea { font-size: .92rem; }
.energy-row .method { grid-column: 2 / -1; grid-row: 2; }
.energy-row .remove { grid-column: 5; grid-row: 1; font-size: .85rem; }
@media (max-width: 900px) {
  .energy-row { grid-template-columns: minmax(0, 1fr); }
  .energy-row .method, .energy-row .remove { grid-column: auto; grid-row: auto; }
  .energy-row .remove { justify-self: start; }
}

.actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-top: 1.4rem; }
.notice { padding: .8rem 1rem; border-left: 4px solid var(--signal-deep); background: #fff8df; border-radius: 0 6px 6px 0;
  font-size: .92rem; }
.error { border-left-color: var(--danger); background: #fdecee; }

/* License bar */
.license-bar { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; justify-content: space-between;
  padding: .7rem 1rem; background: #eef2f7; border-radius: var(--radius-m); margin-bottom: 1.4rem; font-size: .95rem; }
.license-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.license-form input { min-width: 300px; }

/* The procedure document (preview and print) */
.doc-wrap { position: relative; margin-top: 1.2rem; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: clamp(1rem, 3vw, 2.4rem);
  position: relative; overflow: hidden; font-size: .95rem; }
.doc-kicker { color: var(--danger); font-weight: 800; font-stretch: 120%; margin: 0; }
.doc h2 { margin: .2rem 0 1rem; font-size: 1.5rem; }
.doc h3 { border-bottom: 2px solid var(--ink); padding-bottom: .25rem; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem 1rem; margin: 0; }
.doc-meta dt { font-size: .75rem; color: var(--steel); }
.doc-meta dd { margin: 0; font-weight: 600; }
.table-wrap { overflow-x: auto; }
.energy-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.energy-table th, .energy-table td { border: 1px solid var(--line); padding: .45rem .55rem; text-align: left; vertical-align: top; }
.energy-table th { background: #eef2f7; font-weight: 700; }
.doc .energy-table { table-layout: fixed; }
.doc .energy-table th:nth-child(1) { width: 17%; } .doc .energy-table th:nth-child(2) { width: 19%; }
.doc .energy-table th:nth-child(3) { width: 19%; } .doc .energy-table th:nth-child(4) { width: 14%; }
.doc .energy .energy, .doc .energy-table .energy { white-space: normal; }
.steps { padding-left: 1.4rem; }
.steps li { margin: .35rem 0; }
.steps .check { display: none; }
.locked { margin: .6rem 0; padding: .9rem; text-align: center; border: 1.5px dashed var(--steel); border-radius: var(--radius-m);
  color: var(--ink-soft); background: repeating-linear-gradient(-45deg, #fafbfc 0 10px, #f1f4f7 10px 20px); }
.signoff div { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: end; margin: .9rem 0; }
.signoff .line { border-bottom: 1px solid var(--ink); height: 1.6em; }
.doc-disclaimer { margin-top: 1.6rem; padding: .9rem 1rem; border: 1.5px solid var(--danger); border-radius: var(--radius-s);
  font-size: .82rem; background: #fff5f6; }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-weight: 900; font-stretch: 125%; font-size: clamp(4rem, 14vw, 9rem); color: rgba(200, 16, 46, .08);
  transform: rotate(-24deg); }
.doc-preview { user-select: none; }
.unlock { position: sticky; bottom: 1rem; margin: 1rem auto 0; max-width: 640px; display: flex; gap: 1rem;
  align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .9rem 1.1rem; background: var(--ink);
  color: #fff; border-radius: var(--radius-m); box-shadow: 0 10px 30px rgba(20, 33, 61, .3); }

/* Saved procedures */
.saved { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; }
.saved button { width: 100%; text-align: left; }

/* Pricing as a printed price list */
.price-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border: 2px solid var(--ink);
  border-radius: var(--radius-m); overflow: hidden; background: var(--panel); }
.price { padding: 1.4rem 1.2rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.price:last-child { border-right: 0; }
.price .amount { font-size: 2.3rem; font-weight: 850; font-stretch: 112%; line-height: 1; }
.price .amount small { font-size: .9rem; font-weight: 600; color: var(--steel); }
.price ul { padding-left: 1.1rem; margin: .3rem 0 1rem; font-size: .92rem; flex: 1; }
.price.featured { background: #fffbea; }
.consent { display: flex; flex-direction: row; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .88rem;
  margin: 1rem 0 0; max-width: 780px; }
.consent input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; flex: none; }
@media (max-width: 700px) { .price { border-right: 0; border-bottom: 1px solid var(--line); } }

/* How it is built */
.built { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem 2.5rem; }
.built p { margin: .3rem 0 0; color: var(--ink-soft); }
.built strong { font-stretch: 108%; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: .9rem 0; max-width: 820px; }
summary { cursor: pointer; font-weight: 700; }
details p { color: var(--ink-soft); }

/* Inner pages */
.page-hero { max-width: 860px; margin: 0 auto; padding: 3rem 0 1rem; }
.kicker { color: var(--danger); font-weight: 800; font-stretch: 115%; margin: 0 0 .4rem; }
.content { max-width: 860px; margin: 0 auto; }
.callout { margin: 2.5rem 0; padding: 1.5rem; background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: 5px 5px 0 var(--ink); }
.callout h3 { margin-top: 0; }
.disclaimer-inline { font-size: .85rem; color: var(--steel); }
.machine-links { columns: 2; }
.guide-list { display: grid; gap: .8rem; }
.guide-card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.2rem; background: var(--panel);
  border: 1.5px solid var(--line); border-radius: var(--radius-m); text-decoration: none; }
.guide-card:hover { border-color: var(--ink); }
.guide-card span { color: var(--steel); font-size: .95rem; }
.legal h2 { font-size: 1.25rem; }

/* Modal (paywall) */
.modal { position: fixed; inset: 0; background: rgba(20, 33, 61, .55); display: none; place-items: center; padding: 1rem;
  z-index: 50; }
.modal.visible { display: grid; }
.modal-box { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-m); max-width: 920px;
  width: 100%; max-height: 92vh; overflow: auto; padding: clamp(1rem, 3vw, 2rem); position: relative; }
.modal-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.6rem; background: none; border: 0; cursor: pointer;
  color: var(--ink); }
.checkout-banner { display: none; margin-bottom: 1rem; }
.checkout-banner.visible { display: block; }
.key-box { font-family: ui-monospace, monospace; font-size: .95rem; background: #fff; border: 1.5px dashed var(--ink);
  padding: .5rem .7rem; border-radius: 4px; word-break: break-all; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Print: only the procedure or the tags */
#print-area { display: none; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .doc { border: 0; padding: 0; }
  .doc h3 { break-after: avoid; }
  .energy-table tr, .signoff, .doc-disclaimer { break-inside: avoid; }
  .energy-table thead { display: table-header-group; }   /* repeat the header on every page */
  /* Four tags per sheet: flex wraps more reliably than grid across printed pages. */
  .tags { display: flex; flex-wrap: wrap; gap: 8mm; }
  .tags .tag { width: calc(50% - 4mm); break-inside: avoid; border-width: 2px; }
  .tag-danger, .doc-kicker, .energy { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Paywall: the four plans on one row when there is room */
.modal .price-list { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.modal .price { padding: 1.1rem 1rem; }
