/* =========================================================
   Полноэкранный просмотр HTML-брендбука
   Документ — во всё окно, поверх — панель с кнопкой «Назад»
   ========================================================= */
:root {
  --bg: #121010; --ink: #F2EFEA; --muted: rgba(242, 239, 234, .62); --line: rgba(242, 239, 234, .16);
  --cut: #E4194A; --cut-hover: #FF2D5D; --mat: #121010;
  --f: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --f-mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gap: max(14px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font: 500 11px/1.2 var(--f); font-stretch: 87.5%; letter-spacing: .05em; text-transform: uppercase; color: var(--ink); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--cut); outline-offset: 2px; }

.vw-frame { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border: 0; display: block; background: var(--bg); }
.is-dragging .vw-frame { pointer-events: none; }

/* ---------- Затвор: пока документ грузится — лаборатория с сеткой ---------- */
.vw-shutter {
  position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 22px;
  background-color: var(--mat);
  background-image:
    linear-gradient(rgba(242, 239, 234, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(242, 239, 234, .12) 1px, transparent 1px),
    linear-gradient(rgba(242, 239, 234, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(242, 239, 234, .05) 1px, transparent 1px);
  background-size: 240px 240px, 240px 240px, 48px 48px, 48px 48px;
  background-position: center;
}
.vw-shutter::before, .vw-shutter::after { content: ""; position: absolute; width: 14px; height: 14px; background: var(--ink); top: 22px; left: 22px; box-shadow: calc(100vw - 58px) 0 0 var(--ink); }
.vw-shutter::after { top: auto; bottom: 22px; }
.vw-shutter-meta { display: flex; flex-wrap: wrap; justify-content: center; border: 1px solid rgba(242, 239, 234, .38); background: #121010; font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; }
.vw-shutter-meta span { padding: 12px 16px; border-right: 1px solid rgba(242, 239, 234, .22); }
.vw-shutter-meta span:first-child { color: var(--cut); }
.vw-shutter-meta span:last-child { border-right: 0; }
.vw-shutter-bar { position: relative; width: min(280px, 60vw); height: 2px; background: rgba(242, 239, 234, .2); overflow: hidden; }
.vw-shutter-bar i { position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--cut); animation: load 1.1s cubic-bezier(.6, 0, .3, 1) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
/* Щелчок затвора: кадр открывается рывком, со вспышкой */
.vw-shutter.is-open { animation: open .42s steps(3, end) forwards; pointer-events: none; }
@keyframes open {
  0% { clip-path: inset(0); filter: none; }
  45% { clip-path: inset(0 0 55% 0); filter: brightness(2.2); }
  100% { clip-path: inset(0 0 100% 0); filter: brightness(2.6); }
}
.vw-shutter[hidden] { display: none; }

/* ---------- Панель ---------- */
.dock {
  position: fixed; z-index: 10; display: flex; align-items: center; gap: 4px; padding: 5px;
  max-width: calc(100vw - var(--gap) * 2);
  border-radius: 0; border: 1px solid rgba(242, 239, 234, .3);
  background: rgba(18, 16, 16, .92);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 18px 44px -14px rgba(0, 0, 0, .65);
  transition: left .45s cubic-bezier(.2, .7, .2, 1), top .45s cubic-bezier(.2, .7, .2, 1), opacity .3s;
  touch-action: none;
}
.dock[data-corner="bl"] { left: var(--gap); bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
.dock[data-corner="br"] { right: max(14px, env(safe-area-inset-right, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
.dock[data-corner="tl"] { left: var(--gap); top: max(14px, env(safe-area-inset-top, 0px)); }
.dock[data-corner="tr"] { right: max(14px, env(safe-area-inset-right, 0px)); top: max(14px, env(safe-area-inset-top, 0px)); }
.dock.is-drag { transition: none; right: auto !important; bottom: auto !important; box-shadow: 0 30px 60px -12px rgba(0, 0, 0, .7); }

.dock a, .dock button { font: inherit; color: inherit; text-decoration: none; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dock svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dock-back {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: 0;
  background: var(--cut); color: var(--ink) !important; font-weight: 500; white-space: nowrap;
  transition: background-color .2s, box-shadow .2s;
}
.dock-back:hover { background: var(--ink); color: var(--bg) !important; }
.dock-back svg { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.dock-back:hover svg { transform: translateX(-3px); }
.dock-docs { display: inline-flex; gap: 2px; padding: 0 2px 0 6px; margin-left: 2px; border-left: 1px solid var(--line); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.dock-docs::-webkit-scrollbar { display: none; }
.dock-docs a {
  display: inline-flex; align-items: center; height: 40px; padding: 0 12px; border-radius: 0; white-space: nowrap;
  font: 500 10.5px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.dock-docs a::before { content: attr(data-n) "  "; white-space: pre; color: var(--cut); opacity: .9; }
.dock-docs a:hover { color: var(--ink); background: rgba(242, 239, 234, .08); }
.dock-docs a[aria-current] { color: var(--ink); background: rgba(242, 239, 234, .14); box-shadow: inset 0 -2px 0 var(--cut); }
.dock-tools { display: inline-flex; gap: 2px; padding-left: 4px; margin-left: 2px; border-left: 1px solid var(--line); }
.dock-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 0; color: var(--muted) !important; transition: background-color .2s, color .2s; }
.dock-btn:hover { color: var(--bg) !important; background: var(--ink); }
.dock-btn[hidden] { display: none; }
.dock-grip { cursor: grab; touch-action: none; }
.dock.is-drag .dock-grip { cursor: grabbing; }
.dock-grip circle { fill: currentColor; stroke: none; }

@media (max-width: 560px) {
  .dock-docs a { padding: 0 10px; font-size: 0; letter-spacing: 0; }
  .dock-docs a::before { content: attr(data-n); font-size: 11px; letter-spacing: .04em; color: inherit; opacity: 1; }
  .dock-docs a[aria-current]::before { color: var(--cut); }
  #newTab { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .vw-shutter.is-open { display: none; }
}
