/* Writeup — autosuficiente, con la paleta y la tipografía de la web (BeriaBox). */
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/jetbrains-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --canvas: #000;
  --surface: #1c1c1e;
  --surface-2: #121213;
  --text: #f5f5f7;
  --muted: #a7a7ad;
  --accent: #65df90;
  --accent-soft: #19271e;
  --line: #303033;
  --line-strong: #49494e;
  --danger: #ff9ba8;
  --mono: 'JetBrains Mono', monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 400 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
code { font: 12px var(--mono); overflow-wrap: anywhere; }

.top {
  height: 65px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #000;
  z-index: 3;
}
.top .brand img { display: block; width: 132px; height: auto; }
.top .label { font: 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.top .back { color: var(--muted); font-size: 12px; }
.top .back:hover { color: var(--text); text-decoration: none; }

.doc { max-width: 880px; margin: 0 auto; padding: 52px 28px 80px; }
.kicker { margin: 0 0 14px; font-size: 11px; font-weight: 500; color: var(--muted); }
.doc h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1.04;
}
	.lede { margin: 0; max-width: 62ch; color: var(--muted); font-size: 15px; line-height: 1.72; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 24px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.meta li {
  padding-right: 26px;
  margin-right: 26px;
  border-right: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text);
}
.meta li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.meta span { display: block; margin-bottom: 3px; font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.tldr {
  margin: 26px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}
.tldr b { color: var(--text); }
.tldr code { color: var(--text); }

.toc { margin: 30px 0 40px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toc ol { margin: 0; padding-left: 1.4em; color: var(--muted); font-size: 15px; }
.toc li { margin: 6px 0; }
.toc a { color: var(--text); }

.doc h2 {
  margin: 48px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.035em;
}
.doc h3 { margin: 26px 0 8px; font-size: 16px; font-weight: 600; }
.doc p { margin: 13px 0; color: var(--muted); font-size: 16px; line-height: 1.78; }
.doc strong { color: var(--text); font-weight: 600; }
.doc ul, .doc ol { margin: 13px 0; padding-left: 1.4em; color: var(--muted); font-size: 16px; line-height: 1.78; }
.doc li { margin: 6px 0; }

.doc pre {
  margin: 16px 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}
.doc pre code { font: 13px/1.7 var(--mono); color: #d7e9dd; background: none; border: 0; padding: 0; overflow-wrap: normal; }
.doc code { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }

.callout {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.78;
}
.callout b { color: var(--text); }

.doc table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; color: var(--muted); }
.doc th, .doc td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; font-weight: 400; color: var(--muted); }

.small { font-size: 14px; color: var(--muted); }

.shot { margin: 24px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.learn { list-style: none; padding: 0; margin: 16px 0; }
.learn li { position: relative; padding-left: 22px; margin: 9px 0; font-size: 15px; color: var(--muted); line-height: 1.78; }
.learn li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--accent); font-size: 12px; }

.next {
  margin: 28px 0 0;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  color: var(--muted);
}
.next a { white-space: nowrap; }

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 10px;
  color: var(--muted);
}
footer p { margin: 0; max-width: 46ch; }
.footer-separator { color: #64646b; margin: 0 9px; }

@media (max-width: 720px) {
  .top { padding: 0 16px; }
  .top .label { display: none; }
  .doc { padding: 30px 16px 56px; }
  .meta li { border-right: 0; margin: 0 0 10px; padding: 0; width: 50%; }
  footer { flex-direction: column; align-items: flex-start; }
}


/* Diagramas SVG del writeup */
.shot.diagram svg { display: block; width: 100%; height: auto; background: #0e0e10; }
.shot.diagram figcaption b { color: var(--text); font-weight: 600; }

/* Portada a sangre, como cabeza del writeup */
.cover { position: relative; margin: 0; overflow: hidden; background: #08110d; }
.cover img {
  display: block;
  width: 100%;
  height: clamp(230px, 42vh, 520px);
  object-fit: cover;
  object-position: 44% 50%;
}
.cover::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 120px;
  background: linear-gradient(rgba(0,0,0,0), #000 82%);
  pointer-events: none;
}
@media (max-width: 720px) {
  .cover img { height: clamp(150px, 30vh, 260px); object-position: 40% 50%; }
  .cover::after { height: 60px; }
}

/* Ampliación de imágenes (lightbox) */
.doc .shot img, .cover img { cursor: zoom-in; }
.doc .shot img:focus-visible, .cover img:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

html.is-zoomed { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 8, 6, .82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .24s ease-out;
}
.lightbox[hidden] { display: none; }
.lightbox.on { opacity: 1; }
.lightbox-img {
  position: fixed;
  object-fit: contain;
  border-radius: 12px;
  background: #0b1611;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(120, 220, 160, .16);
  transform-origin: center center;
  will-change: transform, opacity;
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(20, 24, 22, .72);
  color: #f5f5f7;
  font: 400 22px/1 var(--sans);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.lightbox-close:hover { background: rgba(40, 46, 43, .9); border-color: rgba(255, 255, 255, .3); transform: scale(1.06); }
@media (max-width: 720px) { .lightbox-close { top: 12px; right: 12px; width: 36px; height: 36px; } }
