/* Pantalla de inicio del port web de SCP – Containment Breach.
   Estética tomada del juego: negro con grano, marcos blancos, rayas de peligro, Courier y acentos rojos.
   Las texturas y tipografías salen de los archivos del juego (/game/...); si no están, todo cae a colores lisos. */

@font-face { font-family: "SCP Courier"; src: url("/game/GFX/font/cour/Courier New.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "SCP Courier"; src: url("/game/GFX/courbd.ttf") format("truetype"); font-weight: bold; font-display: swap; }
@font-face { font-family: "SCP Journal"; src: url("/game/GFX/font/Journal/Journal.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "SCP Digital"; src: url("/game/GFX/font/DS-DIGI/DS-Digital.TTF") format("truetype"); font-display: swap; }

:root {
  --bg: #050505;
  --panel: #0b0b0b;
  --panel-2: #121212;
  --line: #d8d8d8;
  --line-dim: #3a3a3a;
  --text: #d6d6d6;
  --text-dim: #8a8a8a;
  --text-faint: #5e5e5e;
  --white: #f2f2f2;
  --red: #c33;
  --red-dim: #7a1c1c;
  --ok: #7c7;
  --mono: "SCP Courier", "Courier New", Courier, monospace;
  --hand: "SCP Journal", "Segoe Print", "Bradley Hand", cursive;
  --digital: "SCP Digital", "Courier New", monospace;
  --tex-black: url("/game/GFX/menu/menublack.jpg");
  --tex-white: url("/game/GFX/menu/menuwhite.jpg");
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; min-height: 100vh; background: linear-gradient(rgba(5,5,5,.62), rgba(5,5,5,.62)), var(--tex-black) center/1024px repeat, var(--bg);
  color: var(--text); font: 15px/1.6 var(--mono); overflow-x: hidden;
}
a { color: var(--white); text-decoration-color: var(--red); text-underline-offset: 3px; }
a:hover { color: #fff; text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); }
code { background: #000; border: 1px solid var(--line-dim); padding: 0 5px; color: var(--white); font-size: .92em; }
pre { background: #000; border: 1px solid var(--line-dim); padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
pre code { border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- efectos de pantalla ---------- */
.fx-grain, .fx-scan, .fx-vignette, .fx-blink { position: fixed; inset: 0; pointer-events: none; }
.fx-grain {
  z-index: 50; opacity: .045; mix-blend-mode: screen;
  background: var(--tex-white) 0 0/512px repeat; animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0% { background-position: 0 0; } 20% { background-position: -130px 70px; } 40% { background-position: 90px -160px; } 60% { background-position: -40px 210px; } 80% { background-position: 170px 30px; } 100% { background-position: 0 0; } }
.fx-scan { z-index: 51; background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px); }
.fx-vignette { z-index: 52; background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0,0,0,.75) 100%); }
.fx-blink { z-index: 90; background: #000; opacity: 0; transition: opacity 70ms linear; }
.fx-blink.on { opacity: 1; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px;
  padding: 10px var(--gutter); background: #000; border-bottom: 2px solid var(--line);
  box-shadow: 0 2px 0 #000, 0 8px 24px rgba(0,0,0,.6);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: bold; letter-spacing: .2em; flex: none; }
.brand img { display: block; }
.brand .dim { color: var(--text-dim); font-weight: normal; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 12px; text-decoration: none; color: var(--text-dim); text-transform: uppercase; font-size: 12px;
  letter-spacing: .14em; white-space: nowrap; border: 1px solid transparent;
}
.nav a:hover { color: var(--white); border-color: var(--line-dim); }
.nav a.on { color: var(--white); box-shadow: inset 0 -2px 0 var(--red); }
.clock { font: 22px/1 var(--digital); color: var(--red); letter-spacing: .06em; text-shadow: 0 0 8px rgba(204,51,51,.5); flex: none; }

/* ---------- portada ---------- */
.hero { position: relative; min-height: calc(100vh - 54px); display: flex; align-items: center; padding: 48px var(--gutter); overflow: hidden; }
.hero::before { /* luz de techo que titila */
  content: ""; position: absolute; left: 50%; top: -20%; width: 120vmax; height: 120vmax; transform: translateX(-50%);
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.10), transparent 45%); animation: flicker 7s infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1; } 41% { opacity: 1; } 42% { opacity: .35; } 43% { opacity: .9; } 44% { opacity: .2; } 46% { opacity: 1; } 78% { opacity: 1; } 79% { opacity: .55; } 80% { opacity: 1; } }
.hero-inner { position: relative; width: 100%; max-width: 1240px; margin: 0 auto; padding-left: clamp(0px, 4vw, 60px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 48px; align-items: center; }
@media (max-width: 1100px) { .hero-inner { grid-template-columns: minmax(0, 1fr); } }
.hero-main { min-width: 0; }

/* terminal del sitio en la portada */
.terminal { background: rgba(0,0,0,.86); border: 2px solid var(--line); box-shadow: 0 0 0 3px #000, 0 0 40px rgba(0,0,0,.8); font-size: 13px; }
.term-head { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-bottom: 2px solid var(--line); background: #0d0d0d; text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: var(--text-dim); }
.term-head .rec { color: var(--red); animation: rec 1.6s steps(2) infinite; }
@keyframes rec { 50% { opacity: .2; } }
.term-body { margin: 0; padding: 12px 14px 14px; min-height: 236px; white-space: pre-wrap; color: #bdbdbd; font: inherit; line-height: 1.75; }
.term-body .bad { color: #e04545; }
.term-body .good { color: var(--ok); }
.term-body .caret { display: inline-block; width: 8px; height: 14px; background: #bdbdbd; vertical-align: -2px; animation: rec 1s steps(2) infinite; }
.kicker { color: #a3a3a3; text-transform: uppercase; letter-spacing: .22em; font-size: 12px; margin: 0 0 18px; }
.title { margin: 0; line-height: .9; text-transform: uppercase; }
.t-scp {
  display: block; font-size: clamp(84px, 17vw, 190px); font-weight: bold; letter-spacing: .06em; color: var(--white);
  background: var(--tex-white) center/600px; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,255,255,.12));
}
.t-rest { display: block; font-size: clamp(18px, 3.2vw, 40px); letter-spacing: clamp(.1em, 1vw, .26em); color: var(--text); margin-top: 6px; }
.motto { margin: 22px 0 8px; color: #e04545; letter-spacing: .3em; text-transform: uppercase; font-size: 13px; }
.lead { margin: 0 0 30px; color: #bdbdbd; max-width: 560px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 12px 22px; min-width: 170px; text-align: center; text-decoration: none; text-transform: uppercase;
  letter-spacing: .18em; font-size: 14px; color: var(--white); background: #000 var(--tex-black) center/512px;
  border: 2px solid var(--line); box-shadow: 0 0 0 3px #000; transition: border-color .12s, color .12s, background .12s;
}
.btn:hover { border-color: var(--red); color: #fff; }
.btn-main { font-size: 17px; font-weight: bold; padding: 14px 34px; }
.btn-main:hover { background: var(--white) var(--tex-white) center/512px; color: #000; border-color: var(--white); }
.status { display: flex; align-items: center; gap: 10px; margin: 26px 0 0; font-size: 12.5px; color: #a8a8a8; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: none; box-shadow: 0 0 0 2px #000; }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.bad .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status.bad .status-text { color: var(--text); }

.hazard { height: 14px; background: repeating-linear-gradient(-45deg, var(--line) 0 10px, #0a0a0a 10px 20px); border-block: 2px solid #000; }
.hazard-left { position: absolute; left: 0; top: 18%; bottom: 18%; width: 22px; height: auto; border: 2px solid #000; border-left: 0;
  background: repeating-linear-gradient(-45deg, var(--line) 0 9px, #0a0a0a 9px 18px); opacity: .85; }

/* ---------- secciones ---------- */
.section { max-width: 1120px; margin: 0 auto; padding: 72px var(--gutter) 24px; }
.section-title { display: flex; align-items: baseline; gap: 14px; margin: 0 0 26px; font-size: clamp(22px, 3.4vw, 30px); text-transform: uppercase; letter-spacing: .2em; color: var(--white); border-bottom: 2px solid var(--line); padding-bottom: 10px; }
.section-title .num { font: 26px var(--digital); color: var(--red); letter-spacing: 0; }
.sub-title { margin: 36px 0 14px; font-size: 15px; text-transform: uppercase; letter-spacing: .16em; color: var(--white); }
.intro { max-width: 760px; color: var(--text); margin: 0 0 24px; }
.hint { color: var(--text-dim); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.panel { background: rgba(8,8,8,.92); border: 2px solid var(--line); box-shadow: 0 0 0 3px #000, 0 10px 30px rgba(0,0,0,.6); padding: 18px 20px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .18em; color: var(--white); border-bottom: 1px solid var(--line-dim); padding-bottom: 8px; }

/* ---------- documento ---------- */
.doc { position: relative; background: #0d0d0d var(--tex-black) center/700px; border: 2px solid var(--line); box-shadow: 0 0 0 3px #000, 0 14px 40px rgba(0,0,0,.7); padding: 26px clamp(18px, 4vw, 40px) 30px; }
.doc-head { display: flex; gap: 20px; align-items: center; border-bottom: 2px solid var(--line-dim); padding-bottom: 16px; margin-bottom: 16px; }
.doc-head img { flex: none; opacity: .9; }
.doc-field { margin: 2px 0; }
.doc-field b, .doc-body b { color: var(--white); }
.doc-body p { max-width: 720px; }
.facts { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.facts li { border-left: 3px solid var(--red); padding: 4px 10px; background: rgba(0,0,0,.5); }
.doc-note { color: var(--text-dim); font-size: 13px; }
.sticky {
  position: absolute; right: clamp(12px, 3vw, 34px); top: -18px; width: 210px; padding: 14px 16px; transform: rotate(3deg);
  background: #e9e3c9; color: #222; font: 21px/1.15 var(--hand); box-shadow: 0 8px 18px rgba(0,0,0,.7);
}
@media (max-width: 760px) { .sticky { position: static; transform: rotate(-1deg); margin-top: 18px; width: auto; } }
.redact { background: #000; color: transparent; padding: 0 4px; cursor: help; transition: color .2s, background .2s; border-bottom: 1px dashed var(--red-dim); }
.redact:hover, .redact:focus, .redact.show { background: transparent; color: var(--red); }

/* ---------- controles ---------- */
.keys { margin: 0; display: grid; gap: 8px; }
.keys > div { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 12px; align-items: center; }
.keys dt { display: flex; flex-wrap: wrap; gap: 4px; }
.keys dd { margin: 0; }
kbd {
  display: inline-block; min-width: 30px; padding: 3px 7px; text-align: center; font: bold 12.5px var(--mono); color: var(--white);
  background: linear-gradient(#1c1c1c, #090909); border: 1px solid #777; border-bottom-width: 3px; border-radius: 2px;
}
kbd.inline { min-width: 0; padding: 0 5px; font-size: 11.5px; border-bottom-width: 2px; }
@media (max-width: 420px) { .keys > div { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- el port ---------- */
.pipeline { list-style: none; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: s; }
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pipeline { grid-template-columns: 1fr; } }
.pipeline li { position: relative; background: rgba(8,8,8,.92); border: 2px solid var(--line); box-shadow: 0 0 0 3px #000; padding: 16px 16px 14px; }
.pipeline li:not(:last-child)::after { content: "▶"; position: absolute; right: -14px; top: 50%; transform: translateY(-50%); color: var(--red); font-size: 12px; z-index: 1; }
@media (max-width: 900px) { .pipeline li::after { display: none; } }
.pipeline h3 { margin: 6px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--white); }
.pipeline p { margin: 0; font-size: 13px; color: var(--text); }
.step { font: 30px/1 var(--digital); color: var(--red); }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 8px; }
.ticks, .state { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.ticks li { padding-left: 18px; position: relative; }
.ticks li::before { content: "■"; position: absolute; left: 0; color: var(--red); font-size: 10px; top: 3px; }
.state li { padding-left: 26px; position: relative; }
.state li::before { position: absolute; left: 0; font-weight: bold; }
.state .ok::before { content: "[✓]"; color: var(--ok); font-size: 12px; top: 1px; }
.state .todo::before { content: "[ ]"; color: var(--text-dim); font-size: 12px; top: 1px; }
.state .todo { color: var(--text-dim); }

/* ---------- créditos ---------- */
.credits { columns: 3 260px; column-gap: 18px; }
.credit-group { break-inside: avoid; margin: 0 0 18px; background: rgba(8,8,8,.92); border: 2px solid var(--line); box-shadow: 0 0 0 3px #000; padding: 14px 16px; }
.credit-group h3 { margin: 0 0 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--red); }
.credit-group ul { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.credit-group li { padding: 1px 0; }
.credit-group .nick { color: var(--text-dim); }
.table-wrap { overflow-x: auto; border: 2px solid var(--line); box-shadow: 0 0 0 3px #000; background: rgba(8,8,8,.92); }
.scp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scp-table th { text-align: left; text-transform: uppercase; letter-spacing: .12em; font-size: 11.5px; color: var(--white); background: #000; padding: 9px 12px; border-bottom: 2px solid var(--line); position: sticky; top: 0; }
.scp-table td { padding: 6px 12px; border-bottom: 1px solid #1f1f1f; vertical-align: top; }
.scp-table td:first-child { color: var(--white); white-space: nowrap; }
.scp-table tr:hover td { background: #151515; }
.scp-table .unknown { color: var(--text-faint); font-style: italic; }
.license { margin-top: 30px; }

/* ---------- pie ---------- */
.footer { margin-top: 70px; background: #000; border-top: 2px solid var(--line); }
.footer p { max-width: 1120px; margin: 0 auto; padding: 18px var(--gutter) 90px; color: var(--text-dim); font-size: 12px; }

/* ---------- HUD de parpadeo ---------- */
.hud { position: fixed; left: 16px; bottom: 14px; z-index: 60; display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.7); padding: 6px 8px; border: 1px solid #333; }
.hud-icon { width: 26px; height: 26px; border: 1px solid #ccc; image-rendering: auto; }
.meter { display: flex; gap: 2px; width: 160px; height: 16px; padding: 2px; border: 1px solid #ccc; }
.meter i { flex: 1; background: #ddd; }
.meter i.off { background: transparent; }
.hud-toggle { font: 11px var(--mono); color: var(--text-dim); background: none; border: 1px solid var(--line-dim); padding: 3px 6px; cursor: pointer; text-transform: uppercase; letter-spacing: .08em; }
.hud-toggle:hover { color: var(--white); border-color: var(--line); }
@media (max-width: 640px) { .hud { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fx-grain, .hero::before, .term-head .rec, .term-body .caret { animation: none; }
}

/* ---------- pantallas chicas ---------- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 12px; padding-block: 8px 0; }
  .brand { order: 1; }
  .clock { order: 2; margin-left: auto; font-size: 20px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; }
  html { scroll-padding-top: 96px; }
  .actions .btn { flex: 1 1 100%; }
  .hero { padding-top: 36px; }
  .hazard-left { display: none; }
}
