/* ==============================================================
   CDI 2026 · Cálculo Diferencial e Integral — navegación y portada
   Paleta: verde pizarra + ocre (distinta del sitio CVV)
   ============================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #12302C;   /* verde pizarra de la barra            */
  --ink-2:      #1B403A;
  --paper:      #F7F3EC;   /* crema del fondo                      */
  --panel:      #FFFDF9;
  --ocre:       #B07A22;   /* acento principal                     */
  --ocre-lt:    #D9A441;
  --teal:       #008C82;   /* acento secundario (entornos ejemplo) */
  --rule:       #DED5C6;
  --rule-soft:  #ECE5DA;
  --muted:      #5E6B66;
  --nav-h:      74px;
  --shadow-nav: 0 1px 0 rgba(0,0,0,.06), 0 6px 22px rgba(18,48,44,.26);
}

html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
}

button { font: inherit; -webkit-tap-highlight-color: transparent; }
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ocre-lt);
  outline-offset: 2px;
}

/* ========================= BARRA ========================= */

.cdi-nav {
  position: relative;
  z-index: 400;
  display: flex;
  flex-shrink: 0;
  align-items: stretch;
  height: var(--nav-h);
  padding: 0 1.3rem;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border-bottom: 3px solid var(--ocre);
  box-shadow: var(--shadow-nav);
}

/* Marca: tres renglones integrados en la barra */
.brand {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 1.1rem 0 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-title {
  color: #fff;
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: .005em;
}

.brand-author {
  color: var(--ocre-lt);
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-size: .82rem;
  line-height: 1.05;
}

.brand-inst {
  color: rgba(255,255,255,.52);
  font-family: 'JetBrains Mono', monospace;
  font-size: .54rem;
  letter-spacing: .13em;
  line-height: 1.05;
  text-transform: uppercase;
}

.nav-rule {
  width: 1px;
  margin: 1.15rem .95rem;
  background: rgba(255,255,255,.14);
}

.nav-group { display: flex; align-items: stretch; }
.nav-spacer { flex: 1; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .9rem;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.80);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .18s ease;
}

/* Subrayado que crece: diferencia visual respecto al sitio CVV */
.nav-link::after {
  position: absolute;
  bottom: 18px;
  left: .9rem;
  right: .9rem;
  height: 1.5px;
  background: var(--ocre-lt);
  content: '';
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}

.nav-link:hover { color: #fff; }
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--ocre-lt); }

.ico {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-pill {
  align-self: center;
  margin-left: .45rem;
  padding: .48rem .85rem;
  border: 1px solid rgba(217,164,65,.45);
  border-radius: 2px;
  background: transparent;
  color: var(--ocre-lt);
  cursor: pointer;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.nav-pill:hover { border-color: var(--ocre-lt); background: rgba(217,164,65,.12); }

.nav-pill.solid {
  border-color: var(--ocre);
  background: var(--ocre);
  color: #fff;
}

.nav-pill.solid:hover { background: var(--ocre-lt); border-color: var(--ocre-lt); }

/* ===================== HAMBURGUESA ===================== */

.burger {
  display: none;
  width: 36px;
  align-self: center;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.burger span {
  height: 2.5px;
  border-radius: 2px;
  background: #fff;
  transition: transform .25s ease, opacity .25s ease;
}

.burger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ================= CAJÓN MÓVIL (ACORDEÓN) ================ */

.drawer-backdrop {
  position: fixed;
  inset: var(--nav-h) 0 0;
  z-index: 280;
  visibility: hidden;
  background: rgba(18,48,44,.42);
  opacity: 0;
  transition: opacity .2s ease, visibility .2s ease;
}

.drawer-backdrop.open { visibility: visible; opacity: 1; }

.drawer {
  position: fixed;
  top: var(--nav-h);
  right: 0;
  z-index: 380;
  visibility: hidden;
  width: min(90vw, 420px);
  height: calc(100% - var(--nav-h));
  overflow-y: auto;
  background: var(--paper);
  box-shadow: -10px 0 30px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateX(102%);
  transition: transform .28s ease, opacity .28s ease, visibility .28s ease;
}

.drawer.open { visibility: visible; opacity: 1; transform: translateX(0); }

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: .95rem 1.2rem;
  border-bottom: 2px solid var(--ocre);
  background: var(--ink);
  color: #fff;
  font-family: 'Spectral', Georgia, serif;
  font-size: 1rem;
}

.d-direct,
.d-chapter {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  min-height: 52px;
  padding: .8rem 1.2rem;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  text-align: left;
}

.d-direct:hover, .d-chapter:hover { background: #EFE9DE; }

.d-chapter-label {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
}

.d-num {
  color: var(--ocre);
  font-family: 'JetBrains Mono', monospace;
  font-size: .64rem;
}

.d-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
}

.d-item.expanded .d-chevron { transform: rotate(225deg); }

.d-sub {
  max-height: 0;
  overflow: hidden;
  background: #fff;
  transition: max-height .35s ease;
}

.d-item.expanded .d-sub { max-height: 2600px; }

.d-sub button {
  display: block;
  width: 100%;
  padding: .62rem 1.2rem .62rem 2.3rem;
  border: 0;
  border-bottom: 1px solid #F1EBE1;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .78rem;
  line-height: 1.35;
  text-align: left;
}

.d-sub button:hover { background: #EFE9DE; color: var(--ink); }

.d-sub .d-complete {
  border-left: 3px solid var(--teal);
  background: #EAF5F3;
  color: var(--ink);
  font-weight: 600;
  padding-left: 1.2rem;
}

.d-divider {
  height: 10px;
  border-top: 2px solid var(--ocre);
  background: #EDE6DA;
}

/* ========================= PORTADA ========================= */

#home {
  position: relative;
  flex: 1;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(176,122,34,.10), transparent 70%),
    var(--paper);
}

#frame {
  display: none;
  width: 100%;
  height: calc(100vh - var(--nav-h));
  flex: 1 1 auto;
  border: 0;
  background: #fff;
}

.hero {
  display: grid;
  max-width: 1000px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  margin: 0 auto;
  padding: 3.6rem 3rem 2.6rem;
}

.eyebrow {
  color: var(--ocre);
  font-family: 'JetBrains Mono', monospace;
  font-size: .64rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.hero h1 {
  margin-top: .9rem;
  color: var(--ink);
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -.015em;
}

.hero h1 em { color: var(--ocre); font-style: italic; }

.hero-sub {
  margin-top: .6rem;
  color: var(--muted);
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-size: 1.02rem;
}

.lead {
  max-width: 560px;
  margin-top: 1.3rem;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 300;
  line-height: 1.72;
}

.more-btn {
  margin-top: .7rem;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px dashed var(--ocre);
  background: none;
  color: var(--ocre);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.more-btn:hover { color: var(--teal); border-color: var(--teal); }

.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem;
  margin-top: 2rem;
}

.share-label {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.share-links { display: flex; flex-wrap: wrap; gap: .4rem; }

.share-link {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  text-decoration: none;
  transition: color .18s, border-color .18s, transform .18s, box-shadow .18s;
}

.share-link:hover {
  border-color: var(--ocre);
  color: var(--ocre);
  box-shadow: 0 4px 12px rgba(18,48,44,.1);
  transform: translateY(-2px);
}

.share-status {
  min-width: 6.5rem;
  color: var(--teal);
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  opacity: 0;
  transition: opacity .18s;
}

.share-status.visible { opacity: 1; }

.hero-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
  opacity: .5;
}

.hero-mark .sym {
  color: var(--ocre);
  font-family: 'Spectral', Georgia, serif;
  font-size: 8rem;
  line-height: .9;
}

.hero-mark .sym-sub {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  letter-spacing: .1em;
}

.rule {
  max-width: 1000px;
  margin: 0 auto;
  border: 0;
  border-top: 1px solid var(--rule);
}

.contents { max-width: 1000px; margin: 0 auto; padding: 2.6rem 3rem 1.6rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.1rem;
  margin-top: 1.3rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.3rem 1.2rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ocre);
  border-radius: 2px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, box-shadow .18s, transform .14s;
}

.card:hover {
  border-left-color: var(--teal);
  box-shadow: 0 10px 28px rgba(18,48,44,.11);
  transform: translateY(-2px);
}

.card-num {
  color: var(--ocre);
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.card-title {
  color: var(--ink);
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.15;
}

.card-meta {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 300;
}

.card-arrow {
  margin-top: .2rem;
  color: var(--teal);
  font-family: 'JetBrains Mono', monospace;
  font-size: .66rem;
  opacity: .75;
  transition: transform .18s, opacity .18s;
}

.card:hover .card-arrow { opacity: 1; transform: translateX(4px); }

.home-footer {
  display: flex;
  max-width: 1000px;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 2.4rem 3rem 2.6rem;
  border-top: 1px solid var(--rule);
}

.foot-brand { font-family: 'Spectral', Georgia, serif; font-size: .9rem; }

.foot-link {
  color: var(--muted);
  font-size: .78rem;
  text-decoration: none;
}

.foot-link:hover { color: var(--ocre); }

/* ========================== MODALES ========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(18,48,44,.55);
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

.modal-box {
  position: relative;
  width: min(620px, 100%);
  max-height: min(86vh, 780px);
  overflow-y: auto;
  padding: 2.2rem 2.4rem 2rem;
  border-top: 4px solid var(--ocre);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.modal-close {
  position: absolute;
  top: .8rem;
  right: .9rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.modal-close:hover { color: var(--ink); }

.modal-eyebrow {
  color: var(--teal);
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.modal-title {
  margin: .7rem 0 1.3rem;
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
}

.modal-block { margin-bottom: .2rem; }

.modal-label {
  display: block;
  margin-bottom: .4rem;
  color: var(--ocre);
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.modal-text { font-size: .86rem; font-weight: 300; line-height: 1.65; }
.modal-text a { color: var(--teal); text-decoration: none; overflow-wrap: anywhere; }
.modal-text a:hover { text-decoration: underline; }

.modal-note {
  margin-top: .8rem;
  padding: .7rem .85rem;
  border-left: 2px solid var(--ocre);
  background: rgba(176,122,34,.07);
  font-size: .8rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--muted);
}

.modal-rule { margin: 1.2rem 0; border: 0; border-top: 1px solid var(--rule); }

/* ========================= RESPONSIVE ======================== */

@media (max-width: 980px) {
  .nav-group, .nav-rule { display: none !important; }
  .burger { display: flex; }
  .cdi-nav { padding: 0 1rem; }

  .hero { grid-template-columns: 1fr; padding: 2.6rem 1.4rem 2rem; }
  .hero-mark { display: none; }
  .contents { padding: 2rem 1.4rem; }
  .cards { grid-template-columns: 1fr; }
  .home-footer { flex-direction: column; padding: 2rem 1.4rem; }
}

@media (min-width: 981px) {
  .drawer, .drawer-backdrop { display: none !important; }
}

@media (max-width: 520px) {
  :root { --nav-h: 70px; }
  .brand-title { font-size: .97rem; }
  .brand-author { font-size: .74rem; }
  .brand-inst { font-size: .47rem; letter-spacing: .08em; }
  .modal-box { padding: 1.9rem 1.3rem 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
