/* diagrams.css: inline-SVG and CSS illustrations (phone settings walk-through, glyph pairs, network map,
   address segments, Wi-Fi vs mobile-data path). All motion is CSS on real elements, so the global
   prefers-reduced-motion rule in site.css stops it; the un-animated state is always the informative frame. */

figure.diagram { margin: 1.25rem 0; }
figure.diagram figcaption { font-size: 0.9375rem; color: var(--muted); margin-top: 0.5rem; }
.diagram svg { display: block; max-width: 100%; height: auto; }
.diagram text { font-family: var(--font); }

/* ---------- Phone walk-through (Settings → Wi-Fi → network → Router) ---------- */
.phone-demo { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; gap: 0.9rem; align-items: start; }
@media (min-width: 40rem) { .phone-demo { grid-template-columns: 12rem 1fr; gap: 1.5rem; } }
.phone-demo .phone { width: 100%; }
.phone-demo ol.steps { margin: 0; font-size: 0.9375rem; line-height: 1.45; }
.phone-demo ol.steps > li { padding: 0.15rem 0.35rem 0.15rem 2.4rem; margin-top: 0.5rem; }
.phone-demo ol.steps > li:first-child { margin-top: 0.1rem; }
@media (max-width: 22rem) { .phone-demo { grid-template-columns: 1fr; } .phone-demo .phone { max-width: 11rem; margin: 0 auto; } }

.ph-body { fill: #18222e; }
.ph-screen { fill: #f2f2f7; }
.ph-screen.android { fill: #f8f9fb; }
.ph-cam { fill: #0b1118; }
.ph-status { font-size: 9px; font-weight: 600; fill: #18222e; }
.ph-back { font-size: 10px; fill: #1d5fd1; }
.ph-title { font-size: 19px; font-weight: 700; fill: #18222e; }
.ph-title.small { font-size: 15px; }
.ph-head { font-size: 7.5px; font-weight: 600; fill: #6b7683; letter-spacing: 0.04em; }
.ph-row { fill: #fff; }
.ph-label { font-size: 10px; fill: #18222e; }
.ph-value { font-size: 10px; fill: #6b7683; text-anchor: end; }
.ph-value.strong { fill: #18222e; font-weight: 700; }
.ph-icon-wan { fill: #1d5fd1; }
.ph-icon-led { fill: #17955a; }
.ph-icon-lan { fill: #c98a0b; }
.ph-on { fill: #17955a; }
.ph-knob { fill: #fff; }
.ph-info { fill: none; stroke: #1d5fd1; stroke-width: 1.2; }
.ph-info-i { font-size: 8px; font-weight: 700; fill: #1d5fd1; text-anchor: middle; }
.ph-mark { fill: none; stroke-width: 2.2; rx: 7; }
.ph-mark.you { stroke: #1d5fd1; }
.ph-mark.router { stroke: #17955a; }
.ph-tag { font-size: 8.5px; font-weight: 700; }
.ph-tag.you { fill: #1d5fd1; }
.ph-tag.router { fill: #17955a; }
.ph-tap { fill: rgba(29, 95, 209, 0.18); stroke: #1d5fd1; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ph-tap 1.5s ease-out infinite; }

/* Frame timing: 4 frames over 12 s. Static (reduced motion) = the "Router" frame. */
.pf { opacity: 0; animation: pf-quarter 12s infinite; }
.pf.f1 { animation-delay: 0s; }
.pf.f2 { animation-delay: -9s; }
.pf.f3 { animation-delay: -6s; }
.pf.f4 { animation-delay: -3s; opacity: 1; }
.pf.f34 { animation-name: pf-half; animation-delay: -6s; opacity: 1; }
.phone-demo ol.steps > li { border-radius: 8px; animation: step-glow 12s infinite; }
.phone-demo ol.steps > li:nth-child(1) { animation-delay: 0s; }
.phone-demo ol.steps > li:nth-child(2) { animation-delay: -9s; }
.phone-demo ol.steps > li:nth-child(3) { animation-delay: -6s; }
.phone-demo ol.steps > li:nth-child(4) { animation-delay: -3s; }

@keyframes pf-quarter { 0% { opacity: 0; } 2%, 23% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes pf-half { 0% { opacity: 0; } 1%, 48% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes step-glow { 0% { background: transparent; } 2%, 23% { background: #e8f0fd; } 25%, 100% { background: transparent; } }
@keyframes ph-tap { 0% { transform: scale(0.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }

/* ---------- Look-alike glyphs (letter vs number) ---------- */
.glyphs { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: flex-start; margin: 0.25rem 0 0.75rem; }
.glyph-pair { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 0.4rem; }
.glyph { display: grid; place-items: center; width: 3.1rem; height: 3.6rem; border-radius: 8px; border: 2px solid; font: 500 2.25rem/1 var(--font); }
.glyph.is-letter { border-color: var(--lan); background: var(--lan-wash); color: #7a5306; animation: glyph-nudge 4s ease-in-out infinite; }
.glyph.is-number { border-color: var(--led); background: #e8f5ee; color: #0e5c37; }
.glyph-vs { font-size: 1.25rem; color: var(--muted); }
.glyph-caption { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); }
@keyframes glyph-nudge { 0%, 70%, 100% { transform: none; } 76% { transform: translateX(-3px); } 82% { transform: translateX(3px); } 88% { transform: translateX(-2px); } 94% { transform: none; } }

/* ---------- Four-number address ruler (five-part input) ---------- */
.segments { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.2rem; margin: 0.5rem 0 0; font-variant-numeric: tabular-nums; }
.segment { display: grid; justify-items: center; gap: 0.25rem; }
.segment b { display: grid; place-items: center; min-width: 2.6rem; height: 2.8rem; padding: 0 0.4rem; border-radius: 8px; border: 2px solid var(--led); background: #e8f5ee; font-size: 1.25rem; }
.segment small { font-size: 0.75rem; color: var(--muted); }
.segment-dot { font-weight: 700; font-size: 1.4rem; padding-bottom: 1.45rem; color: var(--muted); }
.segment.extra b { border-color: var(--lan); background: var(--lan-wash); border-style: dashed; color: #7a5306; animation: extra-pop 3s ease-in-out infinite; }
.segment.extra small { color: #7a5306; font-weight: 700; }
@keyframes extra-pop { 0%, 60%, 100% { transform: none; opacity: 1; } 75% { transform: translateY(-4px); opacity: 0.55; } }

/* ---------- Network map (router + devices) and path diagrams ---------- */
.net-line { stroke: #9aa6b2; stroke-width: 2; fill: none; stroke-dasharray: 5 5; animation: net-flow 1.6s linear infinite; }
.net-line.ok { stroke: var(--led); }
.net-line.bad { stroke: var(--lan); }
.net-router { fill: #18222e; }
.net-led { fill: #17955a; }
.net-box { fill: #fff; stroke: #c4ccd4; stroke-width: 1.5; }
.net-box.focus { stroke: var(--lan); stroke-width: 2.5; fill: var(--lan-wash); }
.net-label { font-size: 12px; fill: #18222e; font-weight: 600; text-anchor: middle; }
.net-ip { font-size: 11px; fill: #566372; text-anchor: middle; font-variant-numeric: tabular-nums; }
.net-ip.strong { fill: #18222e; font-weight: 700; }
.net-ink { fill: #18222e; }
.net-muted { fill: #8a96a3; }
.net-cross { stroke: var(--lan); stroke-width: 3; stroke-linecap: round; }
.net-tick { stroke: var(--led); stroke-width: 3; stroke-linecap: round; fill: none; }
@keyframes net-flow { to { stroke-dashoffset: -20; } }
