/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Archivo Black";
  src: url("fonts/ArchivoBlack-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk-Variable.ttf") format("truetype-variations");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("fonts/SpaceMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("fonts/SpaceMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Variable.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --page: #eef1f5;
  --card: #ffffff;
  --ink: #0f1222;
  --lime: #c7f23b;
  --pink: #ff7bac;
  --sky: #62c0ff;
  --border-w: 2.5px;
  --shadow-off: 5px;
  --radius: 6px;
  --font-display: "Archivo Black", "Space Grotesk", sans-serif;
  --font-head: "Space Grotesk", "Archivo Black", sans-serif;
  --font-mono: "Space Mono", monospace;
  --font-body: "Inter", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
}

img { max-width: 100%; display: block; }

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--page);
  position: relative;
}

a { color: inherit; text-decoration: none; }

/* ---------- Progress bar ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--ink);
  z-index: 200;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--lime);
  transition: width 0.08s linear;
}

/* ---------- Masthead ---------- */
.masthead { position: relative; padding-top: 4px; }

.ticker-strip {
  background: var(--lime);
  border-top: var(--border-w) solid var(--ink);
  border-bottom: var(--border-w) solid var(--ink);
  overflow: hidden;
  white-space: nowrap;
  padding: 7px 0;
}
.ticker-track {
  display: inline-flex;
  width: max-content;
  animation: ticker-scroll 22s linear infinite;
}
.ticker-track span {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding-right: 1.5em;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

.masthead-body {
  position: relative;
  padding: 26px 20px 20px;
  overflow: hidden;
}

.ecg-line {
  position: absolute;
  top: 18px;
  left: 0;
  width: 100%;
  height: 56px;
  pointer-events: none;
}
.ecg-line path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-ecg 1.8s 0.2s ease forwards;
}
@keyframes draw-ecg {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ecg-line path { animation: none; stroke-dashoffset: 0; }
}

.logo-sticker {
  position: relative;
  margin-left: 55%;
  transform: translateX(-50%) rotate(-2deg);
  width: 148px;
  background: var(--card);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off) var(--shadow-off) 0 var(--ink);
  padding: 10px;
  z-index: 2;
}
.logo-sticker img { width: 100%; height: auto; }

.tape {
  position: absolute;
  top: -10px;
  width: 30px;
  height: 18px;
  background: rgba(199, 242, 59, 0.75);
  border: 1.5px solid var(--ink);
  transform: rotate(-6deg);
}
.tape.tape-right {
  right: 10px;
  transform: rotate(8deg);
}
.tape.tape-left { left: 10px; }

.tagline {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  max-width: 230px;
}

/* ---------- Sections ---------- */
.section { padding: 0 16px 36px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off) var(--shadow-off) 0 var(--ink);
  padding: 14px 18px;
  margin: 28px 0 18px;
  position: relative;
}
.section-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.section-finanzas .section-header { background: var(--lime); }
.section-economia .section-header { background: var(--pink); }
.section-tecnologia .section-header { background: var(--sky); }

.count-sticker {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 5px 9px;
  transform: rotate(-4deg);
  white-space: nowrap;
}

.leer-mas {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 16px;
  box-shadow: 3px 3px 0 var(--ink);
  background: var(--card);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.leer-mas:active,
.story-card:active .leer-mas,
.bento-tile:active .leer-mas {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}
.leer-mas.lime { background: var(--lime); }
.leer-mas.pink { background: var(--pink); }
.leer-mas.sky { background: var(--sky); }

.story-card, .bento-tile {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.story-card:active, .bento-tile:active {
  transform: translate(3px, 3px);
}

/* ---------- FINANZAS: folder-tab cards ---------- */
.cards-folder { display: flex; flex-direction: column; gap: 26px; }

.story-card {
  position: relative;
  background: var(--card);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off) var(--shadow-off) 0 var(--ink);
  margin-top: 14px;
}
.story-card.tilt-a { transform: rotate(-0.6deg); }
.story-card.tilt-b { transform: rotate(0.6deg); }
.story-card:active.tilt-a,
.story-card:active.tilt-b { transform: translate(3px, 3px) rotate(0deg); box-shadow: 0 0 0 var(--ink); }

.folder-tab {
  position: absolute;
  top: -14px;
  left: 16px;
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 4px 4px 0 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
}

.story-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: var(--border-w) solid var(--ink);
  background: var(--ink);
}
.story-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.story-img.loaded { opacity: 1; }

.story-body { padding: 16px; }
.story-body h3 {
  margin: 0 0 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.15;
}
.story-body p.preview {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #30334a;
}

/* ---------- ECONOMIA: bento grid ---------- */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.bento-tile {
  position: relative;
  background: var(--card);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off) var(--shadow-off) 0 var(--ink);
  overflow: hidden;
}
.bento-tile.wide { grid-column: 1 / -1; }
.bento-tile .story-img-wrap { border-bottom: var(--border-w) solid var(--ink); aspect-ratio: 1 / 1; }
.bento-tile.wide .story-img-wrap { aspect-ratio: 16 / 9; }

.badge-num {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--pink);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  z-index: 2;
}
.bento-tile .story-body { padding: 12px; }
.bento-tile .story-body h3 { font-size: 16px; margin-bottom: 8px; }
.bento-tile.wide .story-body h3 { font-size: 19px; }
.bento-tile .story-body p.preview {
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bento-tile.wide .story-body p.preview {
  -webkit-line-clamp: 3;
}

/* ---------- TECNOLOGIA: skewed frames ---------- */
.skewed-stack { display: flex; flex-direction: column; gap: 30px; }
.skew-card { background: transparent; }

.skew-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  margin-bottom: -2px;
}
.skew-img-wrap.dir-left { clip-path: polygon(6% 0, 100% 0, 94% 100%, 0% 100%); }
.skew-img-wrap.dir-right { clip-path: polygon(0 0, 94% 0, 100% 100%, 6% 100%); }
.skew-img-wrap .story-img { object-position: center 45%; }

.skew-tab {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sky);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 5px 12px;
  z-index: 3;
}

.skew-body {
  background: var(--card);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-off) var(--shadow-off) 0 var(--ink);
  padding: 20px 16px 16px;
  margin-top: 14px;
}
.skew-body h3 {
  margin: 0 0 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.15;
}
.skew-body p.preview {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #30334a;
}

/* ---------- Scroll-reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: var(--border-w) solid var(--ink);
  padding: 28px 20px 40px;
  text-align: center;
  background: var(--ink);
  color: var(--page);
}
.site-footer .footer-tagline {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 10px;
}
.site-footer .footer-email {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--lime);
}

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--page);
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay.open { transform: translateY(0); }

.overlay-inner { max-width: 560px; margin: 0 auto; padding-bottom: 50px; }

.overlay-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  background: var(--card);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  z-index: 310;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.overlay-close:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.overlay-hero-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-bottom: var(--border-w) solid var(--ink);
  overflow: hidden;
  background: var(--ink);
}
.overlay-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.overlay-content { padding: 20px; }

.overlay-sticker {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 11px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
  margin-bottom: 16px;
  background: var(--card);
}
.overlay-sticker.lime { background: var(--lime); }
.overlay-sticker.pink { background: var(--pink); }
.overlay-sticker.sky { background: var(--sky); }

.overlay-content h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  margin: 0 0 12px;
}

.overlay-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #51546b;
  margin: 0 0 22px;
}

.overlay-body p {
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 18px;
}

/* ---------- Responsive guard ---------- */
@media (max-width: 360px) {
  .section-header h2 { font-size: 25px; }
  .logo-sticker { width: 128px; }
}
