/* /change-wifi-password: menu-path strip, diagrams, password maker, strength bars, Wi-Fi QR card.
   Uses the tokens from site.css. Animations are CSS only, so the site-wide prefers-reduced-motion
   rule switches them off; every animated element's resting state is the finished picture. */

/* Generic menu path: a strip of "screens", not any maker's interface */
.menu-path { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0; margin: 0.75rem 0 1.25rem; list-style: none; font-size: 0.9375rem; }
.menu-path li + li { margin-top: 0; }
.menu-path li { display: inline-flex; align-items: center; gap: 0.35rem; }
.menu-path span { display: inline-block; padding: 0.3rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius-label); background: var(--surface); font-weight: 600; }
.menu-path li + li::before { content: "›"; color: var(--muted); font-weight: 700; }
.menu-path li:last-child span { background: var(--led); border-color: var(--led); color: #fff; }

/* Diagrams */
.diagram { margin: 1.25rem 0 1.5rem; }
.diagram svg { display: block; width: 100%; max-width: 26rem; height: auto; margin: 0 auto; }
.diagram figcaption { font-size: 0.9375rem; color: var(--muted); margin-top: 0.5rem; text-align: center; }

/* Devices reconnecting (8 s loop). Resting state = all connected. */
.rc-link { stroke: var(--led); stroke-width: 3; stroke-linecap: round; }
.rc-check { fill: var(--led); }
.rc-led { fill: var(--led); }
@media (prefers-reduced-motion: no-preference) {
  .rc-link { animation: rc-link 8s infinite; }
  .rc-check { animation: rc-check 8s infinite; }
  .rc-2 { animation-name: rc-link-2; }
  .rc-check.rc-2 { animation-name: rc-check-2; }
  .rc-3 { animation-name: rc-link-3; }
  .rc-check.rc-3 { animation-name: rc-check-3; }
  .rc-led { animation: rc-led 8s infinite; }
  .rc-key { animation: rc-key 8s infinite; }
}
@keyframes rc-link   { 0%, 14% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } 18%, 44% { stroke: #aeb9c4; stroke-dasharray: 3 7; opacity: 0.7; } 50%, 100% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } }
@keyframes rc-link-2 { 0%, 14% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } 18%, 56% { stroke: #aeb9c4; stroke-dasharray: 3 7; opacity: 0.7; } 62%, 100% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } }
@keyframes rc-link-3 { 0%, 14% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } 18%, 68% { stroke: #aeb9c4; stroke-dasharray: 3 7; opacity: 0.7; } 74%, 100% { stroke: var(--led); stroke-dasharray: none; opacity: 1; } }
@keyframes rc-check   { 0%, 14% { opacity: 1; } 18%, 44% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes rc-check-2 { 0%, 14% { opacity: 1; } 18%, 56% { opacity: 0; } 62%, 100% { opacity: 1; } }
@keyframes rc-check-3 { 0%, 14% { opacity: 1; } 18%, 68% { opacity: 0; } 74%, 100% { opacity: 1; } }
@keyframes rc-led { 0%, 14% { fill: var(--led); } 18%, 22%, 26%, 30%, 34%, 38% { fill: var(--lan); } 20%, 24%, 28%, 32%, 36% { fill: #f2d48f; } 44%, 100% { fill: var(--led); } }
@keyframes rc-key { 0%, 10% { opacity: 0; transform: translateY(6px); } 14%, 36% { opacity: 1; transform: none; } 42%, 100% { opacity: 0; transform: none; } }
.rc-key { opacity: 0; }

/* Phone scanning the card (7 s loop). Resting state = "join network" prompt shown. */
.scan-line { opacity: 0; }
.scan-toast { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .scan-line { animation: scan-line 7s infinite; }
  .scan-toast { animation: scan-toast 7s infinite; }
  .scan-phone { animation: scan-phone 7s infinite; }
}
@keyframes scan-line { 0% { opacity: 0; transform: translateY(0); } 8% { opacity: 1; } 25% { transform: translateY(58px); } 42% { transform: translateY(0); } 52% { opacity: 1; transform: translateY(29px); } 56%, 100% { opacity: 0; transform: translateY(29px); } }
@keyframes scan-toast { 0%, 56% { opacity: 0; transform: translateY(8px); } 62%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes scan-phone { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }

/* Tool sections */
.tool h2 { margin-top: 0; }
.tool .field-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 400; margin: 0.75rem 0; cursor: pointer; }
.check input { width: 1.35rem; height: 1.35rem; margin: 0.1rem 0 0; flex: none; accent-color: var(--wan); }
.range-row { display: flex; align-items: center; gap: 0.75rem; }
.range-row input[type="range"] { flex: 1; min-height: 2.75rem; accent-color: var(--wan); }
.range-row output { min-width: 2.5ch; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* Password field: sticker-style, monospace so look-alike characters stay distinct */
.pass-field { width: 100%; min-height: 3.25rem; padding: 0.7rem 0.8rem; border: 2px solid var(--ink); border-radius: var(--radius-control); background: #fff; color: var(--ink); font: 700 1.1875rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", "Noto Sans Mono", monospace; letter-spacing: 0.04em; word-break: break-all; }
.pass-field:focus { outline: none; box-shadow: 0 0 0 3px rgba(29, 95, 209, 0.25); }
input[type="password"], input.text-field { width: 100%; min-height: 3rem; padding: 0.6rem 0.75rem; border: 1px solid #aeb9c4; border-radius: var(--radius-control); background: var(--surface); color: var(--ink); font: 1.0625rem/1.3 var(--font); }
input.text-field:disabled { background: var(--paper); color: var(--muted); }

/* Strength meter as Wi-Fi signal bars */
.meter { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0 0.25rem; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 1.6rem; flex: none; }
.bars i { display: block; width: 0.5rem; border-radius: 2px; background: var(--rule); }
.bars i:nth-child(1) { height: 20%; }
.bars i:nth-child(2) { height: 40%; }
.bars i:nth-child(3) { height: 60%; }
.bars i:nth-child(4) { height: 80%; }
.bars i:nth-child(5) { height: 100%; }
.meter[data-level="1"] .bars i:nth-child(-n+1),
.meter[data-level="2"] .bars i:nth-child(-n+2) { background: var(--lan); }
.meter[data-level="3"] .bars i:nth-child(-n+3) { background: #7aa83a; }
.meter[data-level="4"] .bars i:nth-child(-n+4),
.meter[data-level="5"] .bars i:nth-child(-n+5) { background: var(--led); }
.meter-text { display: flex; flex-direction: column; line-height: 1.3; }
.meter-text strong { font-size: 1.0625rem; }
.meter-text span { font-size: 0.875rem; color: var(--muted); }
.tips { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.9375rem; color: var(--ink); }
.tips li::marker { color: var(--lan); }

/* Wi-Fi QR card */
.qr-grid { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .qr-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.wifi-card { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 1rem; text-align: center; max-width: 20rem; margin: 0 auto; width: 100%; }
.wifi-card-head { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em; margin-bottom: 0.6rem; }
.wifi-card-head svg { width: 1.5rem; height: 1.5rem; }
.qr-box { width: 100%; max-width: 15rem; aspect-ratio: 1; margin: 0 auto; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-empty { display: grid; place-items: center; width: 100%; height: 100%; border: 2px dashed var(--rule); border-radius: var(--radius-label); color: var(--muted); font-size: 0.9375rem; padding: 1rem; }
.wifi-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem; text-align: left; margin: 0.8rem 0 0.4rem; padding-top: 0.6rem; border-top: 1px dashed #c4ccd4; }
.wifi-card dt { color: var(--muted); font-size: 0.875rem; }
.wifi-card dd { margin: 0; font: 700 1rem/1.35 ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", "Noto Sans Mono", monospace; word-break: break-all; }
.wifi-card .scan-hint { font-size: 0.875rem; color: var(--muted); margin: 0.4rem 0 0; }
.qr-status { margin-top: 0.5rem; }
.payload { font: 0.875rem/1.4 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--paper); padding: 0.5rem 0.6rem; border-radius: var(--radius-label); }
.private { display: flex; gap: 0.6rem; align-items: flex-start; }
.private svg { flex: none; width: 1.4rem; height: 1.4rem; margin-top: 0.1rem; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Print: from the "Print card" button only the card prints; a normal print drops the controls */
@media print {
  .site-header, .site-footer, .crumbs, .updated, .actions, .diagram, .skip { display: none !important; }
  /* Card only: remove everything outside the chain main > #qr-tool > .qr-grid > .qr-preview > #qr-card */
  html.print-card body > :not(main),
  html.print-card main > :not(#qr-tool),
  html.print-card #qr-tool > :not(.qr-grid),
  html.print-card .qr-grid > :not(.qr-preview),
  html.print-card .qr-preview > :not(#qr-card) { display: none !important; }
  html.print-card main, html.print-card #qr-tool, html.print-card .qr-grid, html.print-card .qr-preview { display: block; margin: 0; padding: 0; border: 0; background: none; }
  html.print-card #qr-card { width: 9cm; max-width: none; margin: 0; border-width: 1.5pt; }
  .wifi-card { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
