/* ---------- dokument obiektu ---------- */

.doc { max-width: 980px; }

.doc-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 11px; letter-spacing: .12em; color: var(--text-mute); margin-bottom: 14px; }
.doc-bar a { color: var(--text-dim); }

.doc-head {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end;
  padding-bottom: 18px; border-bottom: 2px solid var(--line-2); position: relative;
}
.doc-num { font-family: var(--head); font-size: clamp(38px, 6vw, 64px); line-height: .95; letter-spacing: .04em; color: var(--accent); text-shadow: 0 0 22px rgba(216,210,191,.12); }
.doc-name { margin-top: 8px; font-size: 15px; color: var(--text-dim); letter-spacing: .1em; }

.stamp {
  font-family: var(--head); font-size: 20px; letter-spacing: .18em; padding: 6px 14px;
  border: 3px double currentColor; transform: rotate(-4deg); opacity: .9; text-align: center; line-height: 1.2;
}
.stamp small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .15em; }
.stamp.safe { color: var(--safe); }
.stamp.euclid { color: var(--euclid); }
.stamp.keter { color: var(--keter); text-shadow: 0 0 12px var(--red-glow); }

.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 20px 0 26px; }
.meta div { background: var(--bg-2); padding: 10px 14px; }
.meta dt { font-size: 10px; letter-spacing: .16em; color: var(--text-mute); }
.meta dd { margin: 2px 0 0; font-size: 13px; color: var(--text); }

.doc-body { display: grid; grid-template-columns: 1fr 330px; gap: 30px; align-items: start; }
.doc-text { min-width: 0; }

.doc-text h2 {
  margin: 28px 0 10px; font-family: var(--head); font-size: 17px; font-weight: 500; letter-spacing: .16em;
  color: var(--accent); text-transform: uppercase;
}
.doc-text h2:first-child { margin-top: 0; }
.doc-text p { margin: 0 0 12px; }
.doc-text ul { margin: 0 0 12px; padding-left: 20px; }
.doc-text li { margin-bottom: 5px; }
.doc-text b { color: #e8e4d6; }

.logbox { border: 1px solid var(--line); background: #070809; padding: 14px 18px; margin: 0 0 14px; font-size: 13.5px; }
.logbox p { margin: 0 0 6px; }
.logbox .who { color: var(--amber); font-weight: 700; }
.logbox .who.x { color: #ff6a6f; }
.logbox .note { color: var(--text-mute); font-style: italic; }

.warnbox { border: 1px solid var(--red); background: rgba(194,29,36,.07); padding: 12px 16px; margin: 0 0 16px; color: #e9a3a6; font-size: 13.5px; }
.warnbox b { color: #ff6a6f; letter-spacing: .08em; }

/* zaczernienia */
.r {
  background: #e2ded0; color: transparent; padding: 0 2px; border-radius: 1px;
  -webkit-user-select: none; user-select: none; cursor: help;
  transition: background .25s, color .25s;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.r:hover { background: #1a1d1e; color: #7d857e; }
.x { color: #fff; background: #000; padding: 0 4px; font-size: .85em; letter-spacing: .08em; border: 1px solid #333; }

/* rycina */
.figure { position: sticky; top: 120px; margin: 0; border: 1px solid var(--line-2); background: #000; padding: 8px; }
.fig-frame { position: relative; overflow: hidden; background: #000; aspect-ratio: 4 / 5; }
.fig-frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .1s, filter .4s; }
.fig-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 1px, transparent 1px 3px);
}
.fig-rec { position: absolute; top: 8px; left: 10px; z-index: 2; font-size: 10px; letter-spacing: .15em; color: #ff5359; }
.fig-rec::before { content: "\25CF "; animation: caret 1s steps(1) infinite; }
.fig-id { position: absolute; bottom: 8px; right: 10px; z-index: 2; font-size: 10px; letter-spacing: .1em; color: rgba(255,255,255,.55); }
.figure figcaption { padding: 10px 4px 2px; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.figure.glitchy .fig-frame img { animation: imgGlitch 7s infinite steps(1); }
@keyframes imgGlitch {
  0%, 91%, 100% { transform: none; filter: none; }
  92% { transform: translateX(-6px) skewX(4deg); filter: hue-rotate(80deg) contrast(1.6); }
  93% { transform: translateX(5px); filter: invert(.85); }
  94% { transform: none; filter: none; }
}

.fig-censor {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 20px; text-align: center; background: repeating-linear-gradient(45deg, #0b0b0b 0 14px, #150607 14px 28px);
  color: #ff6a6f; font-size: 12px; letter-spacing: .12em;
}
.fig-censor b { font-family: var(--head); font-size: 20px; letter-spacing: .2em; }

.meter { margin-top: 8px; height: 4px; background: #111; }
.meter span { display: block; height: 100%; width: 100%; background: var(--amber); transition: width .1s linear; }
.meter-l { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; letter-spacing: .1em; color: var(--text-mute); }

.src { margin-top: 34px; padding-top: 14px; border-top: 1px dashed var(--line-2); font-size: 11.5px; color: var(--text-mute); }

/* nawigacja między plikami */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.pager a { flex: 1; padding: 12px 14px; border: 1px solid var(--line); color: var(--text-dim); font-size: 12px; letter-spacing: .08em; text-decoration: none !important; }
.pager a:hover { border-color: var(--text-mute); color: var(--text); }
.pager a:last-child { text-align: right; }

/* ---------- odmowa dostępu ---------- */

.denied { max-width: 720px; margin: 6vh auto 0; border: 1px solid var(--red); background: rgba(20,4,5,.85); padding: 40px 36px; text-align: center; box-shadow: 0 0 60px rgba(194,29,36,.15), inset 0 0 60px rgba(194,29,36,.08); }
.denied-ico { font-family: var(--head); font-size: 64px; line-height: 1; color: var(--red); text-shadow: 0 0 24px var(--red-glow); }
.denied h1 { margin: 12px 0 6px; font-family: var(--head); letter-spacing: .24em; font-size: 28px; color: #ff6a6f; }
.denied p { color: #c89a9c; margin: 0 0 10px; font-size: 13.5px; }
.denied .code { font-size: 12px; color: var(--text-mute); letter-spacing: .1em; }

.btn {
  display: inline-block; margin-top: 16px; padding: 10px 20px; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
}
.btn:hover { background: var(--accent); color: #000; }
.btn.danger { color: #ff6a6f; border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }

.breach-banner { border: 1px solid var(--red); background: repeating-linear-gradient(45deg, rgba(194,29,36,.14) 0 12px, transparent 12px 24px); color: #ff8a8f; padding: 10px 14px; font-size: 12px; letter-spacing: .1em; margin-bottom: 18px; }

/* ---------- nakładka, komunikaty ---------- */

.overlay { position: fixed; inset: 0; z-index: 700; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.82); backdrop-filter: blur(3px); }
.overlay.alarm { background: rgba(80,0,4,.7); animation: alarm .5s steps(1) infinite; }
@keyframes alarm { 50% { background: rgba(10,0,0,.9); } }
.modal { width: min(560px, 100%); border: 1px solid var(--line-2); background: #0a0c0d; padding: 28px; text-align: center; }
.modal.red { border-color: var(--red); box-shadow: 0 0 80px var(--red-glow); }
.modal h2 { margin: 0 0 10px; font-family: var(--head); letter-spacing: .2em; color: #ff6a6f; font-size: 24px; }
.modal p { margin: 0 0 10px; color: var(--text-dim); font-size: 13.5px; }
.modal .big { font-family: var(--head); font-size: 42px; color: #fff; letter-spacing: .08em; }
.modal .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 750; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast { border: 1px solid var(--line-2); border-left: 3px solid var(--amber); background: rgba(8,10,11,.96); padding: 12px 14px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,.7); animation: toastIn .3s ease; }
.toast.red { border-left-color: var(--red); }
.toast.orange { border-left-color: #ff9a3c; }
.toast-h { font-size: 10px; letter-spacing: .18em; color: var(--text-mute); margin-bottom: 4px; }
.toast.out { opacity: 0; transform: translateX(20px); transition: .4s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* SCP-106: uszkodzona matryca terminala */
.lcd106 { position: fixed; inset: 0; z-index: 600; pointer-events: none; overflow: hidden; }
.col106 { position: absolute; top: 0; bottom: 0; opacity: .8; animation: colIn106 .25s steps(2); }
.col106.flick { animation: colIn106 .25s steps(2), flick106 2.6s steps(1) infinite; }
@keyframes colIn106 { from { opacity: 0; } 50% { opacity: 1; } }
@keyframes flick106 { 0%, 100% { opacity: .8; } 37% { opacity: .15; } 38% { opacity: .9; } 71% { opacity: 0; } 72% { opacity: .8; } }
.band106 { position: absolute; top: 0; bottom: 0; opacity: .7; background: repeating-linear-gradient(90deg, #ff2bd6 0 2px, #0b0b0b 2px 3px, #1ff2ff 3px 5px, #0b0b0b 5px 6px, #39ff6a 6px 7px); animation: colIn106 .3s steps(2); }
.crack106 { position: absolute; width: 520px; height: 520px; overflow: visible; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); }
.crack106 path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: crack106 .35s ease-out forwards; }
@keyframes crack106 { to { stroke-dashoffset: 0; } }
.leak106 { position: absolute; width: 340px; height: 340px; transform: scale(.08); opacity: .92; transition: transform 45s cubic-bezier(.2,.6,.3,1); }
.leak106.grow { transform: scale(1.1); }
@media (max-width: 600px) { .leak106.grow { transform: scale(.7); } }
.leak106 svg { display: block; width: 100%; height: 100%; }
.tear106 { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(90deg, rgba(255,255,255,.7) 0 8px, rgba(31,242,255,.6) 8px 11px, transparent 11px 30px, rgba(255,43,214,.6) 30px 34px); mix-blend-mode: screen; }
body.calm .col106.flick { animation: none; }
body.calm .tear106 { display: none; }

/* SCP-3008: zgaszone światła */
body.lights-out .view { filter: brightness(.28) contrast(1.2); transition: filter 2s; }

/* ---------- mniejsze ekrany ---------- */

@media (max-width: 1100px) {
  .motto { display: none; }
  .doc-body { grid-template-columns: 1fr; }
  .figure { position: relative; top: 0; max-width: 420px; }
  .meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: min(320px, 86vw); z-index: 60; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 50px rgba(0,0,0,.7); background: #070809; }
  .sidebar.open { transform: none; }
  .menu-backdrop.on { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(0,0,0,.55); }
  .status .st-line { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand-sub { display: none; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .status { margin-left: auto; }
  .brand { gap: 10px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-name { font-size: 17px; letter-spacing: .1em; }
  .clearance { padding: 4px 8px; }
  .clearance .cl-l { display: none; }
  .clearance .cl-s { display: inline; }
}

.cl-s { display: none; }
