/* DeTown. · pagina publica. Mismo lenguaje visual del tablero privado (Fraunces, Inter, DM Mono; azul; modo claro y oscuro). */
:root {
  --bg: #F8F5EF; --raise: #efece4; --surface: #fffdf8; --fg: #1D1D1D; --mute: #6b665d; --line: rgba(29,29,29,.10);
  --accent: #30699b; --accent-ink: #f7fbff; --btn: #1D1D1D; --btn-ink: #F8F5EF;
  --shadow: 0 1px 2px rgba(29,29,29,.04), 0 8px 30px rgba(29,29,29,.06);
  --display: "Fraunces", Georgia, serif; --body: "Inter", system-ui, sans-serif; --mono: "DM Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #191919; --raise: #2a2a2a; --surface: #222; --fg: #ededed; --mute: #a0a0a0; --line: rgba(255,255,255,.12);
  --accent: #5e9fd4; --accent-ink: #0d1b28; --btn: #ededed; --btn-ink: #191919;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px rgba(0,0,0,.35); } }
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #191919; --raise: #2a2a2a; --surface: #222; --fg: #ededed; --mute: #a0a0a0; --line: rgba(255,255,255,.12);
  --accent: #5e9fd4; --accent-ink: #0d1b28; --btn: #ededed; --btn-ink: #191919;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 40px rgba(0,0,0,.35); }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 1.0625rem/1.55 var(--body); padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right)); }
body.reader-open { overflow: hidden; }
a { color: var(--accent); }
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn); color: var(--btn-ink); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 12px; }
.top, main, .foot { max-width: 1040px; margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 0 10px; }
.brand { font: 700 1.5rem/1 var(--display); color: var(--fg); text-decoration: none; letter-spacing: -0.03em; }
.top-tools { display: flex; gap: 6px; }
.tool { min-width: 42px; min-height: 42px; display: inline-grid; place-items: center; border: 1.5px solid var(--line); border-radius: 12px; color: var(--fg); text-decoration: none; font: 600 0.78rem/1 var(--mono); }
.tool:hover { border-color: var(--accent); }
.hero { padding: 28px 0 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.eyebrow { font: 600 0.8rem/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0; }
.hero h1 { font-size: clamp(1.55rem, 6.6vw, 3.1rem); line-height: 1.1; max-width: none; text-wrap: wrap; }
.hero h1 span { display: block; }
.lede { margin: 0; color: var(--mute); max-width: 52ch; }
.cta { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 26px; border-radius: 14px; background: var(--btn); color: var(--btn-ink); font-weight: 600; text-decoration: none; transition: transform .18s var(--ease); }
.cta:hover { transform: translateY(-1px); }
.cta.ghost { background: none; color: var(--accent); border: 1.5px solid var(--accent); }
#chapters h2 { font-size: 1.35rem; margin: 18px 0 14px; }
.grid { list-style: none; margin: 0; padding: 0 0 36px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
.ep { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--fg); }
.ep-img { display: block; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: var(--raise); box-shadow: var(--shadow); transition: transform .25s var(--ease); }
.ep:hover .ep-img { transform: translateY(-3px); }
.ep-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-n { font: 500 0.72rem/1 var(--mono); color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.ep-t { font: 500 0.88rem/1.3 var(--body); text-wrap: balance; }
.foot { border-top: 1px solid var(--line); padding: 22px 0 max(28px, env(safe-area-inset-bottom)); color: var(--mute); font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.foot p { margin: 0; } .foot .small { font-size: 0.78rem; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 22px 16px; } }

/* ---- lector ---- */
.reader { --rh: calc(100dvh - 190px); position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.rtitle { margin-right: auto; min-width: 0; font: 500 0.8rem/1.25 var(--mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rhead button { min-height: 40px; min-width: 40px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); font-size: 0.82rem; font-weight: 500; }
.rtitle { flex: 1 1 0; order: 1; } .rshare { order: 2; } .rbreak { flex-basis: 100%; height: 0; order: 3; } .rhead .tg { order: 4; flex: 1 1 40%; }
@media (min-width: 700px) { .rbreak { display: none; } .rhead .tg { order: 2; flex: 0 0 auto; } .rshare { order: 3; } }
.rhead button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: transparent; font-weight: 600; }
.rrow { flex: 1; min-height: 0; display: flex; align-items: center; gap: 14px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 12px max(16px, env(safe-area-inset-left)); scrollbar-width: none; outline: none; cursor: grab; }
.rrow::-webkit-scrollbar { display: none; }
.rrow.rdrag { cursor: grabbing; user-select: none; } .rrow.rdrag img { pointer-events: none; }
.rslide, .rtira { flex: 0 0 auto; margin: 0; position: relative; scroll-snap-align: center; border-radius: 12px; overflow: hidden; background: var(--raise); box-shadow: var(--shadow); height: min(var(--rh), calc(92vw * 1.25)); cursor: pointer; }
.rslide { aspect-ratio: 4 / 5; }
.rslide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rtira { width: min(92vw, 460px); height: var(--rh); }   /* la tira usa todo el alto disponible: es una hoja para bajar con el dedo */
.rscroll { height: 100%; overflow-y: auto; overscroll-behavior-y: contain; overscroll-behavior-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rscroll::-webkit-scrollbar { display: none; }
.rscroll img { width: 100%; height: auto; display: block; background: var(--raise); }
.rtag { position: absolute; left: 10px; top: 10px; font: 600 0.72rem/1 var(--mono); background: rgba(10,18,45,.78); color: #fff4dc; padding: 6px 9px; border-radius: 99px; pointer-events: none; }
.rhint { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 0 10px; text-align: center; font: 600 0.74rem/1 var(--mono); color: #fff4dc; background: linear-gradient(to top, rgba(10,18,45,.85), rgba(10,18,45,0)); pointer-events: none; transition: opacity .3s; }
.rhint.gone { opacity: 0; }
.rsep { flex: 0 0 168px; height: min(var(--rh), 460px); scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 0 16px; margin: 0 22px; border-left: 2px dashed var(--line); border-right: 2px dashed var(--line); color: var(--mute); cursor: pointer; }
.rs-dots { letter-spacing: 0.4em; color: var(--accent); font-weight: 700; }
.rs-kicker { font: 500 0.7rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.rs-id { font: 700 2.2rem/1 var(--display); color: var(--accent); letter-spacing: -0.02em; }
.rs-title { font: 500 0.92rem/1.3 var(--body); color: var(--fg); text-wrap: balance; }
.rs-n { font: 400 0.74rem/1 var(--mono); }
.rs-go { font-size: 1.8rem; line-height: 1; color: var(--accent); }
.rend { cursor: default; } .rend .rs-go { display: none; }
.rfoot { display: flex; align-items: center; gap: 10px; padding: 8px max(14px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 0.82rem; }
.rfoot button { min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); font-weight: 500; }
.rprog { flex: 1; height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; } .rprog b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s var(--ease); }
@media (min-width: 900px) { .reader { --rh: calc(100dvh - 200px); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* capitulos que aun no estan en las redes */
.ep.soon { opacity: .42; cursor: default; pointer-events: none; }
.ep.soon .ep-img { box-shadow: none; border: 1.5px dashed var(--line); background: repeating-linear-gradient(135deg, transparent 0 8px, var(--line) 8px 9px); display: grid; place-items: center; }
.soon-tag { font: 600 0.78rem/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.ep.soon .ep-t { color: var(--mute); }

.follow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; }
.follow span { font: 500 0.78rem/1 var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: 0.08em; margin-right: 4px; }
.follow a { min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 99px; color: var(--fg); font-size: 0.86rem; font-weight: 500; text-decoration: none; }
.follow a:hover { border-color: var(--accent); color: var(--accent); }

/* ---- acciones: me gusta, comentarios, compartir, guardar ---- */
.chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 14px; }
.chead h2 { font-size: 1.35rem; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); font-size: 0.86rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.grid li { position: relative; }
.fav { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,18,45,.62); color: #fff4dc; backdrop-filter: blur(4px); }
.fav .ico svg { width: 20px; height: 20px; }
.fav[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.ep-likes { font: 500 0.74rem/1 var(--mono); color: var(--mute); }
.rchap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rslides { display: flex; gap: 14px; }
.rchap .rslide { height: min(calc(var(--rh) - 56px), calc(92vw * 1.25)); }   /* nunca mas ancha que la pantalla */
.rchap .rtira { height: calc(var(--rh) - 56px); }
.ract { display: flex; justify-content: center; gap: 6px; padding: 2px 0; width: min(92vw, 460px); position: sticky; left: 0; }
.ract button { min-height: 46px; min-width: 64px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--fg); }
.ract button:hover { background: var(--raise); }
.ract .n { font: 500 0.82rem/1 var(--mono); min-width: 0; }
.ract .n:empty { display: none; }
.ract button[aria-pressed="true"] { color: var(--accent); }
.ract button[aria-pressed="true"] svg { fill: currentColor; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--btn); color: var(--btn-ink); padding: 12px 20px; border-radius: 99px; font-size: 0.9rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.csheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: end center; }
.cbox { width: min(100%, 560px); max-height: calc(var(--vh, 100dvh) * 0.92); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0; box-shadow: var(--shadow); padding: 16px 16px max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.chead2 { display: flex; align-items: center; justify-content: space-between; } .chead2 h2 { font-size: 1.1rem; }
.cclose { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line); }
.cnote { margin: 0; font-size: 0.82rem; color: var(--mute); }
.clist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.citem { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.citem p { margin: 4px 0 6px; overflow-wrap: anywhere; }
.cwhen { margin-left: 8px; font: 400 0.74rem/1 var(--mono); color: var(--mute); }
.creport { font-size: 0.74rem; color: var(--mute); text-decoration: underline; min-height: 28px; }
.cform { display: flex; flex-direction: column; gap: 8px; }
.cform input[type="text"], .cform textarea { font: inherit; font-size: 1rem; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--raise); color: var(--fg); width: 100%; resize: vertical; }
.cform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.csend { min-height: 48px; border-radius: 12px; background: var(--btn); color: var(--btn-ink); font-weight: 600; }
.csend:disabled { opacity: .6; }
.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ico svg { display: block; }
.fav { display: flex; align-items: center; justify-content: center; padding: 0; line-height: 0; }
.fav .ico svg { width: 20px; height: 20px; }

/* idiomas y globos traducidos */
@font-face { font-family: "PatrickHand"; src: url("fonts/PatrickHand-Regular.ttf"); font-display: swap; }
@font-face { font-family: "Bangers"; src: url("fonts/Bangers-Regular.ttf"); font-display: swap; }
.top-tools { display: flex; align-items: center; gap: 8px; }
.langs { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.langs a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 8px; font: 500 0.78rem/1 var(--mono); letter-spacing: 0.04em; color: var(--mute); text-decoration: none; }
.langs a[aria-current="true"] { background: var(--btn); color: var(--btn-ink); font-weight: 600; }
.rwrap { position: relative; }
.rwrap img { display: block; width: 100%; height: auto; }
.glayer { position: absolute; left: 0; top: 0; width: 1080px; transform-origin: 0 0; pointer-events: none; }
.gb { position: absolute; transform-origin: 50% 50%; }
.gb svg { position: absolute; left: 0; top: 0; overflow: visible; }
.gtx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; padding-left: 30px; text-align: center; overflow: hidden; }
.gin { transform-origin: 0 0; text-align: center; }

/* ---- enlaces de Personajes e Ideas bajo la cabecera ---- */
.subnav { max-width: 1040px; margin-inline: auto; display: flex; gap: 8px; flex-wrap: wrap; padding: 0 0 6px; }
.subnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--fg); text-decoration: none; font: 600 0.88rem/1 var(--body); }
.subnav a:hover, .subnav a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }

/* ---- invitacion a votar y a escribir (inicio y capitulos) ---- */
.invite { margin: 8px 0 28px; padding: 18px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.invite h2 { font-size: 1.2rem; }
.invite p { margin: 0; }
.invite a { font-weight: 600; }

/* ---- cabecera: marca a la izquierda; a la derecha idiomas y tema, y debajo del tema los iconos de inicio, personajes y enviar historia, en columna ---- */
.top { align-items: flex-start; }
.top-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.iconnav { display: flex; flex-direction: column; gap: 8px; }
.iconnav .tool[aria-current="page"] { border-color: var(--accent); color: var(--accent); }

/* navegacion en iconos fuera del flujo: el texto de cada pagina empieza arriba */
.top-tools { position: relative; }
.iconnav { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: flex; flex-direction: column; gap: 8px; }   /* PC: justo debajo del boton de modo oscuro y claro, fuera del flujo */
.top-tools { align-items: center; }
@media (max-width: 899px) {
  .iconnav { position: fixed; top: auto; right: auto; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); flex-direction: row; gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
  body { padding-bottom: 84px; }
}
