/* Hero animation "describe -> configure -> print" (js/print-film.js).
   A configurator window: dark build-volume viewport with the layer-stack
   renderer on the left, parameter panel with print rules on the right. Below
   600px of window width (container query) the panel moves under the viewport. */

.print-film { position: absolute; z-index: 5; top: 150px; right: 1vw; width: min(760px, 97%); margin: 0; }
.print-film::before { content: ""; position: absolute; z-index: -1; inset: -14px -14px 18px 18px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.14); }
.pfm-window { position: relative; overflow: hidden; container-type: inline-size; border: 1px solid rgba(150,168,176,.6); background: #fff; box-shadow: 0 34px 70px rgba(6,18,24,.26), 0 8px 18px rgba(6,18,24,.1); }

/* Title bar: address and the three steps. */
.pfm-bar { height: 38px; padding: 0 8px 0 14px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line-soft); background: #f6f8f8; }
.pfm-dots { display: flex; gap: 5px; }
.pfm-dots i { width: 8px; height: 8px; border-radius: 50%; background: #d4dbde; }
.pfm-url { flex: 1 1 auto; min-width: 0; overflow: hidden; color: #7d8a92; font: 600 10px var(--mono); letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap; }
.pfm-steps { margin: 0; padding: 0; display: flex; gap: 4px; list-style: none; }
.pfm-steps li { padding: 4px 8px 4px 5px; display: flex; align-items: center; gap: 6px; border: 1px solid transparent; color: #9aa5ab; font: 600 9px var(--mono); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; transition: color .3s ease, background .3s ease, border-color .3s ease; }
.pfm-steps b { width: 15px; height: 15px; display: grid; place-items: center; border: 1px solid currentColor; font-size: 8.5px; letter-spacing: 0; }
.pfm-steps li.is-active { border-color: rgba(11,165,143,.45); color: var(--teal-deep); background: var(--mint); }
.pfm-steps li.is-done { color: var(--ink-soft); }
.pfm-steps li.is-done b { border-color: var(--teal); color: #fff; background: var(--teal); }

.pfm-body { display: grid; grid-template-columns: minmax(0, 1fr) 228px; aspect-ratio: 1.68; }

/* Viewport: the build volume. */
.pfm-view { position: relative; min-width: 0; overflow: hidden; background: radial-gradient(120% 95% at 44% 36%, #1e2b33 0%, #121b21 50%, #0b1116 100%); }
.pfm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pfm-prompt { position: absolute; z-index: 2; top: 14px; left: 14px; right: 14px; min-height: 34px; padding: 7px 8px 7px 11px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(79,214,191,.34); color: #e9f3f1; background: rgba(9,15,19,.72); font: 500 12px/1.3 var(--body); backdrop-filter: blur(8px); transition: border-color .4s ease, color .4s ease; }
.pfm-prompt.is-dim { border-color: rgba(255,255,255,.1); color: #9fb1b4; }
.pfm-spark { flex: 0 0 auto; color: var(--teal-light); font-size: 12px; font-style: normal; }
.pfm-typed { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pfm-caret { flex: 0 0 auto; width: 1.5px; height: 14px; margin-left: -6px; background: var(--teal-light); opacity: 0; }
.pfm-prompt.is-typing .pfm-caret { opacity: 1; animation: pfm-blink 1s steps(1) infinite; }
.pfm-ai { flex: 0 0 auto; margin-left: auto; padding: 2px 6px; border: 1px solid rgba(79,214,191,.45); color: var(--teal-light); font: 600 9px var(--mono); letter-spacing: .08em; }
@keyframes pfm-blink { 50% { opacity: 0; } }

.pfm-z { position: absolute; z-index: 2; left: 14px; bottom: 14px; display: flex; align-items: baseline; gap: 8px; color: #8ea4a6; font: 600 10px var(--mono); letter-spacing: .05em; opacity: 0; transition: opacity .25s ease; }
.pfm-z b { color: var(--amber); }
.pfm-z-val { min-width: 62px; color: #fff; font-variant-numeric: tabular-nums; }
.pfm-z.is-on { opacity: 1; }
.pfm-file { position: absolute; z-index: 2; right: 14px; bottom: 12px; padding: 6px 12px 6px 6px; display: flex; align-items: center; gap: 10px; color: var(--ink); background: #fff; box-shadow: 0 14px 30px rgba(0,0,0,.36); opacity: 0; transform: translateY(8px) scale(.96); transition: opacity .3s ease, transform .4s cubic-bezier(.2,1.3,.4,1); }
.pfm-file.is-on { opacity: 1; transform: none; }
.pfm-file-ico { width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: var(--teal); font: 600 9px var(--mono); letter-spacing: .04em; }
.pfm-file-text { min-width: 0; display: grid; gap: 2px; }
.pfm-file-name { font: 600 10.5px var(--mono); white-space: nowrap; }
.pfm-file-meta { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.pfm-file-ok { color: var(--teal); font-weight: 700; }

/* Panel: parameters, rules, live figures, print button. */
.pfm-panel { min-width: 0; padding: 16px 16px 14px; display: flex; flex-direction: column; justify-content: space-between; border-left: 1px solid var(--line-soft); background: #fff; }
.pfm-panel-inner { display: grid; gap: 14px; }
.pfm-head { display: grid; gap: 4px; }
.pfm-kicker { color: var(--teal-deep); font: 600 9px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.pfm-title { font: 700 19px/1.1 var(--display); letter-spacing: -.035em; }
.pfm-title.is-pending { color: #a0abb1; font-size: 14px; font-weight: 500; letter-spacing: -.01em; }
.pfm-params { display: grid; gap: 10px; }
.pfm-param { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 8px; }
.pfm-param-label { min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: 11.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pfm-param-value { color: var(--ink); font: 600 11px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; transition: color .2s ease; }
.pfm-slider { position: relative; grid-column: 1 / -1; height: 14px; }
.pfm-slider::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 4px; background: #e2e8ea; }
.pfm-slider-fill { position: absolute; top: 5px; left: 0; height: 4px; background: var(--teal); }
.pfm-slider-thumb { position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; border: 2px solid var(--teal); border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(16,22,28,.18); transition: transform .15s ease, box-shadow .15s ease; }
.pfm-param.is-drag .pfm-slider-thumb { transform: scale(1.22); box-shadow: 0 0 0 6px rgba(11,165,143,.16); }
.pfm-param.is-drag .pfm-param-value { color: var(--teal-deep); }
.pfm-rules { margin: 0; padding: 12px 0 0; display: grid; gap: 7px; border-top: 1px solid var(--line-soft); list-style: none; }
.pfm-rule { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: center; gap: 8px; color: #a7b1b6; font: 600 9.5px/1.25 var(--mono); transition: color .3s ease; }
.pfm-rule span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfm-rule i { width: 14px; height: 14px; display: grid; place-items: center; border: 1px solid #cdd5d9; color: transparent; font-size: 9px; font-style: normal; transition: background .25s ease, border-color .25s ease, color .25s ease, transform .25s ease, box-shadow .25s ease; }
.pfm-rule i::before { content: "✓"; }
.pfm-rule.is-on { color: var(--ink-soft); }
.pfm-rule.is-on i { border-color: var(--teal); color: #fff; background: var(--teal); }
.pfm-rule.is-warn { color: #b25f00; }
.pfm-rule.is-warn i { border-color: var(--amber); color: #fff; background: var(--amber); }
.pfm-rule.is-warn i::before { content: "!"; }
.pfm-rule.is-pulse i { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(11,165,143,.18); }
.pfm-stats { margin: 0; padding-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-top: 1px solid var(--line-soft); }
.pfm-stats div { min-width: 0; }
.pfm-stats dt { color: #8b979e; font: 600 8px var(--mono); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.pfm-stats dd { margin: 4px 0 0; overflow: hidden; font: 600 12px var(--display); letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; transition: color .3s ease; }
.pfm-stats.is-live dd { color: var(--teal-deep); }
.pfm-button { position: relative; min-height: 40px; margin-top: 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #fff; background: var(--ink); font: 600 12px var(--display); letter-spacing: -.01em; transition: background .25s ease, transform .12s ease; }
.pfm-button-label { position: relative; z-index: 1; white-space: nowrap; }
.pfm-button-bar { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--teal); }
.pfm-button.is-press { transform: scale(.97); }
.pfm-button.is-done { background: var(--teal); }

.pfm-pointer { position: absolute; z-index: 10; top: 0; left: 0; width: 16px; height: 22px; opacity: 0; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); transform-origin: 1.5px 1.5px; }
.pfm-pointer path { fill: #10161c; stroke: #fff; stroke-width: 1.3; stroke-linejoin: round; }
.pfm-ripple { position: absolute; z-index: 9; top: -18px; left: -18px; width: 36px; height: 36px; border: 2px solid var(--teal-light); border-radius: 50%; opacity: 0; pointer-events: none; }

/* Narrow window: viewport on top, the three sliders in a row underneath. */
@container (max-width: 600px) {
  .pfm-body { grid-template-columns: minmax(0, 1fr); aspect-ratio: auto; }
  .pfm-view { aspect-ratio: 1.45; }
  .pfm-panel { padding: 12px 12px 12px; border-top: 1px solid var(--line-soft); border-left: 0; }
  .pfm-head, .pfm-rules, .pfm-stats { display: none; }
  .pfm-params { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .pfm-param-label { font-size: 10px; }
  .pfm-param-value { font-size: 10px; }
  .pfm-button { min-height: 34px; margin-top: 10px; font-size: 11px; }
  .pfm-url { display: none; }
  .pfm-bar { justify-content: space-between; }
  .pfm-prompt { top: 10px; left: 10px; right: 10px; min-height: 30px; padding: 5px 7px 5px 9px; font-size: 10.5px; }
  .pfm-z { left: 10px; bottom: 10px; }
  .pfm-file { right: 10px; bottom: 10px; }
  .pfm-file-meta { display: none; }
}
@container (max-width: 400px) {
  .pfm-steps li:not(.is-active) span { display: none; }
  .pfm-params { gap: 8px; }
  .pfm-param { grid-template-columns: minmax(0, 1fr); }
  .pfm-param-value { grid-row: 2; }
  .pfm-ai { display: none; }
}

@media (max-width: 1120px) {
  .print-film { top: 290px; right: 0; width: calc(100% - 20px); }
}
@media (max-width: 760px) {
  .hero-visual { height: auto; padding: 22px 0 34px; }
  .print-film { position: relative; top: auto; right: auto; width: 100%; }
  .print-film::before { inset: -8px -8px 12px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pfm-prompt.is-typing .pfm-caret { animation: none; }
}
