:root {
  color-scheme: light;
  --surface: #fbf9fb;
  --surface-gray: #f8fafc;
  --surface-container: #ffffff;
  --surface-container-high: #eae7ea;
  --text: #1b1b1d;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #c5c6cd;
  --primary: #0a192f;
  --accent: #00d1ff;
  --accent-soft: rgba(0, 209, 255, 0.08);
  --shadow-soft: 0 4px 20px rgba(10, 25, 47, 0.05);
  --radius: 4px;
  --max: 1280px;
  --reading-scale: 1;
}

[data-theme="dark"] {
  color-scheme: dark;
  --surface: #101418;
  --surface-gray: #151b22;
  --surface-container: #1b222b;
  --surface-container-high: #242c36;
  --text: #f2f0f2;
  --muted: #b7c8e1;
  --line: rgba(211, 228, 254, 0.15);
  --line-strong: rgba(211, 228, 254, 0.28);
  --primary: #d6e3ff;
  --accent: #4cd6ff;
  --accent-soft: rgba(76, 214, 255, 0.1);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  padding-bottom: 48px;
  background: var(--surface);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.menu-open {
  overflow: hidden;
}

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

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 24px;
  align-items: center;
  padding: 16px max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface), transparent 8%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--primary);
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--surface-container);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.main-nav a,
.mobile-nav a {
  position: relative;
  padding-block: 8px;
}

.main-nav a.active,
.mobile-nav a.active {
  color: var(--primary);
}

.main-nav a.active::after,
.mobile-nav a.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
}

.theme-toggle,
.menu-button,
.text-size {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-container);
  color: var(--primary);
  cursor: pointer;
}

.text-size {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-height: 36px;
  padding: 3px;
}

.text-size-button {
  display: grid;
  min-width: 40px;
  place-items: center;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.text-size-button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.text-size-button:disabled {
  color: var(--muted);
  opacity: 0.4;
  cursor: not-allowed;
}

.theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-height: 36px;
  padding: 3px;
  font-size: 12px;
  font-weight: 600;
}

.theme-toggle span {
  display: grid;
  min-width: 58px;
  place-items: center;
  border-radius: 2px;
}

[data-theme="light"] .theme-sun,
[data-theme="dark"] .theme-moon {
  background: var(--primary);
  color: var(--surface-container);
}

.menu-button {
  display: none;
  width: 40px;
  height: 36px;
  place-items: center;
  padding: 8px;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px auto;
  background: var(--primary);
}

.mobile-nav {
  display: none;
}

.page-scrim {
  display: none;
}

.mobile-contact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hero {
  display: grid;
  max-width: var(--max);
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 24px;
  align-items: stretch;
  margin: 0 auto;
  padding: 72px 24px 48px;
}

.privacy-hero {
  min-height: 360px;
}

.hero-copy {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  background: var(--surface-container);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 20px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
li {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 980px;
  margin: 0;
  color: var(--primary);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 56px;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 20px;
  line-height: 32px;
}

.hero-visual {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, var(--surface-gray), var(--surface-container)),
    var(--surface-gray);
}

.hero-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--surface-container), transparent 8%), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 7.9%, color-mix(in srgb, var(--line), transparent 20%) 8%);
  pointer-events: none;
}

.hero-visual ol {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  align-content: end;
  gap: 8px;
  margin: 0;
  padding: 32px;
  list-style: none;
}

.hero:not(.home-hero) .hero-visual {
  min-height: 320px;
}

.hero-visual li {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-container), transparent 10%);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-visual li span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 calc(3px + var(--i) * 1px) color-mix(in srgb, var(--accent), transparent 86%);
}

.page-grid {
  display: grid;
  max-width: var(--max);
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 48px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.chapter-index {
  position: sticky;
  top: 86px;
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface-gray);
}

.chapter-index p {
  margin: 0 0 16px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chapter-index a {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.chapter-index a:hover {
  color: var(--primary);
}

.essay {
  min-width: 0;
}

.essay-section {
  border-top: 1px solid var(--line-strong);
  padding-top: 40px;
  margin-top: 56px;
  scroll-margin-top: 96px;
}

.essay > .essay-section:first-child {
  margin-top: 0;
}

.essay-section .essay-section {
  margin-top: 42px;
  padding-top: 32px;
  border-color: var(--line);
}

.essay-section-header {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.essay-section-header.no-number {
  grid-template-columns: minmax(0, 1fr);
  margin-left: 96px;
}

.section-number {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 32px;
}

h2,
h3 {
  margin: 0;
  color: var(--primary);
  font-weight: 600;
}

h2 {
  max-width: 840px;
  font-size: 32px;
  letter-spacing: -0.01em;
  line-height: 40px;
}

h3 {
  max-width: 760px;
  font-size: 24px;
  line-height: 32px;
}

.essay-body {
  max-width: 820px;
  margin-left: 96px;
}

.essay-body p,
.essay-body li,
blockquote {
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: calc(18px * var(--reading-scale, 1));
  line-height: calc(30px * var(--reading-scale, 1));
}

.essay-body p {
  margin: 0 0 20px;
}

blockquote {
  margin: 0 0 24px;
  padding: 22px 24px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--primary);
}

.content-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  margin: 24px 0 30px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.content-list li {
  position: relative;
  min-height: 54px;
  padding: 14px 0 14px 20px;
  border-bottom: 1px solid var(--line);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 24px;
}

.content-list li::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 0;
  width: 7px;
  height: 7px;
  background: var(--accent);
}

.next-page {
  max-width: var(--max);
  margin: 0 auto 80px;
  padding: 36px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.next-page a {
  display: inline-block;
  color: var(--primary);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.next-page a::after {
  content: " →";
  color: var(--accent);
}

.site-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 58px;
  align-items: center;
  gap: 16px;
  padding: 8px max(24px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface), transparent 5%);
  backdrop-filter: blur(18px);
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--primary);
  font-weight: 600;
}

.footer-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.footer-contact,
.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-contact {
  justify-self: center;
}

.footer-meta {
  justify-self: end;
  /* Reserva espacio para el botón flotante de subir (.floating-top) que se
     posiciona fijo en la esquina inferior derecha, sobre este borde. */
  padding-right: 56px;
}

.contact-icon,
.privacy-link,
.top-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-container);
}

.privacy-link {
  padding: 7px 11px;
}

.contact-icon {
  width: 42px;
  color: var(--primary);
}

.contact-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.contact-icon:hover,
.privacy-link:hover,
.top-link:hover {
  border-color: var(--accent);
  color: var(--primary);
}

.contact-icon.disabled {
  color: var(--muted);
  opacity: 0.68;
}

.top-link {
  width: 42px;
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  display: none;
}

.floating-top {
  position: fixed;
  right: max(24px, calc((100vw - var(--max)) / 2));
  bottom: 8px;
  z-index: 70;
  display: inline-flex;
  width: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-container);
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
}

.standalone-note {
  padding: 20px 24px;
  border: 1px solid var(--line);
  background: var(--surface-gray);
}

.load-error {
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 24px;
}

@media (max-width: 980px) {
  .site-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    max-width: 100vw;
  }

  .brand span:last-child,
  .main-nav {
    display: none;
  }

  .menu-button {
    display: block;
  }

  .theme-toggle {
    position: fixed;
    top: 14px;
    right: 16px;
    left: auto;
    z-index: 40;
    margin-left: auto;
    justify-self: end;
  }

  .text-size {
    position: fixed;
    top: 14px;
    right: 66px;
    left: auto;
    z-index: 40;
  }

  .mobile-nav {
    display: none;
    position: fixed;
    top: 78px;
    right: 16px;
    left: 16px;
    z-index: 42;
    padding: 16px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-container), transparent 4%);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
  }

  .mobile-nav.open {
    display: grid;
    gap: 8px;
  }

  .page-scrim {
    position: fixed;
    inset: 0;
    z-index: 41;
    display: none;
    background: color-mix(in srgb, var(--surface), transparent 20%);
    backdrop-filter: blur(8px);
  }

  body.menu-open .page-scrim {
    display: block;
  }

  .hero,
  .page-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100%;
    max-width: 100%;
  }

  .hero {
    padding: 32px 16px 24px;
  }

  .hero-copy,
  .hero-visual {
    min-height: auto;
  }

  .hero-visual {
    aspect-ratio: 4 / 3;
  }

  .page-grid {
    padding: 24px 16px 72px;
  }

  .chapter-index {
    position: static;
  }
}

@media (max-width: 640px) {
  .theme-toggle {
    width: 42px;
    height: 36px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .theme-toggle span {
    display: none;
  }

  .theme-toggle::before {
    content: "";
    width: 15px;
    height: 15px;
    border: 2px solid var(--primary);
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) 50%, transparent 50%);
  }

  h1 {
    max-width: 100%;
    font-size: 26px;
    letter-spacing: -0.01em;
    line-height: 34px;
  }

  h2 {
    font-size: 26px;
    line-height: 34px;
  }

  h3 {
    font-size: 21px;
    line-height: 30px;
  }

  .hero-copy {
    padding: 24px;
    min-width: 0;
  }

  .hero-copy > p:not(.eyebrow) {
    font-size: 18px;
    line-height: 29px;
  }

  .hero-visual ol {
    padding: 20px;
  }

  .essay-section-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .essay-section-header.no-number {
    margin-left: 0;
  }

  .essay-body {
    margin-left: 0;
  }

  .essay-body p,
  .essay-body li,
  blockquote {
    font-size: calc(17px * var(--reading-scale, 1));
    line-height: calc(29px * var(--reading-scale, 1));
  }

  .content-list {
    grid-template-columns: 1fr;
  }

  .next-page {
    margin-bottom: 48px;
    padding-inline: 16px;
  }

  .next-page a {
    font-size: 26px;
  }

  .site-footer {
    position: fixed;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: auto;
    max-width: none;
    min-height: 54px;
    gap: 6px;
    padding: 7px 8px 7px 16px;
  }

  .footer-title {
    min-width: 0;
    max-width: calc(100vw - 74px);
    font-size: 12px;
    line-height: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .footer-contact {
    display: none;
  }

  .footer-meta {
    position: static;
    display: flex;
    align-items: center;
    gap: 6px;
    /* Reserva espacio para el botón flotante de subir (.floating-top). */
    padding-right: 48px;
  }

  .privacy-link {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .top-link {
    display: none !important;
  }

  .floating-top {
    right: auto;
    left: calc(100% - 48px);
    bottom: 7px;
    width: 40px;
    min-height: 40px;
  }

  .mobile-contact .contact-icon {
    width: 100%;
    min-height: 52px;
  }
}
