/*
 * The app around the book: shell, landing, the character studio and the book
 * workspace. Tokens live in tokens.css; how a book page is drawn, in book.css.
 * Mobile first; the same markup turns into a workspace on tablets and desktops.
 */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100svh; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; --tabbar-offset: 0px; }
body.has-tabbar { --tabbar-offset: calc(var(--tabbar-h) + var(--safe-b)); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.8rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-2); text-underline-offset: 2px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px clamp(16px, 4vw, 40px) calc(72px + var(--tabbar-offset)); }
.container--narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--jade); }
.eyebrow::before { content: ''; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 56ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.25em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 22px; border: 1px solid transparent; border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-s); transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s, color .15s, border-color .15s; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: var(--shadow-s); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(200, 80, 58, .28); }
.btn-primary:hover { background: var(--accent-2); box-shadow: 0 8px 22px rgba(200, 80, 58, .32); }
.btn-secondary { background: var(--jade); color: #fff; }
.btn-secondary:hover { background: var(--jade-2); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); }
.btn-quiet { background: transparent; box-shadow: none; color: var(--ink-2); padding-inline: 12px; }
.btn-quiet:hover { background: var(--surface); box-shadow: none; }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: .92rem; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.08rem; }
.btn-block { width: 100%; }
.btn-whatsapp { background: #25D366; color: #FFFFFF; }
.btn-whatsapp:hover { background: #1EBE5A; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn[aria-busy=true] { cursor: progress; color: var(--ink); background: linear-gradient(110deg, #FFC9D8, #FFE2BD, #C8F0DF, #C5E2FF, #DCCBFF, #FFC9D8) 0 0 / 300% 100%; animation: btn-iris 2.5s linear infinite; }
@keyframes btn-iris { to { background-position: 150% 0; } }
.icon-button { width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-s); transition: border-color .15s, color .15s, transform .15s; -webkit-tap-highlight-color: transparent; }
.icon-button .icon { width: 20px; height: 20px; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button:active { transform: scale(.94); }
.icon-button[disabled] { opacity: .35; cursor: default; }
.icon-button--sm { width: 34px; height: 34px; }
.icon-button--sm .icon { width: 16px; height: 16px; }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; color: inherit; }
.link-button:hover { color: var(--accent); }

/* ---------- forms ---------- */
.form { display: grid; gap: 20px; }
.field { display: grid; gap: 6px; }
.field > span:first-child, .field__label, .form label > span:first-child { font-weight: 600; font-size: .95rem; }
.field__hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.field__error { font-size: .85rem; color: var(--error-ink); }
.form input[aria-invalid=true] { border-color: var(--error-ink); }
.input, .form input[type=text], .form input[type=url], .form input[type=email], .form input[type=password], .form textarea, .form select, select { width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; }
.form textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.form input:focus, .form textarea:focus, .form select:focus, .input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
select, .form select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237D7069' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.form ::placeholder { color: #A99D95; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-actions--sticky { position: sticky; bottom: calc(var(--tabbar-offset) + 12px); z-index: 4; margin: 4px -4px 0; padding: 10px; border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 86%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (min-width: 760px) { .form-actions--sticky { position: static; margin: 0; padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* choice tiles (who is it?), segmented tabs, chips */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: 0; padding: 0; margin: 0; }
.tiles legend, .segmented legend, .chips legend, .layouts legend, .style-picker legend, .preset-set legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.tile { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile .icon { grid-row: span 2; width: 36px; height: 36px; padding: 8px; border-radius: 12px; background: var(--paper-2); color: var(--ink-2); }
.tile strong { font-weight: 600; font-size: .95rem; }
.tile small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow-s); }
.tile:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.tile:has(input:checked) .icon { background: var(--accent); color: #fff; }
.tile:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
@media (max-width: 420px) { .tile small { display: none; } .tile { padding: 12px; } }
.segmented { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; font-size: .92rem; line-height: 1.45; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.check:has(input:checked) { border-color: var(--jade); background: var(--jade-soft); }
.tabs { display: flex; gap: 4px; background: var(--paper-2); border-radius: 999px; padding: 4px; }
.tab { position: relative; flex: 1; display: flex !important; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 999px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--ink-2); transition: background .15s, color .15s, box-shadow .15s; }
.tab input { position: absolute; opacity: 0; pointer-events: none; }
.tab .icon { width: 18px; height: 18px; }
.tab:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }
.tab:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.tab-panel { display: none; gap: 18px; }
.form:has(input[name=mode][value=photo]:checked) .tab-panel--photo,
.form:has(input[name=mode][value=preset]:checked) .tab-panel--preset { display: grid; }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chip { display: inline-flex !important; gap: 8px; align-items: center; min-height: 40px; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 500 !important; font-size: .92rem; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.chip input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.chip__avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--paper-2); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

/* photo dropzone */
.dropzone { position: relative; display: grid; gap: 10px; justify-items: center; text-align: center; padding: 22px 16px; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone--over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__icon { width: 52px; height: 52px; padding: 12px; border-radius: 50%; background: var(--paper-2); color: var(--ink-2); }
.dropzone__title { font-weight: 600; }
.dropzone__hint { margin: 0; color: var(--muted); font-size: .85rem; max-width: 36ch; }
.dropzone__previews { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dropzone__previews:empty { display: none; }
.dropzone__previews img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow-s); border: 2px solid #fff; }
.dropzone__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.dropzone__gallery { pointer-events: none; }
.dropzone--filled { border-style: solid; }
.capture-only { display: none; }
@media (hover: none) and (pointer: coarse) { .capture-only { display: inline-flex; } }

/* ---------- cards, alerts, toasts ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-s); }
.card--flat { box-shadow: none; }
.alert { border-radius: var(--radius-s); padding: 12px 16px; margin: 0; font-size: .95rem; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--error-bg); color: var(--error-ink); }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.toast-stack { position: fixed; left: 50%; bottom: calc(var(--tabbar-offset) + 16px); z-index: 50; display: grid; gap: 8px; width: min(92vw, 440px); transform: translateX(-50%); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--ink); color: #FFF9F2; box-shadow: var(--shadow-l); font-size: .95rem; animation: toast-in .35s var(--ease) both; }
.toast--error { background: var(--error-ink); }
.toast__close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 6px; border-radius: 50%; display: grid; }
.toast__close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- shell: header, nav, tab bar ---------- */
.site-header { position: sticky; top: 0; z-index: 20; padding-top: var(--safe-t); background: color-mix(in srgb, var(--paper) 82%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.site-header__inner { height: var(--header-h); max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; border-radius: 8px; }
.brand__logo { display: block; width: auto; height: 30px; } /* the lockup, 4.79:1 */
@media (max-width: 380px) { .brand__logo { height: 26px; } }
@media (max-width: 359px) { .site-header__inner { gap: 8px; } .brand__logo { height: 22px; } } /* logo + "Crear mi libro" + account fit on 320px phones */
@media (min-width: 760px) { .brand__logo { height: 38px; } }
.nav { display: none; margin-left: auto; align-items: center; gap: 4px; }
.nav__link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
@media (max-width: 1040px) { .nav__link { padding: 8px 10px; font-size: .92rem; } .nav__link--optional { display: none; } .nav .btn { white-space: nowrap; } }
.nav__link:hover { background: var(--surface); color: var(--ink); }
.nav__link--active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }
.nav__link .icon { width: 18px; height: 18px; }
.nav .btn { margin-left: 8px; }
@media (min-width: 760px) { .nav { display: flex; } }
.header-cta { margin-left: auto; white-space: nowrap; }
@media (min-width: 760px) { .header-cta { display: none; } }
.header-account { flex-shrink: 0; margin-left: auto; width: 38px; height: 38px; box-shadow: none; }
.header-cta + .header-account { margin-left: 0; }
@media (min-width: 760px) { .header-account { display: none; } }
@media (max-width: 1040px) { .nav__link--account span { display: none; } }
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); border-top: 1px solid var(--line); }
.tabbar__item { display: grid; justify-items: center; gap: 3px; padding: 6px 4px; border-radius: 12px; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tabbar__item .icon { width: 24px; height: 24px; }
.tabbar__item--active { color: var(--accent); }
.tabbar__item:active { background: var(--paper-2); }
@media (max-width: 759px) { body.has-tabbar .tabbar { display: grid; } }

/* progress stepper: Personajes → Libro → Compartir */
.stepper { display: grid; gap: 8px; margin: 4px 0 20px; }
.stepper__bars { display: flex; gap: 6px; }
.stepper__bars i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.stepper__bars i.is-done { background: var(--jade); }
.stepper__bars i.is-current { background: var(--accent); }
.stepper__label { font-size: .85rem; color: var(--muted); font-weight: 500; }
.stepper__label strong { color: var(--ink); }

/* page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- landing ---------- */
.hero { display: grid; gap: 36px; padding: clamp(24px, 5vw, 64px) 0 clamp(40px, 6vw, 80px); align-items: center; }
/* "protagonizado por" never breaks (it would strand "por"), so on narrow phones the size follows the column. */
.hero__title { font-size: min(clamp(2.5rem, 6.2vw, 4.6rem), (100vw - 32px) / 8.6); line-height: 1.02; letter-spacing: -.025em; margin: 0 0 20px; max-width: 14ch; }
.hero__title em { font-style: italic; font-weight: 500; color: var(--accent); }
/* Who stars in the headline changes (rotator_controller). Every name shares one grid cell, so the
   line keeps the size of the longest and nothing below it moves. */
.rotator { display: grid; }
.rotator__item { grid-area: 1 / 1; opacity: 0; translate: 0 .3em; transition: opacity .3s ease-in, translate .3s ease-in; }
.rotator__item.is-current { opacity: 1; translate: 0 0; transition: opacity .45s var(--ease) .25s, translate .45s var(--ease) .25s; } /* comes in once the last one is gone */
.rotator__item.is-leaving { opacity: 0; translate: 0 -.3em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }
.hero__note { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.hero__note li { display: inline-flex; align-items: center; gap: 6px; }
.hero__note .icon { color: var(--jade); }
.stack { position: relative; aspect-ratio: 1 / .92; width: min(100%, 520px); margin: 0 auto; }
.stack .page { position: absolute; width: 50%; left: 50%; top: 50%; translate: -50% -50%; box-shadow: var(--shadow-l); transition: transform .6s var(--ease); }
.stack .page:nth-child(1) { transform: rotate(-10deg) translate(-66%, -8%); }
.stack .page:nth-child(2) { transform: rotate(8deg) translate(66%, 4%); }
.stack .page:nth-child(3) { transform: rotate(-1.5deg) translateY(-2%); z-index: 2; }
.stack:hover .page:nth-child(1) { transform: rotate(-13deg) translate(-74%, -10%); }
.stack:hover .page:nth-child(2) { transform: rotate(11deg) translate(74%, 6%); }
.stack::before { content: ''; position: absolute; inset: 10% 6%; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent 70%); z-index: 0; }
.stack__hint { position: absolute; left: 50%; bottom: -6px; translate: -50% 0; font-family: var(--font-display); font-style: italic; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.cast-chip { position: absolute; z-index: 3; top: 0; right: 0; display: flex; align-items: center; gap: 10px; max-width: 78%; margin: 0; padding: 7px 14px 7px 7px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); rotate: 2deg; font-size: .78rem; line-height: 1.3; color: var(--muted); }
.cast-chip__faces { display: flex; flex: none; }
.cast-chip__faces img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--surface); background: #FFFFFF; object-fit: cover; }
.cast-chip__faces img + img { margin-left: -12px; }
.cast-chip strong { display: block; color: var(--ink); font-size: .84rem; }
/* Two columns: the right-hand page fans out past the stack (about 17% of its width on hover), so the stack leaves
   that room on its right instead of pushing the page sideways. */
@media (min-width: 900px) { .hero { grid-template-columns: 1.05fr .95fr; } .hero__title { font-size: clamp(2.5rem, 5.6vw, 3.9rem); } .stack { width: min(88%, 520px); margin: 0 12% 0 auto; } .cast-chip { max-width: 88%; } }
/* One column: the hero runs edge to edge and the fanned pages peek off the screen instead of widening the page. */
@media (max-width: 899px) { .hero { overflow-x: clip; margin-inline: calc(-1 * clamp(16px, 4vw, 40px)); padding-inline: clamp(16px, 4vw, 40px); } }
.section { padding: clamp(36px, 6vw, 72px) 0; }
/* the occasions under the hero */
.occasions { text-align: center; }
.occasions__title { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.occasions__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.occasions__list li { padding: 6px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: .9rem; font-weight: 500; }
.section__head { max-width: 640px; margin-bottom: clamp(20px, 3vw, 36px); }
.section__head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.02em; }
.steps-grid { display: grid; gap: 16px; }
.step-card { position: relative; padding: 24px 22px 22px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.step-card__num { font-family: var(--font-display); font-style: italic; font-size: 2.6rem; line-height: 1; color: var(--accent); margin-bottom: 12px; }
.step-card h3 { margin-bottom: 6px; }
.step-card p { margin: 0; color: var(--ink-2); }
@media (min-width: 760px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.styles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.style-card { display: grid; gap: 10px; text-decoration: none; color: inherit; }
.style-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; transition: transform .3s var(--ease); }
.style-card:hover img { transform: translateY(-4px) rotate(-1deg); }
.style-card strong { font-family: var(--font-display); font-size: 1.15rem; }
.style-card span { color: var(--muted); font-size: .9rem; }
@media (min-width: 760px) { .styles-grid { grid-template-columns: repeat(4, 1fr); } }
.marquee { overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); margin: 0 calc(-1 * clamp(16px, 4vw, 40px)); }
.marquee__track { display: flex; gap: 14px; width: max-content; padding: 10px 0; animation: marquee 48s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #fff; border: 3px solid #fff; box-shadow: var(--shadow-s); }
.marquee img:nth-child(odd) { translate: 0 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }
.formats { display: grid; gap: 16px; }
.format-card { display: grid; gap: 8px; padding: 26px 24px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.format-card .icon { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--jade-soft); color: var(--jade); }
.format-card--print .icon { background: var(--gold-soft); color: #9A6E1C; }
.format-card h3 { margin: 6px 0 0; }
.format-card p { margin: 0; color: var(--ink-2); }
.format-card small { color: var(--muted); }
.format-card .format-card__prices { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink); }
.format-card__prices strong { font-family: var(--font-display); font-size: 1.15rem; }
@media (min-width: 700px) { .formats { grid-template-columns: 1fr 1fr; } }
.faq { display: grid; gap: 10px; max-width: 760px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 18px; }
.faq summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; font-weight: 600; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--font-display); font-size: 1.4rem; color: var(--accent); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--ink-2); }
.cta-band { margin-top: clamp(24px, 4vw, 48px); padding: clamp(32px, 6vw, 64px) clamp(20px, 5vw, 56px); border-radius: var(--radius-l); background: var(--ink); color: #FFF9F2; display: grid; gap: 18px; justify-items: start; position: relative; overflow: hidden; }
.cta-band::after { content: ''; position: absolute; right: -10%; top: -40%; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(200, 80, 58, .55), transparent 72%); pointer-events: none; }
.cta-band h2 { color: inherit; font-size: clamp(1.8rem, 3.6vw, 2.8rem); margin: 0; max-width: 18ch; position: relative; }
.cta-band p { margin: 0; color: #D9CFC6; max-width: 48ch; position: relative; }
.cta-band .btn { position: relative; }
.site-footer { margin-top: 40px; padding: 24px 0 8px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; color: var(--muted); font-size: .85rem; }
.site-footer a { color: inherit; text-decoration: none; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- character studio ---------- */
.wizard { display: grid; gap: 24px; align-items: start; }
.wizard__aside { display: none; position: sticky; top: calc(var(--header-h) + 20px); }
@media (min-width: 1000px) { .wizard { grid-template-columns: minmax(0, 1fr) 300px; } .wizard__aside { display: grid; gap: 14px; } }
.aside-card { display: grid; gap: 12px; padding: 20px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.aside-card h3 { margin: 0; font-size: 1.05rem; }
.aside-card p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.aside-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: .92rem; display: grid; gap: 6px; }
.preset-preview { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius); background: var(--paper-2); overflow: hidden; }
.preset-preview img { width: 100%; height: 100%; object-fit: cover; }
.preset-preview:empty::before { content: '✦'; font-size: 1.6rem; color: var(--line-2); }
.cast-count { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cast-count__faces { display: flex; }
.cast-count__faces img, .cast-count__faces span { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--paper); margin-left: -8px; background: var(--paper-2); display: grid; place-items: center; font-size: .9rem; }
.cast-count__faces :first-child { margin-left: 0; }

/* ready-made characters */
.preset-sets { display: grid; gap: 18px; }
.preset-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.preset-grid { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 10px; margin: -4px -4px 0; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.preset-grid::-webkit-scrollbar { display: none; }
.preset { position: relative; flex: 0 0 86px; display: block !important; aspect-ratio: 1; background: #fff; border: 2px solid transparent; border-radius: 18px; padding: 0; cursor: pointer; overflow: hidden; scroll-snap-align: start; box-shadow: var(--shadow-s); transition: transform .15s var(--ease), border-color .15s, box-shadow .15s; }
.preset input { position: absolute; opacity: 0; pointer-events: none; }
.preset svg, .preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preset .pet-placeholder { background: none; }
.preset:hover { transform: translateY(-2px); }
.preset:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.preset:has(input:checked)::after { content: ''; position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center / 14px no-repeat; }
.preset:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
@media (min-width: 700px) { .preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); overflow: visible; margin: 0; padding: 0; } .preset { flex: none; } }
.preset-fallback { margin-top: 20px; }
.preset-fallback summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
/* cast: who / relation / pets */
.relation-field { display: none !important; }
.form:has(input[name=who][value=other]:checked) .relation-field,
.form:has(input[name=who][value=pet]:checked) .relation-field { display: grid !important; }
.form:has(input[name=who][value=pet]:checked) .preset-set--person,
.form:not(:has(input[name=who][value=pet]:checked)) .preset-set--pet { display: none; }

/* the character page */
.studio { display: grid; gap: 22px; }
@media (min-width: 900px) { .studio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.studio__main { display: grid; gap: 18px; }
.portrait-stage { position: relative; border-radius: var(--radius-l); overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.portrait-stage .art__sketch { padding: 16px 48px 0; background: #F3E6DA; }
.portrait-stage .pet-placeholder { background: #F3E6DA; }
.sample-page { display: grid; gap: 10px; }
.sample-page .page { width: min(100%, 300px); margin: 0 auto; }
.sample-page h3 { margin: 0; }
.sample-page p { margin: 0; }
.studio__actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.pending-card { display: grid; justify-items: center; gap: 12px; text-align: center; padding: clamp(24px, 5vw, 48px) 20px; }
.pending-card h2 { margin: 0; }
.pending-card .iris-stage { position: relative; width: min(60vw, 220px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--paper-2); }
.steps { list-style: none; padding: 0; margin: 4px auto 0; display: grid; gap: 8px; max-width: 280px; text-align: left; }
.steps__item { color: var(--muted); padding-left: 28px; position: relative; }
.steps__item::before { content: ''; position: absolute; left: 4px; top: .45em; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); }
.steps__item--active { color: var(--ink); font-weight: 500; }
.steps__item--active::before { border-color: var(--accent); background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.meanwhile { display: grid; gap: 10px; justify-items: start; padding: 18px 20px; border-radius: var(--radius); background: var(--jade-soft); border: 1px dashed var(--jade); }
.meanwhile strong { color: var(--jade-2); }
.paint-again { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-radius: var(--radius-s); background: var(--gold-soft); }
.paint-again span { flex: 1 1 200px; font-size: .9rem; }

/* art style picker (book-wide) */
.style-picker fieldset { border: 0; padding: 0; margin: 0; }
.style-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.style-option { position: relative; display: grid; gap: 6px; justify-items: center; padding: 5px 5px 9px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; font-size: .78rem; font-weight: 500; text-align: center; line-height: 1.2; transition: border-color .15s, background .15s; }
.style-option input { position: absolute; opacity: 0; pointer-events: none; }
.style-option img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; display: block; }
.style-option__empty { width: 100%; aspect-ratio: 1; display: grid; place-items: center; font-size: 1.6rem; background: var(--paper-2); border-radius: 9px; }
.style-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.style-option:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* trait editor */
.traits-details { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.traits-details summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; font-weight: 600; }
.traits-details summary::-webkit-details-marker { display: none; }
.traits-details summary .icon { margin-left: auto; transition: transform .2s; }
.traits-details[open] summary .icon { transform: rotate(180deg); }
.traits-details > .editor { border-top: 1px solid var(--line); }
.editor { display: grid; gap: 16px; padding: 20px; }
.avatar-stage { position: relative; display: flex; justify-content: center; padding: 12px 0 0; border-radius: var(--radius); background: #F3E6DA; }
.avatar-stage svg { width: 180px; height: auto; }
.avatar-stage .pet-placeholder { width: 180px; background: none; }
.avatar-stage__label { position: absolute; top: 10px; left: 12px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.trait-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.trait-grid label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.trait-grid select, .trait-grid input { min-height: 42px; padding: 8px 32px 8px 10px; font-size: .9rem; font-weight: 400; color: var(--ink); }
.trait-grid input { padding-right: 10px; }
@media (min-width: 600px) { .trait-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
turbo-frame[busy] .avatar-stage { opacity: .6; transition: opacity .2s; }

/* ---------- the book workspace ---------- */
.book-toolbar { display: grid; gap: 16px; margin-bottom: 20px; }
@media (min-width: 1000px) { .book-toolbar { grid-template-columns: minmax(0, 1fr) auto; align-items: end; } }
.cast { min-width: 0; }
.cast__title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 1.05rem; }
.cast__list { display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 8px; margin: -4px -4px 0; scrollbar-width: none; }
.cast__list::-webkit-scrollbar { display: none; }
.cast__member { flex: none; display: grid; gap: 6px; justify-items: center; width: 76px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .8rem; text-align: center; }
.cast__member .art, .cast__member .pet-placeholder { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; aspect-ratio: 1; background: #F3E6DA; border: 3px solid #fff; box-shadow: var(--shadow-s); transition: transform .15s var(--ease); }
.cast__member .art img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; }
.cast__member:hover .art, .cast__member:hover .pet-placeholder { transform: translateY(-2px); }
.cast__member .art__badge { display: none; }
.cast__member .iris-sheen { display: none; }
.cast__member span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast__member .small { display: none; }
.cast__add .pet-placeholder { display: grid; place-items: center; font-size: 1.4rem; color: var(--muted); border: 2px dashed var(--line-2); background: var(--surface); box-shadow: none; }
.cast__add .pet-placeholder .icon { width: 22px; height: 22px; }
.book-actions { display: none; gap: 8px; flex-wrap: wrap; }
@media (min-width: 760px) { .book-actions { display: flex; } }

.workspace { display: grid; gap: 16px; }
.workspace > *, .book-toolbar > * { min-width: 0; }
.strip { position: sticky; top: var(--header-h); z-index: 10; margin: 0 calc(-1 * clamp(16px, 4vw, 40px)); padding: 10px clamp(16px, 4vw, 40px) 8px; background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.strip__list { list-style: none; margin: 0; padding: 4px 2px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.strip__list::-webkit-scrollbar { display: none; }
.page-thumb { flex: none; width: 56px; display: grid; gap: 4px; justify-items: center; cursor: grab; user-select: none; -webkit-user-select: none; scroll-snap-align: center; }
.page-thumb:active { cursor: grabbing; }
.page-thumb__sheet { position: relative; display: block; width: 100%; aspect-ratio: 148 / 210; background: #FFFDF9; border-radius: 4px; box-shadow: 0 1px 3px rgba(60, 30, 20, .18), 0 0 0 1px rgba(60, 30, 20, .06); overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.page-thumb__sheet:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(60, 30, 20, .18); }
.page-thumb__sheet img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.page-thumb__text { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; padding: 5px 4px; font: 600 .5rem/1.25 var(--font-display); text-align: center; }
.page-thumb__cover { display: grid; place-items: center; height: 100%; padding: 4px; font: 600 .5rem/1.2 var(--font-display); text-align: center; background: #FBF3EA; }
.page-thumb--back .page-thumb__cover { background: #F1E2D6; }
.page-thumb__number { font-size: .7rem; font-weight: 600; color: var(--muted); }
.page-thumb--ghost { opacity: .35; }
.page-thumb--chosen .page-thumb__sheet { box-shadow: 0 0 0 2px var(--accent), 0 8px 20px rgba(60, 30, 20, .25); }
.page-thumb--active .page-thumb__sheet { box-shadow: 0 0 0 2.5px var(--accent), 0 6px 14px rgba(60, 30, 20, .2); }
.page-thumb--active .page-thumb__number { color: var(--accent); }
.page-thumb--static { cursor: default; }
.page-thumb--add form { display: contents; }
.page-thumb--add .page-thumb__sheet { display: grid; place-items: center; padding: 0; border: 2px dashed var(--line-2); background: transparent; box-shadow: none; color: var(--muted); cursor: pointer; font: inherit; }
.page-thumb--add .page-thumb__sheet .icon { width: 20px; height: 20px; }
.page-thumb--add .page-thumb__sheet:hover { border-color: var(--accent); color: var(--accent); transform: none; box-shadow: none; }
.strip__form { display: contents; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pager__label { font-size: .9rem; color: var(--muted); font-weight: 500; }
.pager__label strong { color: var(--ink); }
.pager__nav { display: flex; gap: 8px; }
.sheets { display: grid; gap: 24px; }
.slot { container-type: inline-size; scroll-margin-top: calc(var(--header-h) + 110px); }
.workspace--js .slot:not(.slot--active) { display: none; }
.workspace--js .pager { display: flex; }
.pager { display: none; }
@media (min-width: 1000px) {
    .workspace { grid-template-columns: 188px minmax(0, 1fr); align-items: start; }
    .strip { position: sticky; top: calc(var(--header-h) + 16px); z-index: 1; margin: 0; padding: 12px; max-height: calc(100svh - var(--header-h) - 32px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .strip__list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; overflow: visible; }
    .page-thumb { width: auto; }
}

/* one page in the editor */
.page-editor { display: grid; gap: 20px; grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(16px, 2.5vw, 26px); box-shadow: var(--shadow-s); }
@container (min-width: 720px) { .page-editor { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } }
.page-editor__preview { display: grid; justify-items: center; align-content: start; gap: 10px; }
.page-editor__preview .page { width: min(100%, 300px); }
@container (min-width: 720px) { .page-editor__preview { position: sticky; top: calc(var(--header-h) + 20px); } .page-editor__preview .page { width: min(100%, 440px); } }
.page-editor__form { display: grid; gap: 18px; align-content: start; }
.page-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.page-editor__head h3 { margin: 0; font-size: 1.3rem; }
.page-editor__move { display: flex; gap: 6px; }
.sheets > :first-child .page-editor__up, .sheets > :last-child .page-editor__down { visibility: hidden; }
.page-editor--moved { animation: moved 1.2s ease-out; }
@keyframes moved { from { box-shadow: 0 0 0 3px var(--accent); } }
.page-editor__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-editor__actions .btn-primary { flex: 1 1 auto; }
.page-editor__delete { grid-column: 1 / -1; text-align: right; }
.save-status { font-size: .85rem; color: var(--muted); min-width: 7ch; }
.save-status[data-state=saving] { color: var(--muted); }
.save-status[data-state=saved] { color: var(--jade); }
.save-status[data-state=dirty] { color: var(--muted); }
.counter { font-size: .8rem; color: var(--muted); text-align: right; }
.layouts { border: 0; padding: 0; margin: 0; }
.layouts__options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.layout-option { position: relative; display: grid !important; justify-items: center; gap: 6px !important; padding: 10px 4px 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: .72rem; font-weight: 500 !important; line-height: 1.2; text-align: center; transition: border-color .15s, background .15s; }
.layout-option input { position: absolute; opacity: 0; pointer-events: none; }
.layout-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.layout-option:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.layout-icon { position: relative; display: flex; flex-direction: column; gap: 3px; width: 30px; aspect-ratio: 148 / 210; padding: 3px; background: #FFFDF9; border-radius: 3px; box-shadow: 0 1px 3px rgba(60, 30, 20, .3); }
.layout-icon i { flex: 1; border-radius: 2px; background: linear-gradient(135deg, #F6CFC4, #C9DDF5); }
.layout-icon b { height: 7px; margin: 0 2px; background: repeating-linear-gradient(rgba(122, 110, 104, .6) 0 1.5px, transparent 1.5px 3px); }
.layout-icon--text-above b, .layout-icon--title-top b { order: -1; }
.layout-icon--text-over i, .layout-icon--title-over i { position: absolute; inset: 0; border-radius: 3px; }
.layout-icon--text-over b, .layout-icon--title-over b { position: absolute; left: 3px; right: 3px; bottom: 3px; margin: 0; padding: 1px 2px; height: 9px; background-color: rgba(255, 253, 249, .85); background-clip: content-box; box-shadow: 0 0 0 1px rgba(255, 253, 249, .85); }
.layout-icon--title-over b { top: 3px; bottom: auto; }
.layout-icon--framed { padding: 5px 5px 3px; }
.layout-icon--framed i { border: 1.5px solid #FFFFFF; box-shadow: 0 0 0 .5px rgba(60, 30, 20, .35); transform: rotate(-4deg); }
.empty-state { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 40px 20px; border: 2px dashed var(--line-2); border-radius: var(--radius-l); }
.empty-state .icon { width: 44px; height: 44px; color: var(--line-2); }
.empty-state h3 { margin: 0; }
.empty-state p { margin: 0; color: var(--muted); }

/* sharing */
.share-card { display: grid; gap: 16px; margin-top: 36px; padding: clamp(20px, 3vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); scroll-margin-top: calc(var(--header-h) + 16px); box-shadow: var(--shadow-s); }
.share-card__head { display: flex; gap: 14px; align-items: flex-start; }
.share-card__head .icon { flex: none; width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--jade-soft); color: var(--jade); }
.share-card h2 { margin: 0 0 4px; font-size: 1.4rem; }
.share-card p { margin: 0; }
.share-card__link { display: flex; gap: 8px; }
.share-card__link input { flex: 1; min-width: 0; min-height: 46px; padding: 10px 14px; font: inherit; font-size: .92rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--ink-2); }
.share-card__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-card__actions form { display: contents; }
.share-card__status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--jade); }
.share-card__status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* paywall: pick a plan, create the account, go pay */
.paywall { display: grid; gap: 24px; max-width: 980px; margin: 0 auto; }
.paywall__book { display: grid; justify-items: center; gap: 8px; }
.paywall__cover { width: min(46vw, 200px); }
.paywall__cover .page { width: 100%; transform: rotate(-2deg); box-shadow: var(--shadow-l); }
.paywall__form h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: .3em; }
.paywall__form p { margin: 0; }
.plans { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; }
.plan { position: relative; display: grid; gap: 6px; padding: 16px 18px; border: 1.5px solid var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan__head strong { font-size: 1.05rem; }
.plan__head strong::before { content: ''; display: inline-block; width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px; border: 2px solid var(--line-2); border-radius: 50%; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.plan__price { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; white-space: nowrap; }
.plan__summary { color: var(--ink-2); font-size: .92rem; line-height: 1.45; }
.plan__includes { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.plan__includes li { display: flex; gap: 6px; align-items: flex-start; }
.plan__includes .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--jade); }
.plan:hover { box-shadow: var(--shadow-s); }
.plan:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.plan:has(input:checked) .plan__head strong::before { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); background: var(--accent); }
.plan:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.paywall__signup { display: grid; gap: 14px; border: 0; border-top: 1px solid var(--line); padding: 18px 0 0; margin: 0; }
.paywall__signup legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.paywall__signup legend + * { clear: both; }
.paywall__account { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-s); background: var(--jade-soft); color: var(--jade-2); font-size: .92rem; overflow-wrap: anywhere; }
.paywall__fine { font-size: .82rem; color: var(--muted); text-align: center; }
@media (min-width: 860px) {
    .paywall { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: start; gap: 40px; padding-top: 12px; }
    .paywall__book { position: sticky; top: calc(var(--header-h) + 28px); }
    .paywall__cover { width: min(100%, 280px); }
}
.btn__price { font-weight: 500; font-size: .85em; color: var(--muted); }

/* accounts */
.auth { display: grid; place-items: start center; padding-top: clamp(8px, 4vw, 40px); }
.auth__card { width: min(100%, 440px); }
.auth__card h1 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-bottom: .3em; }
.auth__card p { margin: 0; }
.page-head__actions form { display: contents; }
.auth__forgot { justify-self: end; margin-top: -10px; }
.auth__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); }
.auth__icon .icon { width: 26px; height: 26px; }
.account-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.account-email > span:first-child { overflow-wrap: anywhere; }
.email-confirmed { display: inline-flex; align-items: center; gap: 4px; color: var(--jade-2); font-size: .875rem; font-weight: 600; }
.email-confirmed .icon { width: 1em; height: 1em; vertical-align: 0; }
.confirm-email { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 14px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); border-radius: var(--radius); background: var(--gold-soft); }
.confirm-email > .icon { align-self: start; width: 24px; height: 24px; color: var(--accent-2); }
.confirm-email p { margin: 2px 0 0; font-size: .92rem; color: var(--ink-2); overflow-wrap: anywhere; }
.confirm-email__actions { display: flex; gap: 6px; }
@media (max-width: 600px) {
    .confirm-email { grid-template-columns: auto 1fr; }
    .confirm-email__actions { grid-column: 2; }
}
.account-section { margin-top: 28px; }
.account-section h2 { font-size: 1.3rem; }
.book-list, .payment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.book-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.book-item--current { border-color: var(--jade); box-shadow: 0 0 0 1px var(--jade); }
.book-item__cover { display: grid; place-items: center; width: 52px; aspect-ratio: 148 / 210; border-radius: 4px; overflow: hidden; background: var(--paper-2); color: var(--line-2); box-shadow: var(--shadow-s); }
.book-item__cover img { width: 100%; height: 100%; object-fit: cover; }
.book-item__body { display: grid; gap: 2px; min-width: 0; }
.book-item__body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-badge { justify-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--paper-2); color: var(--ink-2); }
.plan-badge--share, .plan-badge--share_pdf { background: var(--jade-soft); color: var(--jade-2); }
.payment-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: .92rem; }
.account-section > .muted { margin-top: 10px; }

/* ---------- legal pages ---------- */
.legal { max-width: 72ch; margin: 0 auto; padding: clamp(24px, 5vw, 56px) 0 0; }
.legal h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); margin: 0 0 6px; }
.legal__updated { margin: 0 0 24px; color: var(--muted); font-size: .9rem; }
.legal__summary { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.legal h2 { font-size: 1.25rem; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--ink-2); line-height: 1.65; }
.legal ul { padding-left: 1.2em; }
.legal li + li { margin-top: 6px; }
.legal a { color: var(--accent-2); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .reveal { opacity: 1; transform: none; }
    .marquee__track { animation: none; }
}

/* A book on screen doesn't print (protect_controller.js): its PDF is the printable version. */
@media print {
    :is(body[data-controller~="protect"], body:has([data-controller~="protect"])) > * { display: none !important; }
    :is(body[data-controller~="protect"], body:has([data-controller~="protect"]))::after { content: "Para imprimir este libro, descarga su PDF en librinis.com."; display: block; padding: 96px 24px; text-align: center; font: 600 1.4rem var(--font-display); color: var(--ink); }
}
