/* InkGuru.pl - podstrona /wizualizacja.html
   Ładowana tylko na tej podstronie. Korzysta z tokenów i klas z styles.css,
   niczego w nich nie nadpisuje (wszystkie nowe klasy mają prefiks viz-). */

/* Ukryte elementy narzędzia zawsze niewidoczne (nawet gdy mają własne display) */
.viz-intro [hidden], .viz [hidden] { display: none !important; }

/* ---------- Intro + 3 kroki ---------- */
.viz-intro { padding-block: clamp(36px, 6vw, 72px) clamp(32px, 5vw, 56px); }
.viz-intro__title { max-width: 22ch; }
.viz-howto { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.viz-howto li { display: grid; grid-template-columns: 48px 1fr; gap: 16px; align-items: start; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-bottom: 4px solid var(--brand); }
.viz-howto__num { display: grid; place-items: center; width: 48px; height: 48px; background: var(--ink-block); color: var(--on-ink-block); font-weight: 800; font-size: 1.375rem; }
.viz-howto h2 { font-size: 1.125rem; font-weight: 750; letter-spacing: -0.01em; }
.viz-howto p { margin-top: 4px; color: var(--muted); font-size: .975rem; }
.viz-privacy { margin-top: 20px; display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .9375rem; max-width: 70ch; }
.viz-privacy i { font-size: 20px; color: var(--brand-text); flex-shrink: 0; margin-top: 1px; }
@media (max-width: 760px) {
  .viz-howto { grid-template-columns: 1fr; gap: 10px; }
  .viz-howto li { padding: 14px 16px; grid-template-columns: 40px 1fr; gap: 14px; }
  .viz-howto__num { width: 40px; height: 40px; font-size: 1.125rem; }
}

/* ---------- Układ narzędzia ---------- */
.viz { padding-block: clamp(28px, 5vw, 64px); }
.viz__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: clamp(20px, 3vw, 40px); align-items: start; }
.viz__stage-wrap { position: sticky; top: calc(var(--nav-h) + 16px); display: grid; gap: 12px; justify-items: center; }
@media (max-width: 960px) {
  .viz__grid { grid-template-columns: 1fr; }
  .viz__stage-wrap { position: static; }
}

/* ---------- Podgląd (scena) ---------- */
.viz-stage {
  position: relative; width: 100%; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 8px solid var(--brand);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
}
.viz-stage.has-wall { border: 0; border-bottom: 8px solid var(--brand); background: var(--ink-block); }
/* Gdy jest grafika, przeciąganie po podglądzie przesuwa ją, więc wyłączamy przewijanie gestem na samym podglądzie. */
.viz-stage.has-art { touch-action: none; }
.viz-stage.is-moving { cursor: grabbing; }
.viz-stage.can-move { cursor: grab; }

.viz-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: clamp(40px, 8vw, 96px) 20px; min-height: min(62vh, 520px); align-content: center; }
.viz-empty > i { font-size: 56px; color: var(--brand-text); }
.viz-empty__title { font-size: clamp(1.375rem, 2.4vw, 1.75rem); font-weight: 800; letter-spacing: -0.02em; }
.viz-empty__hint { color: var(--muted); }
.viz-empty__actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.viz-canvas { display: block; width: 100%; height: auto; }
.viz-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.viz-overlay polygon { fill: color-mix(in srgb, var(--brand) 10%, transparent); stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 8 6; }
.viz-stage.has-art .viz-overlay polygon { fill: none; }
.viz-stage.is-invalid .viz-overlay polygon { stroke: var(--error); fill: color-mix(in srgb, var(--error) 12%, transparent); }

/* Uchwyty narożników: duże pole dotyku (52 px), widoczny kwadrat 24 px */
.viz-handle {
  position: absolute; left: 0; top: 0; width: 52px; height: 52px; margin: -26px 0 0 -26px; padding: 0;
  background: none; border: 0; cursor: grab; touch-action: none; z-index: 3;
}
.viz-handle::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  background: var(--brand); border: 3px solid var(--ink-block); box-shadow: 0 0 0 2px #fff, 0 2px 8px rgb(0 0 0 / .45);
  transition: transform .15s var(--ease);
}
.viz-handle:hover::before, .viz-handle.is-active::before { transform: scale(1.2); }
.viz-handle.is-active { cursor: grabbing; }
.viz-handle:focus-visible { outline: none; }
.viz-handle:focus-visible::before { outline: 3px solid #fff; outline-offset: 3px; }
@media (pointer: coarse) {
  .viz-handle { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  .viz-handle::before { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
}
.viz-stage.hide-guides .viz-handle, .viz-stage.hide-guides .viz-overlay { display: none; }

/* Lupa przy przeciąganiu narożnika (palec zasłania róg) */
.viz-loupe {
  position: absolute; top: 10px; left: 10px; width: 120px; height: 120px; z-index: 4; pointer-events: none;
  border: 3px solid var(--ink-block); box-shadow: 0 0 0 2px #fff, 0 6px 20px rgb(0 0 0 / .4); background: var(--ink-block);
}
.viz-loupe.is-right { left: auto; right: 10px; }

/* Porównanie przed/po */
.viz-compare { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; z-index: 2; pointer-events: none; }
.viz-compare::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: #fff; box-shadow: 0 0 6px rgb(0 0 0 / .5); }
.viz-compare__tag {
  position: absolute; top: 10px; padding: 4px 10px; font-size: .8125rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  background: var(--ink-block); color: var(--on-ink-block); white-space: nowrap;
}
.viz-compare__tag--before { right: 8px; }
.viz-compare__tag--after { left: 8px; background: var(--brand); color: var(--on-brand); }

.viz-stage__hint { font-size: .9375rem; color: var(--muted); max-width: 70ch; justify-self: start; }
.viz-warn { justify-self: start; font-weight: 650; color: var(--error); }

/* ---------- Panel ustawień ---------- */
.viz-panel { display: grid; gap: 14px; }
.viz-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.viz-block { margin: 0; min-width: 0; padding: 18px 20px 20px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px; }
.viz-block__title { padding: 0; display: flex; align-items: center; gap: 10px; font-size: 1.125rem; font-weight: 750; letter-spacing: -0.01em; line-height: 1.2; float: left; width: 100%; }
.viz-block__title + * { clear: both; }
.viz-block__title span { display: grid; place-items: center; width: 28px; height: 28px; background: var(--ink-block); color: var(--on-ink-block); font-size: .9375rem; font-weight: 800; flex-shrink: 0; }
.viz-block[disabled] { opacity: .5; }
.viz-block[disabled] .photos { cursor: not-allowed; }
.viz-row { display: flex; flex-wrap: wrap; gap: 8px; }
.viz-row .btn { padding: .65em 1em; font-size: .9375rem; }
.viz-note { font-size: .9375rem; color: var(--muted); }
.viz-note--rights { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; }
.viz-note--rights i { font-size: 18px; color: var(--brand-text); flex-shrink: 0; margin-top: 1px; }
.viz-check label { font-size: .9375rem; }
.viz-check label strong { color: var(--ink); }
.viz-block .photos { padding: 14px 16px; }
.viz-block:has(.viz-file:focus-visible) .photos { outline: 3px solid var(--brand); outline-offset: 3px; }
.viz-panel > .viz-block:first-of-type:has(.viz-file:focus-visible) { outline: none; }
.viz-panel:has(#viz-wall-file:focus-visible) #viz-wall-btn,
.viz-panel:has(#viz-wall-camera:focus-visible) .viz-block .viz-camera { outline: 3px solid var(--brand); outline-offset: 3px; }

.viz-range { display: grid; gap: 6px; }
.viz-range label { display: flex; justify-content: space-between; gap: 12px; font-weight: 650; font-size: .9375rem; }
.viz-range output { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.viz-range input[type="range"] { width: 100%; margin: 0; height: 32px; accent-color: var(--brand); cursor: pointer; }
.viz-block[disabled] input[type="range"] { cursor: not-allowed; }

.viz-download { width: 100%; }
.viz-download[disabled] { opacity: .5; cursor: not-allowed; }
.viz-download__hint { margin-top: -6px; text-align: center; }

/* Aparat ma sens tylko na urządzeniach dotykowych (na komputerze to zwykły wybór pliku) */
@media (pointer: fine) { .viz-camera { display: none; } }

/* ---------- Pasek z wyceną (styl jak pasek z ceną na stronie głównej) ---------- */
.viz-cta__title { font-size: clamp(2rem, 4.4vw, 3.5rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; color: var(--on-ink-block); max-width: 12ch; }
