/* Aluna Estudio — sitio público
   Paleta tomada del logo: rosa del corazón, celeste de las páginas, crema del papel, amarillo de la estrella. */
:root {
  --paper: #FFF8F5;
  --paper-2: #FFFFFF;
  --ink: #2E2640;
  --ink-2: #6B6180;
  --ink-3: #9C93AC;
  --line: #F0E3DE;
  --rosa: #FB7A9E;
  --rosa-ink: #C2366A;
  --rosa-soft: #FFE3EB;
  --cielo: #5DBDEA;
  --cielo-ink: #1F7AAB;
  --cielo-soft: #DDF1FB;
  --crema: #F9E6CF;
  --sol: #F7C85C;
  --wa: #1E9E57;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(120, 60, 80, .06), 0 6px 18px rgba(120, 60, 80, .07);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Figtree', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill, svg .fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 3px solid var(--cielo); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { font-family: var(--serif); font-variation-settings: 'SOFT' 100; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.center { text-align: center; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(255, 248, 245, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font-family: var(--serif); font-variation-settings: 'SOFT' 100; font-size: 22px; color: var(--rosa-ink); font-weight: 600; }
.brand small { font-size: 12px; color: var(--cielo-ink); letter-spacing: .12em; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: var(--rosa-soft); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.pill svg { width: 18px; height: 18px; }
.pill.small { padding: 7px 12px; font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 22px; border-radius: 999px; border: 0;
  background: var(--rosa-ink); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .12s, background .2s; }
.btn:active { transform: scale(.98); }
.btn:hover { background: #AE2C5D; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.soft { background: var(--rosa-soft); color: var(--rosa-ink); }
.btn.wa { background: var(--wa); width: 100%; }
.btn.wa:hover { background: #17864A; }
.btn.wa svg { width: 22px; height: 22px; }
.btn svg { width: 20px; height: 20px; }

/* ---------- hero ---------- */
.hero { display: grid; gap: 28px; padding: 32px 0 12px; align-items: center; }
.hero h1 { font-size: clamp(34px, 9vw, 56px); max-width: 14ch; }
.hero p { color: var(--ink-2); font-size: 17px; max-width: 48ch; margin: 14px 0 22px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--paper-2); border-radius: 999px; padding: 0 18px; box-shadow: var(--shadow); max-width: 520px; }
.search svg { color: var(--ink-3); }
.search input { flex: 1; border: 0; background: transparent; padding: 15px 0; font: inherit; font-size: 16px; color: var(--ink); min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 3px var(--cielo-soft), var(--shadow); }
.search.big { margin: 24px 0 8px; max-width: none; }
.hero-fan { position: relative; height: 210px; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; margin: -8px -16px 0; padding-bottom: 8px; }
.hero-fan .cover { position: absolute; bottom: 8px; width: 128px; box-shadow: 0 10px 30px rgba(120, 60, 80, .16); }
.hero-fan .cover:nth-child(1) { transform: translateX(-78px) rotate(-9deg); }
.hero-fan .cover:nth-child(2) { transform: translateY(-12px); z-index: 2; }
.hero-fan .cover:nth-child(3) { transform: translateX(78px) rotate(8deg); }
.hero-fan .cover.lg .cover-title { font-size: 16px; }
@media (min-width: 820px) {
  .hero { grid-template-columns: 1.1fr .9fr; padding: 56px 0 24px; }
  .hero-fan { height: 360px; margin: 0; overflow: visible; }
  .hero-fan .cover { width: 190px; }
  .hero-fan .cover.lg .cover-title { font-size: 21px; }
  .hero-fan .cover:nth-child(1) { transform: translateX(-120px) rotate(-9deg); }
  .hero-fan .cover:nth-child(3) { transform: translateX(120px) rotate(8deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-fan .cover { animation: deal .7s cubic-bezier(.2, .8, .2, 1) both; }
  .hero-fan .cover:nth-child(2) { animation-delay: .08s; }
  .hero-fan .cover:nth-child(3) { animation-delay: .16s; }
  @keyframes deal { from { opacity: 0; translate: 0 30px; } }
}

/* ---------- portadas tipo cuaderno ---------- */
.cover { position: relative; aspect-ratio: 3 / 4; border-radius: 4px 12px 12px 4px; overflow: hidden; display: flex; flex-direction: column;
  padding: 14px 12px 30px 20px; background: var(--c-bg); color: var(--ink); isolation: isolate; }
.cover::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--c-spine); }
.cover-type { font-size: 11px; font-weight: 700; color: var(--c-ink); background: rgba(255, 255, 255, .7); align-self: flex-start; padding: 3px 8px; border-radius: 999px; }
.cover-title { font-family: var(--serif); font-variation-settings: 'SOFT' 100; font-weight: 600; font-size: 17px; line-height: 1.15; margin-top: 10px;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cover-subject { margin-top: auto; font-size: 11px; color: var(--c-ink); font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cover-pages { position: absolute; left: 8px; right: 0; bottom: 0; height: 22px; }
.cover-pages i { position: absolute; left: 0; right: 0; height: 7px; }
.cover-pages i:nth-child(1) { bottom: 14px; background: var(--rosa); }
.cover-pages i:nth-child(2) { bottom: 7px; background: var(--cielo); }
.cover-pages i:nth-child(3) { bottom: 0; background: var(--crema); }
.cover.lg .cover-title { font-size: 21px; }
.cover.xl { padding: 22px 20px 44px 30px; }
.cover.xl::before { width: 12px; }
.cover.xl .cover-title { font-size: clamp(24px, 6vw, 32px); }
.cover.xl .cover-type, .cover.xl .cover-subject { font-size: 13px; }
.cover.xl .cover-pages { height: 33px; left: 12px; }
.cover.xl .cover-pages i { height: 11px; }
.cover.xl .cover-pages i:nth-child(1) { bottom: 22px; } .cover.xl .cover-pages i:nth-child(2) { bottom: 11px; }
.cover.has-img { padding: 0; background: var(--crema); }
.cover.has-img img { width: 100%; height: 100%; object-fit: cover; }

.tone-rosa { --c-bg: #FFE0E9; --c-spine: #F58FAE; --c-ink: #B03363; }
.tone-cielo { --c-bg: #DBF0FB; --c-spine: #74C6EC; --c-ink: #1D6E99; }
.tone-crema { --c-bg: #FBEBD8; --c-spine: #E8C39A; --c-ink: #8A5A26; }
.tone-sol { --c-bg: #FFF1C9; --c-spine: #F2C553; --c-ink: #866112; }
.tone-lila { --c-bg: #EEE6FF; --c-spine: #B9A3EE; --c-ink: #5F449E; }
.tone-menta { --c-bg: #DDF4EA; --c-spine: #87D2B0; --c-ink: #22744F; }
.tone-crema .cover-pages i:nth-child(3), .tone-sol .cover-pages i:nth-child(3) { background: #fff; }

/* ---------- bloques ---------- */
.block { padding: 28px 0 8px; }
.block.narrow { max-width: 620px; margin: 0 auto; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h2 { font-size: 24px; }
.block-head small { color: var(--ink-3); font-weight: 600; }
.page-title { font-size: 30px; margin: 8px 0 10px; }
.empty { text-align: center; color: var(--ink-2); padding: 28px 8px; }
.empty p { max-width: 40ch; margin: 0 auto 16px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; margin-top: 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 16px; border-radius: 999px; border: 0; background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--line); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }
.chips.sticky { position: sticky; top: 64px; z-index: 10; background: var(--paper); margin: 0 -16px; padding: 10px 16px; }

.subjects { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .subjects { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .subjects { grid-template-columns: 1fr 1fr 1fr; } }
.subject { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius); background: var(--paper-2); text-decoration: none; box-shadow: var(--shadow); }
.subject-initial { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--c-bg); color: var(--c-ink);
  font-family: var(--serif); font-variation-settings: 'SOFT' 100; font-size: 26px; font-weight: 600; flex: none; border-left: 5px solid var(--c-spine); }
.subject-text { display: flex; flex-direction: column; min-width: 0; }
.subject-text b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-text small { color: var(--ink-2); font-size: 13px; }
.subjects.compact { margin-bottom: 18px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; }
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll > * { scroll-snap-align: start; }
@media (min-width: 640px) { .row-scroll { grid-auto-columns: 30%; } }
@media (min-width: 900px) { .row-scroll { grid-auto-columns: 22%; } }

.card { display: flex; flex-direction: column; gap: 8px; }
.card-link { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.card .cover { box-shadow: var(--shadow); }
.card h3 { font-family: var(--sans); font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.price { font-weight: 700; font-size: 15px; }
.price.free { color: var(--wa); }
.mini-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 0; background: var(--rosa-soft); color: var(--rosa-ink); text-decoration: none; flex: none; transition: background .2s, transform .15s; }
.mini-btn svg { width: 20px; height: 20px; stroke-width: 2.2; }
.mini-btn.added { background: var(--rosa-ink); color: #fff; }
.mini-btn.ghost { background: var(--cielo-soft); color: var(--cielo-ink); }
.mini-btn:active { transform: scale(.9); }

.steps { margin-top: 18px; }
.steps h2 { font-size: 24px; margin-bottom: 16px; }
.steps ol { list-style: none; counter-reset: s; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
@media (min-width: 760px) { .steps ol { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 2px 12px; background: var(--paper-2); border-radius: var(--radius); padding: 16px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--cielo-soft); color: var(--cielo-ink); font-family: var(--serif); font-weight: 600; font-size: 20px; }
.steps li span { color: var(--ink-2); font-size: 15px; }

/* ---------- materia ---------- */
.subject-hero { margin: 16px -16px 0; padding: 18px 16px 24px; background: var(--c-bg); border-radius: 0 0 28px 28px; position: relative; overflow: hidden; }
.subject-hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(var(--rosa) 0 33%, var(--cielo) 33% 66%, var(--crema) 66%); }
@media (min-width: 720px) { .subject-hero { margin: 16px 0 0; border-radius: 28px; padding: 24px 28px 32px; } }
.subject-hero h1 { font-size: clamp(32px, 8vw, 46px); margin: 10px 0 6px; }
.subject-hero p { margin: 0 0 8px; max-width: 60ch; }
.subject-hero small { color: var(--c-ink); font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; margin-top: 12px; }
.back svg { width: 18px; height: 18px; }

/* ---------- detalle ---------- */
.detail { padding-top: 4px; }
.detail-grid { display: grid; gap: 22px; margin-top: 14px; }
.detail-cover { max-width: 280px; width: 70%; margin: 0 auto; }
.detail-cover .cover { box-shadow: 0 16px 40px rgba(120, 60, 80, .18); }
@media (min-width: 760px) { .detail-grid { grid-template-columns: 320px 1fr; gap: 40px; } .detail-cover { width: 100%; margin: 0; } }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tag { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--rosa-soft); color: var(--rosa-ink); }
.tag.line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-2); }
.detail h1 { font-size: clamp(28px, 7vw, 40px); }
.detail-price { font-size: 26px; font-weight: 700; margin: 12px 0 16px; }
.detail-price.free { color: var(--wa); }
.prose { color: var(--ink-2); max-width: 62ch; }
.prose p { margin: 0 0 12px; }
.detail-actions { display: grid; gap: 10px; margin: 20px 0 14px; max-width: 420px; }
.note { display: flex; gap: 8px; color: var(--ink-2); font-size: 14px; max-width: 56ch; }
.note svg { width: 18px; height: 18px; margin-top: 2px; color: var(--ink-3); }
.pack-list h2 { font-size: 18px; margin: 18px 0 8px; }
.pack-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pack-list li { background: var(--paper-2); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.pack-list a { font-weight: 600; text-decoration: none; }
.pack-list small { color: var(--ink-2); }

/* ---------- carrito ---------- */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + var(--safe-b)); pointer-events: none; }
.cartbar a { pointer-events: auto; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; box-shadow: 0 10px 30px rgba(46, 38, 64, .3); }
.cb-count { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--rosa); display: grid; place-items: center; font-size: 15px; }
.cb-label { flex: 1; }
@media (prefers-reduced-motion: no-preference) { .cartbar.bump a { animation: bump .35s; } @keyframes bump { 40% { transform: scale(1.04); } } }

.cart-list { display: grid; gap: 10px; margin: 12px 0 18px; }
.cart-item { display: flex; align-items: center; gap: 12px; background: var(--paper-2); border-radius: 16px; padding: 12px 12px 12px 16px; box-shadow: var(--shadow); }
.cart-item div { flex: 1; min-width: 0; }
.cart-item b { display: block; font-weight: 600; }
.cart-item small { color: var(--ink-2); }
.cart-item .price { white-space: nowrap; }
.cart-item button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink-2); font-size: 20px; line-height: 1; }
.cart-form { display: grid; gap: 14px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; padding: 4px 4px 8px; border-bottom: 1px dashed var(--line); }
.cart-total b { font-size: 24px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--ink-2); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; width: 100%; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cielo); box-shadow: 0 0 0 3px var(--cielo-soft); }

/* ---------- acceso ---------- */
.access { text-align: center; padding-top: 40px; }
.access-icon { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--rosa-soft); color: var(--rosa-ink); }
.access-icon svg { width: 34px; height: 34px; }
.code-form { display: grid; gap: 12px; max-width: 340px; margin: 22px auto; }
.code-form input { text-align: center; font-size: 26px; letter-spacing: .15em; font-weight: 700; text-transform: uppercase; padding: 16px; }
.code-form input[aria-invalid] { border-color: var(--rosa-ink); }
.error { color: var(--rosa-ink); font-weight: 600; margin: 0; }

/* ---------- footer ---------- */
.foot { text-align: center; padding: 40px 16px 120px; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--line); margin-top: 40px; }
.foot img { margin: 0 auto 8px; width: 64px; height: 64px; }
.foot-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.foot-links a { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; font-weight: 600; color: var(--ink); }
.foot-links svg { width: 18px; height: 18px; }

.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.file-img { border-radius: 12px; margin: 16px 0; }

/* ---------- visor ---------- */
body.viewer { background: #3A3150; -webkit-user-select: none; user-select: none; }
.vbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 8px 8px; background: #2E2640; color: #fff; }
.vbar .icon-btn { color: #fff; }
.vbar .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.vtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.vtitle b { font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vtitle small { color: #C9C0D8; font-size: 12px; }
.vzoom { display: flex; gap: 4px; }
.vzoom button { width: 38px; height: 38px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 20px; }
.vpages { padding: 12px 8px 140px; display: flex; flex-direction: column; align-items: center; gap: 10px; overflow-x: auto; }
.vpage { position: relative; background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); max-width: none; }
.vpage canvas { display: block; width: 100%; height: 100%; }
.vpage .wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: rgba(194, 54, 106, .09); font: 700 clamp(18px, 5vw, 42px) var(--sans); transform: rotate(-30deg); white-space: nowrap; }
.vpages .msg { color: #fff; text-align: center; padding: 40px 16px; }
.vcta { position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); padding: 14px 16px calc(14px + var(--safe-b)); display: flex; align-items: center; gap: 12px; justify-content: center; box-shadow: 0 -6px 20px rgba(0, 0, 0, .2); }
.vcta p { margin: 0; font-weight: 600; }
.vcta .btn { white-space: nowrap; }
@media print { body.viewer * { display: none !important; } }
