@import url("fonts.css");

:root {
  --bg: #F7EDEA;
  --card: #FFFFFF;
  --ink: #3B0F1D;
  --accent: #8E1B3F;
  --accent-deep: #5E1128;
  --tint-1: #EFD9DD;
  --tint-2: #E4BFC7;
  --radius: 4px;
  --hairline: 1px solid rgba(59, 15, 29, 0.14);
  --font-serif: "Instrument Serif", "DM Serif Display", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --max-w: 560px;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body.no-scroll { overflow: hidden; height: 100%; }

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

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
}

/* ---------- progress line ---------- */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 500;
  transition: width 80ms linear;
}

/* ---------- cover / masthead ---------- */
.cover {
  position: relative;
  min-height: 82svh;
  background: var(--accent);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.cover-contents {
  padding: clamp(28px, 10vh, 56px) 24px 0;
  flex: 1;
}

.cover-eyebrow {
  color: var(--tint-1);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 18px;
}

.toc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  padding: 18px 0;
  border-bottom: 1px solid rgba(247, 237, 234, 0.28);
  color: var(--bg);
  text-align: left;
  text-decoration: none;
}

.toc-row .toc-label {
  font-family: var(--font-serif);
  font-size: clamp(28px, 9vw, 38px);
  line-height: 1;
}

.toc-row .toc-num {
  font-family: var(--font-serif);
  font-size: 15px;
  opacity: 0.65;
  margin-right: 14px;
  vertical-align: middle;
}

.toc-row .toc-arrow {
  font-size: 20px;
  opacity: 0.8;
  transition: transform 150ms ease;
}

.toc-row:active .toc-arrow { transform: translateX(4px); }

.cover-bar {
  background: var(--tint-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  width: 100%;
}

.cover-bar img {
  height: 40px;
  width: auto;
}

.cover-bar .cover-tagline {
  font-size: 12.5px;
  color: var(--accent-deep);
  text-align: right;
  line-height: 1.3;
  max-width: 50%;
}

.swipe-cue {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--tint-1);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.swipe-cue .arrow {
  font-size: 16px;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-cue .arrow { animation: none; }
}

/* ---------- section headers ---------- */
.section { padding: 56px 20px 24px; }

.section-header {
  position: relative;
  margin-bottom: 32px;
  padding-top: 8px;
}

.section-header .outline-num {
  font-family: var(--font-serif);
  font-size: clamp(90px, 32vw, 150px);
  line-height: 0.75;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--tint-2);
  position: absolute;
  top: -18px;
  left: -6px;
  z-index: 0;
  user-select: none;
}

.section-header .section-title {
  position: relative;
  z-index: 1;
  font-size: clamp(30px, 8vw, 40px);
  color: var(--accent-deep);
  padding-top: 46px;
}

.section-header .section-rule {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  height: 1px;
  background: rgba(59, 15, 29, 0.18);
}

/* ---------- shared story bits ---------- */
.story { position: relative; margin-bottom: 44px; }
.story:last-child { margin-bottom: 0; }

.story-preview {
  font-size: 15px;
  color: rgba(59, 15, 29, 0.82);
  margin-top: 14px;
}

.story-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.story-link::after { content: " →"; }

.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tint-1);
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  filter: grayscale(1);
  transition: opacity 420ms ease;
}

.media-frame img.loaded { opacity: 1; }

.media-frame .duotone {
  position: absolute;
  inset: 0;
  background: var(--accent);
  mix-blend-mode: color;
  opacity: 0.35;
  pointer-events: none;
}

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

/* ---------- FINANZAS: posters ---------- */
.story--poster { cursor: pointer; }

.poster-media {
  position: relative;
  width: 100vw;
  max-width: var(--max-w);
  margin-left: calc(50% - 50vw);
  aspect-ratio: 4 / 5;
  border-radius: 0;
}

@media (min-width: 560px) {
  .poster-media { margin-left: 0; width: 100%; }
}

.poster-caption {
  position: absolute;
  bottom: -40px;
  left: -16px;
  width: 82%;
  background: var(--accent);
  padding: 16px 20px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.poster-caption .story-headline {
  color: #FFFFFF;
  font-size: clamp(21px, 6.4vw, 27px);
  line-height: 1.12;
}

.story--poster .poster-body {
  padding: 56px 20px 0 20px;
}

/* ---------- ECONOMIA: zigzag ---------- */
.story--zigzag {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 0 20px;
}

.story--zigzag.is-even { flex-direction: row-reverse; }

.zigzag-media {
  position: relative;
  width: 58%;
  flex-shrink: 0;
}

.zigzag-frame {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transform: translate(10px, 10px);
  z-index: 0;
}

.story--zigzag.is-odd .zigzag-frame { transform: translate(-10px, 10px); }

.zigzag-media .media-frame {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 5;
}

.zigzag-text {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.zigzag-text .zigzag-number {
  display: block;
  font-family: var(--font-serif);
  font-size: 34px;
  color: var(--tint-2);
  line-height: 1;
  margin-bottom: 8px;
}

.zigzag-text .story-headline {
  font-size: clamp(18px, 5vw, 21px);
  line-height: 1.18;
  color: var(--ink);
}

/* ---------- TECNOLOGIA: stacking cards ---------- */
.stack-wrap { position: relative; }

.story--stack {
  position: sticky;
  top: 72px;
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  margin-inline: auto;
}

@media (prefers-reduced-motion: reduce) {
  .story--stack { position: relative; top: auto; }
}

.stack-media { aspect-ratio: 3 / 2; }

.stack-body { padding: 18px 20px 22px; }

.stack-body .story-headline {
  font-size: clamp(19px, 5.4vw, 22px);
  line-height: 1.18;
  color: var(--ink);
}

/* ---------- footer ---------- */
footer {
  padding: 48px 20px 40px;
  text-align: center;
  border-top: 1px solid rgba(59, 15, 29, 0.12);
  margin-top: 24px;
}

footer .footer-logo {
  height: 30px;
  margin: 0 auto 14px;
  opacity: 0.92;
}

footer .footer-tagline {
  font-size: 13px;
  color: rgba(59, 15, 29, 0.65);
  margin-bottom: 10px;
}

footer .footer-email {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}

/* ---------- overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 340ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.overlay.open { transform: translateY(0); }

.overlay-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 1010;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink);
}

.overlay-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.overlay-content { padding: 24px 22px 60px; max-width: var(--max-w); margin: 0 auto; }

.overlay-pill {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--tint-1);
  padding: 5px 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.overlay-title {
  font-size: clamp(26px, 8vw, 32px);
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 10px;
}

.overlay-meta {
  font-size: 12.5px;
  color: rgba(59, 15, 29, 0.55);
  margin-bottom: 22px;
}

.overlay-body p {
  margin-bottom: 18px;
  font-size: 16px;
  color: rgba(59, 15, 29, 0.9);
  line-height: 1.7;
}
