/* Bramka (okładka teczki), katalog, karty dokumentów, podgląd i kartka do druku. */

/* Jednorazowe zaproszenie od przewodnika; żadnej blokady oglądania. */
body.film-reminder-open { overflow: hidden; }
dialog.film-reminder { width: min(520px, calc(100% - 32px)); height: auto; max-height: calc(100dvh - 32px); padding: 10px; margin: auto; border: 0; border-radius: 0; background: transparent; overflow: auto; }
dialog.film-reminder[open] { display: flex; align-items: center; animation: film-guide-enter .3s ease-out; }
dialog.film-reminder::backdrop { background: #08142d9c; backdrop-filter: blur(5px); }
.film-reminder-bubble { position: relative; width: 100%; padding: 30px; border: 1px solid var(--line-strong); border-radius: 26px; background: var(--sheet); text-align: center; box-shadow: 0 20px 45px #0003; }
.film-reminder-bubble::after { content: ''; position: absolute; bottom: -12px; left: calc(50% - 12px); width: 24px; height: 24px; background: var(--sheet); transform: rotate(45deg); border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.film-reminder-close { position: absolute; right: 6px; top: 5px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 28px; }
.film-reminder-kicker { margin: 5px 10px 14px; color: var(--navy-3); font-size: .75rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.film-reminder-bubble h2 { font-size: clamp(1.6rem, 5vw, 2.1rem); line-height: 1.15; }
.film-reminder-bubble h2 span { white-space: nowrap; color: var(--navy-3); }
#film-reminder-description { margin-top: 16px; line-height: 1.6; color: var(--muted); }
.film-reminder-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.film-reminder-actions .btn { min-height: 46px; }
.film-reminder-mascot { display: block; flex-shrink: 0; width: min(230px, 55vw); height: auto; margin-top: 30px; filter: drop-shadow(0 12px 18px #0003); }
.film-reminder button:focus-visible { outline: 3px solid var(--navy-3); outline-offset: 3px; }
@keyframes film-guide-enter { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .film-reminder-bubble { padding: 28px 18px 24px; } .film-reminder-actions { flex-direction: column; } .film-reminder-actions .btn { justify-content: center; } }
@media (max-height: 600px) { .film-reminder-mascot { width: 130px; margin-top: 20px; } .film-reminder-bubble { padding: 20px; } .film-reminder-kicker { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { dialog.film-reminder[open] { animation: none; } }
@media print { dialog.film-reminder { display: none !important; } }

/* Okładka: list w pierwszej osobie po lewej, zamek po prawej */
.gate {
  max-width: 1450px;
  margin: auto;
  padding: clamp(36px, 6vw, 88px) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .85fr);
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
  min-height: calc(100svh - 64px);
}
.gate h1 { font-size: clamp(2.5rem, 3.9vw, 4.4rem); }
.gate h1 span { display: block; font-style: italic; font-weight: 650; letter-spacing: -.025em; color: var(--navy-3); margin-top: 8px; font-size: .78em; }
.gate .lead { max-width: 580px; }
.gate-sign { margin-top: 26px; display: flex; flex-direction: column; gap: 2px; }
.gate-sign strong { font-style: italic; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.gate-sign small { color: var(--muted); font-size: .8125rem; font-weight: 650; }
.gate-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; max-width: 540px; }
.gate-categories span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border: 1px solid var(--line); background: var(--sheet); border-radius: 10px; font-size: .8125rem; font-weight: 700; }
.gate-categories b { color: var(--minia-ink); font-weight: 800; font-size: .72rem; font-variant-numeric: tabular-nums; }

.gate-card { background: var(--sheet); border: 1px solid var(--line); border-radius: 26px; padding: 32px; box-shadow: 0 1px 0 #fff inset, 0 30px 70px -40px #12060a66; }
.lock-mark { height: 46px; width: 46px; border: 1px solid var(--line); background: var(--paper-2); color: var(--navy); border-radius: 13px; display: grid; place-items: center; margin-bottom: 26px; }
.lock-mark svg { width: 23px; height: 23px; }
.gate-card h2 { font-size: 1.75rem; }
.gate-card > p:not(.eyebrow) { font-size: .9375rem; color: var(--muted); margin-top: 12px; }
.gate-card form { margin-top: 24px; }
.gate-card label { display: block; font-weight: 800; font-size: .875rem; margin-bottom: 8px; }
.password-wrap { display: flex; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; overflow: hidden; }
.password-wrap:focus-within { outline: 3px solid var(--sky-2); outline-offset: 1px; border-color: var(--navy-3); }
.password-wrap input { padding: 14px 12px; min-width: 0; flex: 1; width: 100%; border: 0; background: transparent; font-size: 16px; border-radius: 0; color: var(--ink); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.password-wrap input:focus { outline: none; }
.password-wrap button { border: 0; background: transparent; font-size: .8125rem; font-weight: 800; padding: 12px 14px; min-height: 48px; color: var(--navy-3); }
.gate-card small { display: block; font-size: .75rem; color: var(--muted); margin-top: 8px; }
.gate-card #unlock { width: 100%; margin-top: 20px; }
.gate-card .privacy-note { padding-top: 20px; border-top: 1px solid var(--line); margin-top: 26px !important; font-size: .8125rem !important; }
.error { padding: 12px 15px; border: 1px solid #e3a08c; background: #fbe4dc; border-radius: 10px; color: #8a2a12; font-size: .875rem; font-weight: 700; margin-top: 14px; }

/* Nagłówek teczki i etykieta */
.page-heading h1 { font-size: clamp(2.5rem, 4vw, 4rem); }
.index-mark {
  position: relative;
  width: 138px;
  padding: 26px 12px 16px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center;
  font-size: 2.3rem; font-weight: 900; letter-spacing: -.08em; line-height: 1;
  color: var(--navy);
  transform: rotate(4deg);
  transform-origin: 50% 13px;
  flex-shrink: 0;
  box-shadow: 0 1px 0 #fff inset, 0 2px 4px -2px #12060a33, 0 22px 40px -22px #12060a99;
}
/* Etykieta wisi na żółtym sznurku spod paska u góry; węzełek w dziurce, po najechaniu kołysze się wokół dziurki */
.index-hanger { position: relative; align-self: flex-start; margin-top: -44px; display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.index-string { position: relative; z-index: 1; display: block; width: 3px; height: 122px; margin-bottom: -14px; border-radius: 1px; background: linear-gradient(180deg, #f2c94c, var(--sun) 60%, #e2ac2a); box-shadow: 1px 0 0 #ffffff55; }
.index-string::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe68a, var(--sun) 55%, #d9a324); box-shadow: 0 1px 2px #12060a66; }
.index-hanger:hover .index-mark { animation: tag-swing 1.9s cubic-bezier(.25, .7, .35, 1) 1; }
@keyframes tag-swing { 0% { transform: rotate(4deg); } 22% { transform: rotate(-7deg); } 50% { transform: rotate(9deg); } 76% { transform: rotate(1deg); } 100% { transform: rotate(4deg); } }
.index-mark::before { content: ""; position: absolute; top: 9px; left: 50%; width: 9px; height: 9px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--paper); }
.index-mark > span { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 800; color: var(--muted); margin-top: 10px; white-space: nowrap; }

.overview-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 52px; }
.counts { display: flex; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.counts span + span::before { content: "·"; color: var(--minia); margin: 0 10px; font-weight: 900; }
.overview-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-intro { max-width: 740px; color: var(--ink-2); font-size: 1.0625rem; margin-top: 0; padding-left: 2px; }

/* Karty: filmy i dokumenty */
.film-grid, .doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.film-featured { grid-column: span 2; }
.film-card, .doc-card { min-width: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 0 #fff inset, 0 2px 4px -2px #12060a2e, 0 18px 40px -24px #12060a73; }
.film-thumb, .doc-thumb { padding: 0; border: 0; position: relative; width: 100%; display: block; background: var(--paper-2); overflow: hidden; text-align: left; }
.film-thumb { aspect-ratio: 16/9; }
.film-thumb > img { width: 100%; height: 100%; object-fit: cover; }
.film-featured .film-thumb { aspect-ratio: 2.15; }
.film-thumb img, .doc-thumb img { transition: opacity .25s ease; }
.film-thumb img:not(.loaded), .doc-thumb img:not(.loaded) { opacity: 0; }
.play { position: absolute; left: 18px; bottom: 18px; display: grid; place-items: center; width: 48px; height: 48px; background: var(--minia); border: 2px solid #ffffff99; border-radius: 50%; color: var(--ink); transition: transform .15s; box-shadow: 0 8px 20px -8px #12060a99; }
.play svg { margin-left: 3px; width: 21px; height: 21px; fill: currentColor; stroke: none; }
.film-thumb:hover .play { transform: scale(1.08); }
.duration { position: absolute; bottom: 18px; right: 18px; font-size: .75rem; font-weight: 800; line-height: 1; background: var(--navy); color: var(--paper); border-radius: 6px; padding: 8px; font-variant-numeric: tabular-nums; }
.card-body { padding: 22px; display: flex; flex-direction: column; align-items: flex-start; flex: 1; gap: 10px; }
.card-body h3 { line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.card-description { font-size: .9375rem; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.card-body > .btn { margin-top: auto; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; }
.doc-thumb { height: 214px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: center; padding: 18px 26px 0; }
.doc-thumb > img { width: 100%; height: auto; object-fit: cover; object-position: top; box-shadow: 0 8px 22px -10px #12060a66; min-height: 80px; background: #fff; }
.thumb-hint { position: absolute; display: flex; align-items: center; gap: 8px; bottom: 13px; left: 50%; transform: translateX(-50%); white-space: nowrap; border: 1px solid var(--line-strong); background: var(--sheet); padding: 8px 12px; border-radius: 10px; font-size: .75rem; font-weight: 800; box-shadow: 0 3px 12px #12060a22; opacity: 0; transition: opacity .15s; }
.doc-thumb:hover .thumb-hint, .doc-thumb:focus-visible .thumb-hint { opacity: 1; }
.badge { background: var(--sun); color: var(--ink); font-size: .72rem; font-weight: 800; padding: 4px 9px; border-radius: 6px; margin: 2px 0; letter-spacing: .01em; }
.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.project-link { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); text-decoration: none; transition: border-color .15s, background .15s; }
.project-link:hover { border-color: var(--navy-3); background: #fff; }
.project-link strong { display: block; font-size: .9375rem; font-weight: 800; }
.project-link small { display: block; font-size: .8125rem; color: var(--muted); margin-top: 3px; }
.project-link > svg { color: var(--minia-ink); width: 16px; height: 16px; }
.landscape { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.landscape .doc-thumb { height: auto; aspect-ratio: 16/10; padding: 12px; align-items: center; }
.landscape .doc-thumb > img { max-height: 100%; object-fit: contain; box-shadow: none; background: transparent; }
.finance-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--navy); border-radius: 16px; color: var(--paper); padding: 26px 28px; margin-bottom: 22px; gap: 22px; }
.finance-strip > div + div { border-left: 1px solid #ffffff22; padding-left: 22px; }
.finance-strip small { display: block; font-size: .8125rem; font-weight: 700; color: var(--navy-soft); margin-bottom: 8px; }
.finance-strip strong { display: block; font-size: clamp(1.35rem, 1.9vw, 1.9rem); font-weight: 900; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.source-files { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; margin-top: 22px; }
.source-files summary { padding: 19px 22px; cursor: pointer; font-weight: 800; font-size: .9375rem; min-height: 54px; }
.source-list { padding: 0 22px; }
.source-row { padding: 18px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.source-row > div:first-child { min-width: 0; }
.source-row strong { display: block; font-size: .875rem; font-weight: 800; }
.source-row small { font-size: .75rem; display: block; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.source-row .card-actions { flex-shrink: 0; padding: 0; margin: 0; }

/* Podgląd dokumentu i filmu */
.modal-open { overflow: hidden; }
dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; width: min(1120px, calc(100% - 48px)); max-width: none; height: calc(100dvh - 48px); max-height: none; margin: auto; background: var(--paper); color: var(--ink); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #12060ab8; backdrop-filter: blur(3px); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--sheet); padding: 18px 24px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.viewer-head > div { min-width: 0; }
.viewer-head h2 { font-size: 1.125rem; line-height: 1.35; overflow-wrap: anywhere; letter-spacing: -.015em; }
.viewer-head p { font-size: .75rem; font-weight: 700; color: var(--muted); margin-top: 5px; }
.viewer-head > .btn { flex-shrink: 0; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--sheet-2); flex-shrink: 0; }
.doc-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.film-quality { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .875rem; font-weight: 800; }
.film-quality select { min-height: 44px; max-width: 100%; padding: 8px 28px 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sheet); color: var(--ink); font: inherit; }
.film-quality select:focus-visible { outline: 3px solid var(--navy-3); outline-offset: 2px; }
.doc-controls .btn svg, .viewer-head .btn svg { width: 18px; height: 18px; }
.btn-icon { padding-left: 11px; padding-right: 11px; }
.pager, .zoom-group { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--sheet); overflow: hidden; }
.pager .btn, .zoom-group .btn { border: 0; border-radius: 0; min-width: 44px; background: transparent; }
.pager .btn:hover:not(:disabled), .zoom-group .btn:hover:not(:disabled) { background: #fff; }
.pager > span, .zoom-group > span { display: flex; align-items: center; justify-content: center; padding: 0 14px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); font-size: .8125rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.zoom-group > span { min-width: 5.5ch; padding: 0 10px; }
.viewer-stage { flex: 1; overflow: auto; min-height: 0; padding: 24px; overscroll-behavior: contain; text-align: center; -webkit-overflow-scrolling: touch; background: var(--paper-2); touch-action: pan-x pan-y; }
.page-image { display: block; max-width: 100%; width: auto; height: auto; max-height: none; margin: 0 auto; box-shadow: 0 10px 34px -14px #12060a80; background: #fff; }
.viewer-stage.zoomed { cursor: grab; }
.viewer-stage.dragging { cursor: grabbing; user-select: none; }
/* Film: okno dopasowuje się do proporcji nagrania zamiast zostawiać czarne pasy; pion ogranicza wysokość, poziom szerokość */
dialog.film { height: fit-content; max-height: calc(100dvh - 48px); }
.video-stage { flex: 0 1 auto; background: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; }
.video-stage video { display: block; width: 100%; height: auto; max-height: calc(100dvh - 48px - 150px); aspect-ratio: 16 / 9; object-fit: contain; background: var(--ink); }
dialog.film[data-orientation="pion"] .video-stage video { width: auto; max-width: 100%; height: calc(100dvh - 48px - 150px); }
.viewer-stage .loading { color: var(--muted); padding: 48px 0; font-weight: 700; }
.viewer-toolbar + .error { margin: 10px 24px; flex-shrink: 0; }
.print-sheet { display: none; }

@media (min-width: 1800px) { .film-grid, .doc-grid { gap: 24px; } .card-body { padding: 26px; } .doc-thumb { height: 240px; } }
@media (max-width: 1250px) {
  .gate { grid-template-columns: 1fr; max-width: 850px; align-items: start; gap: 30px; }
  .gate h1 br { display: none; }
  .gate-card { max-width: 560px; }
  .gate-categories { max-width: none; }
  .film-grid, .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .film-featured { grid-column: span 2; }
  .film-featured .film-thumb { aspect-ratio: 16/8; }
  .finance-strip { padding: 22px; gap: 16px; }
  .finance-strip strong { font-size: 1.35rem; }
  .overview-actions { width: 100%; }
}
@media (max-width: 920px) {
  .finance-strip { grid-template-columns: 1fr; gap: 14px; }
  .finance-strip > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
  .finance-strip > div + div { border-left: 0; padding-left: 0; border-top: 1px solid #ffffff22; padding-top: 14px; }
  .finance-strip small { margin: 0; }
  .source-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .gate h1 { font-size: 3rem; }
}
@media (max-width: 760px) {
  .locked .gate { min-height: 0; }
  .gate { padding: 26px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); gap: 26px; }
  .gate h1 { font-size: clamp(2.2rem, 8vw, 3.3rem); }
  .gate-card { max-width: none; padding: 22px; border-radius: 20px; }
  .gate .lead { margin-top: 18px; }
  .gate-sign { margin-top: 20px; }
  .gate-categories { margin-top: 20px; gap: 7px; }
  .gate-categories span { font-size: .75rem; padding: 6px 10px 6px 9px; }
  .gate-card small, .gate-card .privacy-note { font-size: .8125rem; }
  .page-heading h1 { font-size: clamp(2.2rem, 7.4vw, 3.5rem); }
  .overview-tools { margin-bottom: 36px; padding: 18px 0; gap: 18px; }
  .overview-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .overview-actions .btn { font-size: .8125rem; padding: 10px; }
  .counts span + span::before { margin: 0 8px; }
  .film-grid, .doc-grid { gap: 12px; }
  .card-body { padding: 16px; gap: 8px; }
  .card-body h3 { font-size: 1rem; }
  .card-description { font-size: .875rem; }
  .card-meta { font-size: .68rem; }
  .film-featured .film-thumb { aspect-ratio: 16/9; }
  .film-card .btn { padding-left: 0; }
  .doc-thumb { height: 180px; padding: 12px 12px 0; }
  .thumb-hint { opacity: 1; font-size: .7rem; padding: 6px 9px; }
  .thumb-hint svg { width: 15px; height: 15px; }
  .card-actions { gap: 3px; }
  .card-actions .btn { padding: 8px; font-size: .75rem; }
  .card-actions .btn svg { width: 16px; height: 16px; }
  .link-grid { grid-template-columns: 1fr; margin: 18px 0; gap: 9px; }
  .project-link { padding: 16px; }
  .section-intro { font-size: .9375rem; }
  .section-heading { margin-bottom: 18px; }
  .section-heading h2 { padding: 12px 18px 13px; font-size: 1.5rem; margin-bottom: 12px; border-radius: 0 0 13px 13px; }
  .index-hanger { display: none; }
  .finance-strip strong { font-size: 1.375rem; }
  .finance-strip small { font-size: .75rem; }
  .landscape { grid-template-columns: 1fr; }
  .landscape .doc-thumb { aspect-ratio: 16/9; }
  .source-files summary { padding: 17px; font-size: .875rem; }
  .source-list { padding: 0 17px; }
  .source-row .card-actions .btn { padding: 9px 12px; }
  .topbar .btn { padding: 8px 10px; font-size: .8125rem; }
  .viewer-toolbar { justify-content: flex-start; }
  /* Pierwsze wejście na telefonie: zamek na wierzchu, list pod nim; pigułki kategorii zbędne, bo po otwarciu jest pasek */
  .gate-card { order: -1; }
  .gate-categories { display: none; }
  .gate h1 { font-size: clamp(2rem, 7.5vw, 2.8rem); }
  .overview-actions .btn:not(.btn-primary) { display: none; }
  .overview-actions { grid-template-columns: 1fr; }
  dialog { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; margin: 0; }
  .viewer-head { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); gap: 12px; }
  .viewer-head h2 { font-size: 1rem; }
  .viewer-head p { font-size: .72rem; }
  .viewer-head .btn { font-size: .75rem; padding: 8px; }
  .viewer-toolbar { padding: 8px 12px; gap: 8px; }
  .doc-controls { gap: 5px; }
  .doc-controls .btn { padding: 8px 10px; }
  .viewer-stage { padding: 12px 8px max(12px, env(safe-area-inset-bottom)); }
  .viewer-stage.video-stage { padding: 0; }
  dialog.film { height: 100dvh; max-height: 100dvh; }
  dialog.film .video-stage { flex: 1; }
  .video-stage video, dialog.film[data-orientation="pion"] .video-stage video { width: 100%; height: 100%; max-height: 100%; aspect-ratio: auto; }
  .viewer-toolbar + .error { margin: 8px 12px; }
  #viewer-download > .btn { font-size: .75rem; padding: 8px 11px; }
}
@media (max-width: 430px) {
  .doc-grid, .film-grid { grid-template-columns: 1fr; }
  .film-featured { grid-column: auto; }
  .doc-thumb { height: 220px; padding: 16px 28px 0; }
  .card-body { padding: 20px; }
  .card-body h3 { font-size: 1.1rem; }
  .card-description { font-size: .875rem; }
  .card-actions .btn { font-size: .8125rem; padding: 10px 13px; }
  .overview-actions { grid-template-columns: 1fr; }
  .gate-card { padding: 23px; }
  .gate h1 { font-size: 2.45rem; }
  .gate .lead { font-size: .9375rem; }
  .counts { font-size: .75rem; }
  .finance-strip { padding: 20px 18px; }
  .finance-strip strong { font-size: 1.23rem; }
  .finance-strip small { max-width: 140px; }
  .viewer-head { padding-left: 12px; padding-right: 12px; }
  .viewer-head h2 { font-size: .9375rem; }
  .viewer-head .btn { min-width: 74px; }
  .source-row { gap: 12px; }
  .topbar > span { max-width: 170px; line-height: 1.25; }
  .gate-categories { gap: 6px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  dialog { width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .viewer-head { padding: 7px 14px; }
  .viewer-head p { display: none; }
  .viewer-toolbar { padding: 5px 14px; }
  .viewer-stage { padding: 8px; }
  .gate { min-height: 0; }
}
@media (pointer: coarse) { .thumb-hint { opacity: 1; } }

/* Odtwarzacz zajmuje pozostałą wysokość, niezależnie od proporcji filmu. */
.doc-options { position: relative; margin-left: auto; }
.doc-options > summary { display: none; list-style: none; }
.doc-options > summary::-webkit-details-marker { display: none; }
.doc-options-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#doc-download { display: flex; flex-wrap: wrap; gap: 8px; }
#viewer-download:empty, dialog.film .doc-options { display: none; }
/* Okno filmu bierze wysokość z nagrania (fit-content wyżej w pliku); pełną wysokość dostaje tylko telefon w bloku poniżej */
dialog.film .video-stage { position: relative; flex: 0 1 auto; min-height: 0; padding: 0; }
dialog.film .viewer-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
#film-controls { display: flex; flex-wrap: nowrap; min-width: 0; gap: 12px; }
.film-variants { display: flex; flex-shrink: 0; gap: 4px; }
.film-variants .btn { min-width: 60px; min-height: 44px; justify-content: center; }
.film-quality { display: block; min-width: 0; }
.film-quality select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.film-original svg { width: 18px; height: 18px; flex-shrink: 0; }
@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  #viewer .viewer-head { padding: max(8px, env(safe-area-inset-top)) 12px 8px; gap: 10px; }
  #viewer .viewer-head h2 { font-size: .9375rem; line-height: 1.25; }
  #viewer .viewer-head p { margin-top: 3px; font-size: .75rem; }
  #viewer #close-viewer { width: 44px; min-width: 44px; height: 44px; padding: 10px; justify-content: center; }
  #viewer #close-viewer span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #viewer:not(.film) .viewer-toolbar { flex-wrap: nowrap; gap: 8px; padding: 6px 12px; }
  #doc-controls { flex-wrap: nowrap; gap: 8px; min-width: 0; }
  #page-number { min-width: 42px; padding: 0 4px; font-size: .875rem; }
  #viewer .pager .btn, #viewer .zoom-group .btn { width: 44px; min-width: 44px; min-height: 44px; padding: 10px; }
  #zoom-level { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .doc-options > summary { display: flex; min-width: 44px; min-height: 44px; padding: 10px; justify-content: center; }
  .doc-options > summary svg { width: 20px; height: 20px; }
  .doc-options-panel { position: absolute; top: calc(100% + 8px); right: 0; width: min(290px, calc(100vw - 24px)); padding: 12px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--sheet); box-shadow: 0 10px 32px #12060a30; z-index: 2; }
  .doc-options-panel .btn { font-size: .875rem; min-height: 44px; }
  #viewer:not(.film) .viewer-stage { padding-top: 6px; }
  dialog.film { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  dialog.film .viewer-head { padding: max(8px, env(safe-area-inset-top)) 12px 8px; gap: 10px; }
  dialog.film .viewer-head h2 { font-size: 1rem; line-height: 1.25; }
  dialog.film .viewer-head p { margin-top: 3px; font-size: .75rem; }
  dialog.film #close-viewer { width: 44px; min-width: 44px; height: 44px; padding: 10px; justify-content: center; }
  dialog.film #close-viewer span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  dialog.film .viewer-toolbar { gap: 8px; padding: 6px 12px; }
  #film-controls { gap: 8px; }
  .film-variants .btn { min-width: 52px; padding: 8px; font-size: .875rem; }
  .film-quality { flex: 1; }
  .film-quality select { min-height: 44px; padding: 8px 20px 8px 8px; font-size: .875rem; }
  #viewer-download > .film-original { width: 44px; min-height: 44px; padding: 10px; justify-content: center; }
  .film-original span { display: none; }
  dialog.film .video-stage { margin-bottom: env(safe-area-inset-bottom); }
}

/* Zrzuty produktu: duże kadry, bez przycinania interfejsu. */
.product-gallery { margin: 0 0 48px; padding: clamp(16px, 2.5vw, 28px); border: 1px solid var(--line); border-radius: 22px; background: var(--sheet); }
.intro-film { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(240px,1fr); margin: 24px 0 32px; }
.intro-film .film-thumb { height: 100%; min-height: 240px; }
.intro-film .card-body { justify-content: center; }
@media (max-width: 760px) { .intro-film { grid-template-columns: minmax(0,1fr); } .intro-film .film-thumb { min-height: 0; } }

/* Nowy film PodTeksT: jedna duża karta, dwa formaty w odtwarzaczu. */
.film-spotlight { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(260px,1fr); margin-bottom: 24px; border-color: var(--navy); background: var(--navy); }
.film-spotlight .film-thumb { align-self: center; aspect-ratio: 16/9; background: var(--navy); }
.film-spotlight .film-thumb > img { object-fit: contain; }
.film-spotlight .card-body { justify-content: center; padding: clamp(24px,3vw,40px); gap: 16px; color: var(--paper); }
.film-spotlight .card-body h3 { color: var(--paper); font-size: clamp(1.65rem,2.3vw,2.6rem); line-height: 1.12; letter-spacing: -.035em; }
.film-spotlight .card-meta { color: var(--sun); }
.film-spotlight .card-description { color: #e2e5ed; }
.film-spotlight .card-body > .btn { margin-top: 8px; min-height: 46px; }
@media (max-width: 1100px) { .film-spotlight { grid-template-columns: minmax(0,1fr); } .film-spotlight .card-body { padding: 24px; } }
.gallery-toggle { cursor: pointer; padding: 8px 0; min-height: 44px; font-size: 1.15rem; font-weight: 850; color: var(--navy); }
.gallery-toggle-hint { display: block; padding-top: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.gallery-cover { margin-bottom: 24px; }
.gallery-more { border-top: 1px solid var(--line); padding-top: 12px; }
.gallery-more[open] > .gallery-toggle { margin-bottom: 24px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.gallery-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.gallery-heading > div { min-width: 0; max-width: 640px; }
.gallery-heading h3 { font-size: clamp(1.5rem, 2.8vw, 2.25rem); line-height: 1.2; margin: 8px 0 12px; }
.gallery-heading > .btn { flex-shrink: 0; }
.gallery-intro { font-size: .9375rem; line-height: 1.6; color: var(--muted); }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 20px; }
.gallery-card { min-width: 0; }
.gallery-featured { grid-column: 1 / -1; }
.gallery-nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 0 0 24px; }
.gallery-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--navy); text-decoration: none; font-size: .8125rem; font-weight: 800; }
.gallery-nav a:hover { background: var(--paper); border-color: var(--line-strong); }
.gallery-nav a span { opacity: .6; font-variant-numeric: tabular-nums; }
.gallery-group { scroll-margin-top: 100px; }
.gallery-group + .gallery-group { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--line); }
.gallery-group-title { font-size: 1.125rem; font-weight: 900; margin: 0 0 18px; }
.gallery-thumb { position: relative; display: block; width: 100%; padding: 0; aspect-ratio: 16 / 9; border: 1px solid #ffffff18; background: #0a0a13; overflow: hidden; border-radius: 13px; box-shadow: 0 8px 22px -15px #12060a66; }
.gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.gallery-thumb img:not(.loaded) { opacity: 0; }
.gallery-hint { display: grid; place-items: center; position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; background: #ffffffed; color: var(--navy); border-radius: 10px; box-shadow: 0 2px 12px #0004; }
.gallery-hint svg { width: 18px; height: 18px; }
.gallery-body { display: flex; gap: 12px; margin-top: 13px; }
.gallery-number { font-size: .75rem; font-weight: 900; color: var(--minia-ink); padding-top: 3px; font-variant-numeric: tabular-nums; }
.gallery-body h5 { font-size: 1rem; font-weight: 850; line-height: 1.35; }
.gallery-body .badge { display: inline-block; margin-top: 6px; }
.gallery-body p { font-size: .8125rem; line-height: 1.5; color: var(--muted); margin-top: 4px; }
.gallery-viewer .viewer-stage { background: #0a0a13; }
.gallery-viewer .page-image { box-shadow: none; }
@media (max-width: 900px) { .gallery-heading { flex-direction: column; gap: 16px; } }
@media (max-width: 600px) {
  .product-gallery { margin-left: -6px; margin-right: -6px; padding: 14px; border-radius: 16px; }
  .gallery-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .gallery-featured { grid-column: auto; }
  .gallery-heading { margin-bottom: 22px; }
  .gallery-body { gap: 10px; }
}

/* Kartka z kodem: jedna strona A4, tusz na białym */
@page { size: A4; margin: 17mm; }
@media print {
  html, body { margin: 0; background: white; color: #12060a; font-size: 10pt; font-family: "Nunito", "Segoe UI", sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sidebar, .workspace, .skip, dialog, .toast { display: none !important; }
  .print-sheet { display: block; }
  .locked .print-sheet { display: none; }
  .print-kicker { display: flex; justify-content: space-between; font-size: 8.5pt; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; border-bottom: 1pt solid #071a52; padding-bottom: 10pt; margin-bottom: 22pt; }
  .print-kicker span:last-child { color: #5f5346; }
  .print-sheet h1 { font-size: 36pt; line-height: 1.06; font-weight: 900; letter-spacing: -.035em; }
  .print-intro { font-size: 10.5pt; line-height: 1.45; margin-top: 12pt; max-width: 400pt; }
  /* Scena z kartki PDF: kod QR jak zawieszka, obok przewodnik z PodTeksT i jego dymek */
  .print-scene { display: grid; grid-template-columns: 146pt minmax(0, 1fr); gap: 16pt; align-items: center; margin-top: 16pt; padding: 12pt 14pt 14pt; background: #f7efe0; border: 1pt solid #d9cbb0; border-radius: 12pt; }
  .print-qr-card { display: block; padding: 8pt; background: #fff; border: 1pt solid #c7b797; border-radius: 8pt; }
  .print-qr-card img { display: block; width: 130pt; height: 130pt; }
  .print-guide { position: relative; }
  .print-bubble { position: relative; margin: 0; padding: 10pt 12pt; background: #fff; border: 1pt solid #c7b797; border-radius: 10pt; font-size: 9.8pt; line-height: 1.4; font-weight: 600; color: #2b2620; }
  .print-bubble::after { content: ""; position: absolute; left: 72pt; bottom: -8pt; width: 14pt; height: 14pt; background: #fff; border-right: 1pt solid #c7b797; border-bottom: 1pt solid #c7b797; transform: rotate(45deg); }
  .print-mascot { display: block; width: 118pt; height: auto; margin: 10pt 0 0 20pt; }
  .print-address { display: block; margin-top: 2pt; font-size: 11pt; font-weight: 800; color: #1a46ad; text-decoration: none; }
  .print-password { position: relative; border: 1pt solid #c7b797; border-radius: 6pt; padding: 11pt 15pt 11pt 18pt; margin: 14pt 0 18pt; background: #fdf9f1; }
  .print-password::before { content: ""; position: absolute; left: 0; top: 7pt; bottom: 7pt; width: 3pt; background: #ff7b1c; }
  .print-password strong { font-size: 7.8pt; display: block; text-transform: uppercase; letter-spacing: .1em; color: #5f5346; }
  .print-password code { font-family: Consolas, monospace; display: block; font-size: 13.5pt; letter-spacing: .05em; margin: 4pt 0; }
  .print-password small { font-size: 8pt; color: #5f5346; }
  .print-inside { border-top: 1.2pt solid #071a52; }
  .print-inside h2 { display: inline-block; margin: 0; padding: 4pt 12pt 5pt; font-size: 13pt; font-weight: 900; color: #071a52; background: #f4ead8; border-bottom: 1.2pt solid #071a52; }
  .print-categories { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, auto); grid-auto-flow: column; gap: 9pt 22pt; margin-top: 12pt; }
  .print-categories > div { display: grid; grid-template-columns: 20pt 1fr; align-items: baseline; }
  .print-categories .n { font-size: 8.5pt; font-weight: 800; color: #c2540a; }
  .print-categories b { font-size: 10pt; }
  .print-categories p { grid-column: 2; font-size: 8.3pt; line-height: 1.4; margin-top: 2pt; color: #5f5346; }
  .print-note { font-size: 8pt; line-height: 1.5; margin-top: 16pt; padding-top: 10pt; border-top: 1pt solid #d9cbb0; color: #5f5346; }
}
/* Sąsiednie dokumenty: strzałki poza oknem podglądu na szerokim ekranie, pasek pod stroną na węższym i na telefonie */
.doc-steps { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--sheet-2); flex-shrink: 0; }
#doc-step-label { font-size: .75rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-step { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--sheet); color: var(--navy); cursor: pointer; transition: transform .25s cubic-bezier(.2, .8, .2, 1), background-color .2s, opacity .2s; }
.doc-step svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.doc-step:hover:not(:disabled) { background: #fff; transform: scale(1.06); }
.doc-step:disabled { opacity: .35; cursor: default; }
@media (min-width: 1300px) and (min-height: 501px) {
  .doc-steps { display: contents; --step-edge: max(16px, calc((100vw - 1120px) / 2 - 76px)); }
  #doc-step-label { position: fixed; top: calc(50% + 40px); right: calc(var(--step-edge) + 28px); transform: translateX(50%); white-space: nowrap; color: var(--paper); z-index: 2; }
  .doc-step { position: fixed; top: 50%; width: 56px; height: 56px; border-radius: 50%; transform: translateY(-50%); box-shadow: 0 16px 30px -14px #000000d0; z-index: 2; }
  #previous-doc { left: var(--step-edge); }
  #next-doc { right: var(--step-edge); }
  .doc-step:hover:not(:disabled) { transform: translateY(-50%) scale(1.08); }
}
/* Aggregate counters: visible privacy choice, no overlay over documents or print. */
.counter-notice{margin:24px 32px 24px 310px;padding:0;color:#615b51;font-size:12px;line-height:1.6}
.counter-notice summary{cursor:pointer;text-decoration:underline;text-underline-offset:3px;width:fit-content}
.counter-notice[open]{max-width:880px}.counter-notice[open] span{display:block;margin:10px 0}
.locked .counter-notice{margin:16px auto;max-width:480px;padding:0 20px}
.counter-notice button{flex-shrink:0;border:1px solid #a29a87;border-radius:6px;background:transparent;color:#173565;font:inherit;padding:6px 10px;cursor:pointer}
@media(max-width:760px){.counter-notice{margin:16px;display:block}.counter-notice button{margin-top:8px}}
@media print{.counter-notice{display:none!important}}
