/* ==========================================================================
   EL BADR Industries — the production-line section, one layout per catalog
   (templates/partials/catalog_lines.html). Ceramic keeps the vertical
   timeline in ceramic.css; this file only loads on the other catalogs.

     .ln--cement      process-flow diagram (serpentine pipe + stations)
     .ln--gearbox     gear dial (sticky gear and pinion + step cards)
     .ln--sheetmetal  engineering drawing (zoned sheet + title block)
     .ln--cnc         machine controller (G-code listing + toolpath display)

   Built on the tokens in main.css / ceramic.css; light values first, dark
   ones in the [data-theme="dark"] blocks. Motion lives in catalog-lines.js,
   and every layout is complete without it.
   ========================================================================== */

/* "See it in the catalog" — shared by all four */
.ln-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ln-link::after { content: "↓"; transition: transform 0.2s ease; }
.ln-link:hover::after { transform: translateY(3px); }
[dir="rtl"] .ln-link { letter-spacing: normal; font-size: 0.84rem; }

/* ==========================================================================
   Cement — process-flow diagram
   ========================================================================== */
.ln--cement {
  --ln-pipe: #cfd0d6;
  --ln-pipe-2: #e9eaed;
  --ln-led: #b3b4bb;
  background:
    radial-gradient(var(--cer-grid) 1px, transparent 1.3px) 0 0 / 18px 18px,
    var(--paper);
  --cer-ring: var(--paper);
  overflow: hidden;
}
[data-theme="dark"] .ln--cement {
  --ln-pipe: #3a3a43;
  --ln-pipe-2: #2a2a31;
  --ln-led: #4b4b54;
}

.flow { position: relative; --node: 62px; }
.flow__pipe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.flow__pipe path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.flow__bed { stroke: var(--ln-pipe); stroke-width: 16; }
.flow__core { stroke: var(--ln-pipe-2); stroke-width: 4; }
.flow__fill { stroke: var(--red); stroke-width: 16; }
.flow__mask { stroke: #fff; stroke-width: 20; stroke-linecap: butt; }
.flow__grain {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4.5;
  stroke-dasharray: 0.1 15;
  animation: flow-grain 0.8s linear infinite;
}
@keyframes flow-grain { to { stroke-dashoffset: -15.1; } }
.flow__pipe marker path { fill: var(--ln-pipe); stroke: none; }
.flow.is-full .flow__pipe marker path { fill: var(--red); }

.flow__list {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.3rem;
}
.flow__st {
  display: grid;
  grid-template-columns: var(--node) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: center;
}
.flow__node {
  order: -1;
  position: relative;
  width: var(--node);
  height: var(--node);
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--ln-pipe);
  color: var(--muted);
  box-shadow: 0 0 0 6px var(--paper), var(--shadow);
  transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}
.flow__node svg { width: 32px; height: 32px; }
.flow__led {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ln-led);
  border: 3px solid var(--paper);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.flow__st.is-on .flow__node {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 0 0 6px var(--paper), 0 0 0 11px rgba(209, 32, 38, 0.14), 0 14px 28px rgba(209, 32, 38, 0.32);
}
.flow__st.is-on .flow__led {
  background: #2bd46b;
  box-shadow: 0 0 10px #2bd46b;
  animation: flow-led 1.8s ease-in-out infinite;
}
@keyframes flow-led { 50% { box-shadow: 0 0 2px #2bd46b; opacity: 0.7; } }

.flow__card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.2rem;
  box-shadow: var(--shadow);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}
.flow__st.is-on .flow__card { border-color: rgba(209, 32, 38, 0.35); }
.flow__tag {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.flow__tag b {
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  background: var(--ink);
  color: var(--white);
  letter-spacing: 0.06em;
  transition: background 0.35s ease, color 0.35s ease;
}
.flow__st.is-on .flow__tag b { background: var(--red); color: #fff; }
[dir="rtl"] .flow__tag { letter-spacing: normal; font-size: 0.8rem; }
.flow__card h3 { font-size: 1.08rem; margin: 0 0 0.3rem; }
.flow__card p { color: var(--muted); font-size: 0.93rem; margin: 0; }

.flow__legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.6rem;
  margin: 2.6rem 0 0;
  font-family: var(--font-head);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
[dir="rtl"] .flow__legend { letter-spacing: normal; font-size: 0.84rem; }
.flow__legend span { display: inline-flex; align-items: center; gap: 0.5rem; }
.flow__key { width: 12px; height: 12px; border-radius: 50%; background: var(--ln-led); }
.flow__key--run { background: #2bd46b; box-shadow: 0 0 8px #2bd46b; }
.flow__key--feed { width: 26px; height: 8px; border-radius: 4px; background: var(--red); }

/* Desktop: two rows of stations on a serpentine pipe — the first row runs
   one way with its cards above the pipe, the second comes back underneath
   with its cards below. The pipe itself is drawn by catalog-lines.js. */
@media (min-width: 920px) {
  .flow { --node: 66px; }
  .flow__list {
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    column-gap: clamp(1rem, 2.2vw, 1.8rem);
    row-gap: 58px;
  }
  .flow__st {
    grid-column: var(--c);
    grid-row: var(--r);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  .flow__st--r1 .flow__node { order: 2; }
  .flow__card { flex: 1; width: 100%; }
  .flow__st--r1 .flow__card { margin-bottom: 26px; }
  .flow__st--r2 .flow__card { margin-top: 26px; }
  /* the stem from each card down (or up) to its station */
  .flow__card::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 2px;
    height: 26px;
    margin-left: -1px;
    background: var(--ln-pipe);
    transition: background 0.35s ease;
  }
  .flow__st--r1 .flow__card::after { top: 100%; }
  .flow__st--r2 .flow__card::after { bottom: 100%; }
  .flow__st.is-on .flow__card::after { background: var(--red); }
}

/* ==========================================================================
   Gearbox — gear dial
   ========================================================================== */
.ln--gearbox {
  --ln-s1: #f1f2f5;
  --ln-s2: #b4b7c0;
  --ln-edge: #8c8f99;
  --ln-face: #f8f8fa;
  --ln-hole: var(--white);
}
[data-theme="dark"] .ln--gearbox {
  --ln-s1: #464852;
  --ln-s2: #1d1e23;
  --ln-edge: #5b5d67;
  --ln-face: #1b1c21;
  --ln-hole: var(--white);
}

.dial { position: relative; }
.dial__stage { display: none; }

.dial__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.dial__step {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.dial__badge {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--red);
}
.dial__badge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: currentColor;
  transition: transform 1.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.dial__step.reveal-pending .dial__badge svg { transform: rotate(-150deg); }
.dial__badge b {
  position: relative;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.92rem;
}
.dial__card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem 1.3rem;
  box-shadow: var(--shadow);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.dial__num {
  position: absolute;
  top: -0.9rem;
  inset-inline-end: 0.6rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 5rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line);
  pointer-events: none;
  transition: -webkit-text-stroke-color 0.4s ease;
}
.dial__card h3 { position: relative; font-size: 1.14rem; margin: 0 0 0.35rem; }
.dial__card p { position: relative; color: var(--muted); font-size: 0.95rem; margin: 0; }
.dial__card .ln-link { position: relative; }

/* the gear itself */
.dial__svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dial__s1 { stop-color: var(--ln-s1); }
.dial__s2 { stop-color: var(--ln-s2); }
.dial__teeth { fill: url(#dial-steel); stroke: var(--ln-edge); stroke-width: 1.4; stroke-linejoin: round; }
.dial__web { fill: none; stroke: var(--ln-edge); stroke-width: 1; opacity: 0.45; }
.dial__rim { fill: var(--ln-face); stroke: var(--ln-edge); stroke-width: 1.4; }
.dial__tick { stroke: var(--muted); stroke-width: 1.2; opacity: 0.6; }
.dial__tick--major { stroke: var(--ink); stroke-width: 2.4; opacity: 1; }
.dial__hole { fill: var(--ln-hole); stroke: var(--ln-edge); stroke-width: 1.2; }
.dial__lbl text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 23px;
  fill: var(--muted);
  transition: fill 0.3s ease;
}
.dial__lbl.is-cur text { fill: var(--red); }
.dial__pteeth { fill: url(#dial-red); stroke: #7d0708; stroke-width: 1.2; stroke-linejoin: round; }
.dial__phub { fill: #7d0708; }
.dial__pkey { fill: #fff; opacity: 0.85; }
.dial__hub { fill: #19191c; }
[data-theme="dark"] .dial__hub { fill: #0b0b0e; stroke: rgba(255, 255, 255, 0.12); stroke-width: 1.5; }
.dial__hubring { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 1.4; stroke-dasharray: 2 5; }
.dial__hubnum { fill: #fff; font-family: var(--font-head); font-weight: 800; font-size: 46px; }
.dial__hubof { fill: rgba(255, 255, 255, 0.55); font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; }
.dial__ptr { fill: var(--red); filter: drop-shadow(0 4px 6px rgba(209, 32, 38, 0.35)); }

/* Desktop: the gear sits sticky beside the steps and turns as they pass */
@media (min-width: 920px) {
  .dial {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
  }
  .dial__stage {
    display: grid;
    place-items: center;
    position: sticky;
    top: calc(var(--header-h) + 3vh);
    height: min(640px, calc(100vh - var(--header-h) - 6vh));
  }
  .dial__svg { max-width: 580px; }
  .dial__list { gap: 0; padding-block: 16vh; }
  .dial__step { display: block; padding-block: 1.1rem; }
  .dial__badge { display: none; }
  .dial__card { padding: 1.5rem 1.7rem 1.6rem; }
  .dial.is-live .dial__card { opacity: 0.42; }
  .dial.is-live .dial__step.is-cur .dial__card {
    opacity: 1;
    transform: translateX(var(--dial-nudge, -10px));
    border-color: var(--red);
    box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .dial { --dial-nudge: 10px; }
  .dial__step.is-cur .dial__num { -webkit-text-stroke-color: rgba(209, 32, 38, 0.35); }
}

/* ==========================================================================
   Sheet metal — engineering drawing
   ========================================================================== */
.ln--sheetmetal { background: var(--paper); --cer-ring: var(--paper); }

.dwg {
  --dwg-paper: #fcfcf9;
  --dwg-ink: #2a2c33;
  --dwg-line: rgba(42, 44, 51, 0.42);
  --dwg-grid: rgba(42, 44, 51, 0.055);
  --dwg-red: var(--red);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cairo", monospace;
  position: relative;
  padding: clamp(10px, 1.6vw, 16px);
  border-radius: 4px;
  color: var(--dwg-ink);
  background:
    linear-gradient(var(--dwg-grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--dwg-grid) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--dwg-paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 30px 60px -20px rgba(25, 25, 28, 0.25);
}
/* dark mode turns the sheet into a blueprint */
[data-theme="dark"] .dwg {
  --dwg-paper: #0f2239;
  --dwg-ink: #e3edf9;
  --dwg-line: rgba(227, 237, 249, 0.36);
  --dwg-grid: rgba(227, 237, 249, 0.06);
  --dwg-red: var(--red);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

.dwg__frame {
  position: relative;
  border: 2px solid var(--dwg-ink);
  outline: 1px solid var(--dwg-line);
  outline-offset: clamp(4px, 0.8vw, 7px);
}
.dwg__zones { display: none; }

.dwg__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.dwg__view {
  position: relative;
  padding: 1rem 1.2rem 1.5rem;
  border-bottom: 1px solid var(--dwg-line);
}
/* the cell stays put while its drawing inks in and its notes fade up */
.dwg__view.reveal.reveal-pending { opacity: 1; transform: none; }
.dwg__view h3,
.dwg__view p,
.dwg__view .ln-link,
.dwg__cap {
  transition: opacity 0.6s ease calc(var(--i, 0) * 110ms + 0.7s), transform 0.6s ease calc(var(--i, 0) * 110ms + 0.7s);
}
.dwg__view.reveal-pending h3,
.dwg__view.reveal-pending p,
.dwg__view.reveal-pending .ln-link,
.dwg__view.reveal-pending .dwg__cap { opacity: 0; transform: translateY(8px); }

.dwg__balloon {
  position: absolute;
  top: 0.8rem;
  inset-inline-start: 0.8rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--dwg-red);
  color: var(--dwg-red);
  display: grid;
  place-items: center;
  font: 700 0.8rem/1 var(--mono);
}
.dwg__art {
  display: block;
  width: 100%;
  max-width: 230px;
  margin: 0.2rem auto 0.4rem;
  aspect-ratio: 16 / 10;
  overflow: visible;
}
.dwg__art path,
.dwg__art circle { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dwg__art .ink,
.dwg__art .dim {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.55, 0, 0.25, 1) calc(var(--i, 0) * 110ms + 0.05s);
}
.dwg__art .ink { stroke: var(--dwg-ink); stroke-width: 1.5; }
.dwg__art .ink--heavy { stroke-width: 2.6; }
.dwg__art .dim { stroke: var(--dwg-red); stroke-width: 1.1; transition-delay: calc(var(--i, 0) * 110ms + 0.9s); }
.dwg__art .cl,
.dwg__art .fold { transition: opacity 0.8s ease calc(var(--i, 0) * 110ms + 1.1s); }
.dwg__art .cl { stroke: var(--dwg-red); stroke-width: 0.8; stroke-dasharray: 9 2.5 1.5 2.5; opacity: 0.75; }
.dwg__art .fold { stroke: var(--dwg-ink); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.75; }
.dwg__view.reveal-pending .ink,
.dwg__view.reveal-pending .dim { stroke-dashoffset: 1; }
.dwg__view.reveal-pending .cl,
.dwg__view.reveal-pending .fold { opacity: 0; }

.dwg__cap {
  display: table;
  margin: 0 auto 0.85rem;
  padding-bottom: 3px;
  border-bottom: 1.5px solid currentColor;
  font: 700 0.66rem/1.2 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dwg-red);
}
[dir="rtl"] .dwg__cap { letter-spacing: normal; font-size: 0.78rem; }
.dwg__view h3 {
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--dwg-ink);
  margin: 0 0 0.4rem;
}
[dir="rtl"] .dwg__view h3 { letter-spacing: normal; font-size: 1.05rem; }
.dwg__view p { font-size: 0.9rem; color: var(--dwg-ink); opacity: 0.72; margin: 0; text-align: center; }
.dwg__view .ln-link { display: flex; justify-content: center; color: var(--dwg-red); }

.dwg__tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  color: var(--dwg-ink);
}
.dwg__tb th,
.dwg__tb td { border: 1px solid var(--dwg-ink); padding: 0.45rem 0.65rem; text-align: start; vertical-align: middle; }
.dwg__tb th {
  width: 1%;
  white-space: nowrap;
  font: 700 0.6rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}
[dir="rtl"] .dwg__tb th { letter-spacing: normal; font-size: 0.72rem; }
.dwg__tb td { font-family: var(--mono); font-size: 0.78rem; }
.dwg__tb-title { font-family: var(--font-head) !important; font-weight: 800; font-size: 1rem !important; }
.dwg__tb tr:first-child > * { border-top: 0; }
.dwg__tb tr > :first-child { border-inline-start: 0; }
.dwg__tb tr > :last-child { border-inline-end: 0; }
.dwg__tb tr:last-child > * { border-bottom: 0; }

@media (min-width: 640px) {
  .dwg__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dwg__view:nth-child(odd) { border-inline-end: 1px solid var(--dwg-line); }
}
@media (min-width: 1000px) {
  /* zone letters and numbers round the border, like a real drawing sheet */
  .dwg__frame { padding: 22px 0 0 22px; }
  [dir="rtl"] .dwg__frame { padding: 22px 22px 0 0; }
  .dwg__zones {
    position: absolute;
    display: flex;
    font: 700 0.62rem/1 var(--mono);
    color: var(--dwg-ink);
    opacity: 0.7;
  }
  .dwg__zones span { flex: 1; display: grid; place-items: center; }
  .dwg__zones--top { top: 0; inset-inline: 22px 0; height: 22px; border-bottom: 1px solid var(--dwg-line); }
  .dwg__zones--top span + span { border-inline-start: 1px solid var(--dwg-line); }
  .dwg__zones--side { flex-direction: column; top: 22px; bottom: 0; inset-inline-start: 0; width: 22px; border-inline-end: 1px solid var(--dwg-line); }
  .dwg__zones--side span + span { border-top: 1px solid var(--dwg-line); }

  .dwg__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dwg__view:nth-child(odd) { border-inline-end: 0; }
  .dwg__view:not(:nth-child(4n)) { border-inline-end: 1px solid var(--dwg-line); }
  .dwg__view { padding: 1.1rem 1.3rem 1.7rem; }
  /* title block tucked into the bottom corner of the sheet */
  .dwg__tb { width: min(62%, 600px); margin-inline-start: auto; border-inline-start: 1px solid var(--dwg-ink); }
  .dwg__tb tr > :first-child { border-inline-start: 1px solid var(--dwg-ink); }
}

/* ==========================================================================
   CNC — machine controller
   The screen is dark in both themes; it is a machine display.
   ========================================================================== */
.cnc {
  --cnc-bg: #0b0c10;
  --cnc-tx: #d8dbe2;
  --cnc-dim: #6d7380;
  --cnc-hi: var(--red);
  --cnc-ok: #36d67a;
  --cnc-amber: #ffb547;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cairo", monospace;
  position: relative;
  padding: clamp(8px, 1.4vw, 14px);
  border-radius: 22px;
  color: var(--cnc-tx);
  background: linear-gradient(180deg, #2c2e35, #1a1b20);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.cnc__bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  border-radius: 12px 12px 0 0;
  background: #15171d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font: 700 0.72rem/1 var(--mono);
  letter-spacing: 0.12em;
}
.cnc__prog-no { color: #fff; margin-inline-end: 0.3rem; }
.cnc__mode { padding: 0.28rem 0.5rem; border-radius: 4px; background: rgba(54, 214, 122, 0.14); color: var(--cnc-ok); }
.cnc__mode--dim { background: rgba(255, 255, 255, 0.06); color: var(--cnc-dim); }
.cnc__lamp { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 0.5rem; color: var(--cnc-dim); text-transform: uppercase; }
[dir="rtl"] .cnc__lamp { letter-spacing: normal; font-size: 0.8rem; }
.cnc__lamp i { width: 10px; height: 10px; border-radius: 50%; background: #3b3d44; transition: background 0.3s ease, box-shadow 0.3s ease; }
.cnc.is-run .cnc__lamp { color: var(--cnc-ok); }
.cnc.is-run .cnc__lamp i { background: var(--cnc-ok); box-shadow: 0 0 10px var(--cnc-ok); animation: cnc-blink 1.1s steps(1) infinite; }
@keyframes cnc-blink { 50% { opacity: 0.35; } }

.cnc__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-radius: 0 0 12px 12px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 3px),
    var(--cnc-bg);
}
.cnc__listing { padding: 1rem 0.9rem 1.3rem; font-family: var(--mono); min-width: 0; }
.cnc__meta { margin: 0; padding: 0.25rem 0.8rem; font-size: 0.84rem; color: var(--cnc-dim); }
.cnc__meta span { color: var(--cnc-tx); }
.cnc__meta em { font-style: normal; color: #8b93a3; }
.cnc__caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-inline-start: 0.35em;
  vertical-align: -3px;
  background: var(--cnc-tx);
  animation: cnc-blink 1s steps(1) infinite;
}

.cnc__prog { list-style: none; margin: 0.35rem 0; padding: 0; }
.cnc__blk {
  position: relative;
  display: grid;
  grid-template-columns: 4.6em minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.95rem 0.8rem;
  border-radius: 8px;
  transition: background 0.3s ease, opacity 0.3s ease;
}
.cnc__blk::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--cnc-hi);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cnc__n { padding-top: 0.12rem; font: 700 0.84rem/1.4 var(--mono); color: var(--cnc-dim); transition: color 0.3s ease; }
.cnc__code h3 {
  margin: 0 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
}
.cnc__code h3::before { content: "("; color: var(--cnc-dim); }
.cnc__code h3::after { content: ")"; color: var(--cnc-dim); }
[dir="rtl"] .cnc__code h3 { font-family: "Cairo", var(--mono); font-size: 1.05rem; letter-spacing: normal; }
.cnc__code p { margin: 0; font-family: var(--font-body); font-size: 0.93rem; color: #a9afbb; }
[dir="rtl"] .cnc__code p { font-family: "Cairo", var(--font-body); }
.cnc__code .ln-link { color: var(--cnc-hi); font-family: var(--mono); }

.cnc.is-live .cnc__blk { opacity: 0.45; }
.cnc.is-live .cnc__blk.is-done { opacity: 0.72; }
.cnc.is-live .cnc__blk.is-done .cnc__n { color: var(--cnc-ok); }
.cnc.is-live .cnc__blk.is-cur { opacity: 1; background: rgba(209, 32, 38, 0.09); }
.cnc__blk.is-cur::before { opacity: 1; }
.cnc__blk.is-cur .cnc__n { color: var(--cnc-hi); }
.cnc__blk.is-cur .cnc__n::before { content: "▶ "; }
[dir="rtl"] .cnc__blk.is-cur .cnc__n::before { content: none; }
[dir="rtl"] .cnc__blk.is-cur .cnc__n::after { content: " ◀"; }

/* the display: on phones only the readout, pinned under the header */
.cnc__view {
  order: -1;
  position: sticky;
  top: var(--header-h);
  z-index: 2;
  padding: 0.6rem 0.8rem 0.7rem;
  background: rgba(14, 16, 21, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.cnc__screen { display: none; }
.cnc__dro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.cnc__dro div {
  padding: 0.4rem 0.5rem;
  border-radius: 7px;
  background: #07080b;
  border: 1px solid rgba(255, 255, 255, 0.07);
  min-width: 0;
}
.cnc__dro dt { font: 700 0.64rem/1 var(--mono); color: var(--cnc-dim); margin-bottom: 0.25rem; }
.cnc__dro dd {
  margin: 0;
  font: 700 0.8rem/1.1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--cnc-ok);
  white-space: nowrap;
  overflow: hidden;
}
.cnc__dro-n dd { color: var(--cnc-hi); }
.cnc__prog-bar { height: 3px; margin-top: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.cnc__prog-bar i { display: block; width: 0; height: 100%; background: var(--cnc-hi); }

.cnc__screen svg { display: block; width: 100%; height: 100%; }
.cnc__stock { fill: rgba(255, 255, 255, 0.025); stroke: rgba(255, 255, 255, 0.2); stroke-width: 1; stroke-dasharray: 4 4; }
.cnc__plan { fill: none; stroke: rgba(255, 255, 255, 0.13); stroke-width: 1; }
.cnc__cut {
  fill: none;
  stroke: var(--cnc-hi);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(209, 32, 38, 0.75));
}
.cnc__axis { fill: none; stroke: var(--cnc-amber); stroke-width: 1; }
.cnc__tool circle { fill: rgba(54, 214, 122, 0.14); stroke: var(--cnc-ok); stroke-width: 1.5; }
.cnc__tool .cnc__tool-c { fill: var(--cnc-ok); stroke: none; }
.cnc__view-l {
  position: absolute;
  bottom: 8px;
  inset-inline-start: 10px;
  font: 700 0.62rem/1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--cnc-dim);
}

@media (min-width: 920px) {
  .cnc__body { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
  .cnc__listing { padding: 1.4rem 1.2rem 1.8rem; }
  .cnc__view {
    order: 0;
    align-self: start;
    top: calc(var(--header-h) + 24px);
    margin: 1.2rem;
    margin-inline-start: 0;
    padding: 0;
    background: none;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .cnc__screen {
    display: block;
    position: relative;
    aspect-ratio: 300 / 220;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background:
      linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 20px 20px,
      linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 20px 20px,
      radial-gradient(120% 90% at 50% 40%, #12151c, #07080b);
  }
  .cnc__dro { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .cnc__dro div { padding: 0.55rem 0.8rem; display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
  .cnc__dro dt { font-size: 0.8rem; margin: 0; }
  .cnc__dro dd { font-size: 1.12rem; }
  .cnc__prog-bar { height: 4px; margin-top: 12px; }
}

/* ==========================================================================
   Reduced motion — no looping, no inking, no spinning
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .flow__grain, .flow__st.is-on .flow__led, .cnc.is-run .cnc__lamp i, .cnc__caret { animation: none !important; }
  .dial__step.reveal-pending .dial__badge svg { transform: none; }
  .dwg__view.reveal-pending .ink,
  .dwg__view.reveal-pending .dim { stroke-dashoffset: 0; }
  .dwg__view.reveal-pending .cl,
  .dwg__view.reveal-pending .fold,
  .dwg__view.reveal-pending h3,
  .dwg__view.reveal-pending p,
  .dwg__view.reveal-pending .ln-link,
  .dwg__view.reveal-pending .dwg__cap { opacity: 1; transform: none; }
}
