/* Cuentito Conmigo: picture-book paper, the blue treasure box, a sunflower accent. */
@font-face { font-family: "Lora"; src: url("fonts/Lora-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/Lora-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/Lora-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Gaegu"; src: url("fonts/Gaegu-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --paper: #fff8ea;
  --paper-2: #f8ecd4;
  --card: #fffdf7;
  --ink: #2c2a33;
  --ink-soft: #5d5866;
  --es: #8a4b2f;            /* Spanish lines: warm clay, like the book */
  --box: #2f6a9f;           /* the blue treasure box */
  --box-deep: #1f4c77;
  --sun: #f2b632;
  --leaf: #5e9a4b;
  --line: #e6d6b8;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(60, 40, 10, .06), 0 12px 30px -14px rgba(60, 40, 10, .35);
  --serif: "Lora", Georgia, serif;
  --hand: "Gaegu", "Comic Sans MS", cursive;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1d1b22; --paper-2: #24212a; --card: #2a2731; --ink: #f4ede0; --ink-soft: #c2b9ab;
    --es: #f0a77f; --box: #6fa8dc; --box-deep: #9cc4ea; --line: #3b3743;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 17px/1.6 var(--serif);
  background: var(--paper);
  background-image: radial-gradient(circle at 12% 8%, rgba(242, 182, 50, .10), transparent 40%),
                    radial-gradient(circle at 90% 30%, rgba(47, 106, 159, .07), transparent 45%);
}
img { max-width: 100%; display: block; }
a { color: var(--box); }
a:hover { color: var(--box-deep); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 6px; }

/* Bilingual copy: both languages are in the page, the html lang decides which shows. */
html[lang="en"] [data-l="es"], html[lang="es"] [data-l="en"] { display: none !important; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { left: 16px; top: 16px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent);
       backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: baseline; gap: 2px; text-decoration: none; color: var(--ink); }
.logo b { font: 700 28px/1 var(--hand); color: var(--box); }
.logo span { font: 700 28px/1 var(--hand); color: var(--es); }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.top nav a { text-decoration: none; color: var(--ink-soft); font-size: 15px; }
.top nav a:hover { color: var(--ink); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: none; font: 600 13px/1 var(--serif); padding: 7px 10px; color: var(--ink-soft); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--box); color: #fff; }
@media (max-width: 640px) { .top nav a.hide-sm { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
       background: var(--box); color: #fff; font: 600 17px/1 var(--serif); padding: 15px 24px; border-radius: 999px;
       text-decoration: none; box-shadow: 0 6px 0 -1px var(--box-deep); transition: transform .12s, box-shadow .12s; }
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 7px 0 -1px var(--box-deep); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 -1px var(--box-deep); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--box); box-shadow: inset 0 0 0 2px var(--box); }
.btn.ghost:hover { color: var(--box-deep); }
@media (prefers-color-scheme: dark) { .btn { color: #10202f; } .btn:hover { color: #10202f; } }

/* Hero */
.hero { padding: 56px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.kicker { font: 700 22px/1.2 var(--hand); color: var(--es); margin: 0 0 8px; }
h1 { font: 600 clamp(34px, 5vw, 54px)/1.08 var(--serif); margin: 0 0 18px; letter-spacing: -.01em; text-wrap: balance; }
h1 em { font-style: normal; color: var(--box); }
.lede { font-size: 19px; color: var(--ink-soft); margin: 0 0 26px; max-width: 34em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero small { color: var(--ink-soft); font-size: 14px; }
.book3d { position: relative; perspective: 1400px; }
.book3d .cover { transform: rotateY(-11deg) rotateZ(1deg); border-radius: 6px 14px 14px 6px; overflow: hidden;
                 box-shadow: -10px 0 0 -4px var(--box-deep), 0 30px 50px -20px rgba(40, 25, 5, .55); background: var(--card); }
.sticker { position: absolute; right: -6px; bottom: 18px; transform: rotate(-7deg); background: var(--sun); color: #3a2a05;
           font: 700 20px/1.1 var(--hand); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); text-align: center; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; gap: 32px; } .book3d { width: 100%; max-width: 420px; margin: 0 auto; } }

/* Mini cover (title band over art, like the printed cover) */
.mcover { aspect-ratio: 8.625 / 8.75; display: flex; flex-direction: column; background: #fff7e6; color: #2c2a33; container-type: inline-size; }
/* Sizes follow the printed cover (build_cover.py): 30 / 21 / 12 pt on an 8.625 in panel. */
.mcover .band { padding: 4.5cqi 5cqi 2cqi; text-align: center; }
.mcover .t { font: 600 4.9cqi/1.15 var(--serif); }
.mcover .te { font: italic 400 3.4cqi/1.2 var(--serif); color: #8a4b2f; margin-top: .6cqi; }
.mcover .st { font-size: 1.95cqi; margin-top: 1.2cqi; color: #5d5866; }
.mcover .art { flex: 1; min-height: 0; background-size: cover; background-position: top center; }

/* Sections */
section { padding: 56px 0; }
/* Alternate tinted bands so each section reads as its own block (cards stay lighter than the band). */
section.band { background: var(--paper-2); border-block: 1px solid var(--line); padding: 64px 0; }
section.band + section { padding-top: 64px; }
h2 { font: 600 clamp(28px, 3.6vw, 38px)/1.15 var(--serif); margin: 0 0 10px; text-wrap: balance; }
.sub { color: var(--ink-soft); margin: 0 0 32px; max-width: 40em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.steps li { list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.steps li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 40px; height: 40px;
                    border-radius: 50%; background: var(--sun); color: #3a2a05; font: 700 24px/1 var(--hand); margin-bottom: 12px; }
.steps h3 { margin: 0 0 6px; font-size: 19px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 16px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps-wrap { padding: 0; margin: 0; }

/* Facing page (text page | art page) */
.spread { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow);
          background: #fff7e6; color: #2c2a33; position: relative; container-type: inline-size; }
.spread::after { content: ""; position: absolute; inset: 0 auto 0 50%; width: 30px; transform: translateX(-50%);
                 background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .10), transparent); pointer-events: none; }
.spread .txt { aspect-ratio: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: .9em;
               padding: 9%; line-height: 1.32;
               /* Same as the print builder: start at 20 pt on an 8.5 in page (3.3% of the page width) and
                  let Book.fit() shrink it until the text fits. --fit is set per page by that function. */
               font-size: calc(1.63cqi * var(--fit, 1)); }
.spread.single .txt { font-size: calc(3.27cqi * var(--fit, 1)); }
.spread .txt p { margin: 0; }
.spread .txt .es { font-style: italic; color: #8a4b2f; }
.spread .txt mark { background: none; color: inherit; font-weight: 600; }
.spread .art { aspect-ratio: 1; background-size: cover; background-position: center; }
.spread.single { grid-template-columns: minmax(0, 1fr); max-width: 50%; margin-inline: auto; }
.spread.single::after { display: none; }
.pg { font-size: 11px; color: #8d8577; text-align: center; margin-top: auto; }
.spread .txt .es { font-size: .94em; }

.gallery { display: grid; gap: 28px; max-width: 920px; margin-inline: auto; }
.tones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.tones figure { margin: 0; width: 120px; text-align: center; font-size: 14px; color: var(--ink-soft); }
.tones img { border-radius: 12px; box-shadow: var(--shadow); aspect-ratio: 1; object-fit: cover; }

/* The one high-resolution sample + its zoom dialog */
.hd { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: center;
      max-width: 880px; margin: 48px auto 0; background: var(--card); border: 1px solid var(--line);
      border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.hd h3 { font: 600 24px/1.2 var(--serif); margin: 0 0 8px; }
.hd p { margin: 0 0 16px; color: var(--ink-soft); }
.hd-thumb { position: relative; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px;
            overflow: hidden; display: block; width: 100%; }
.hd-thumb img { display: block; width: 100%; height: auto; }
.hd-zoom { position: absolute; right: 10px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%;
           display: grid; place-items: center; background: rgba(255,255,255,.92); color: #2f6a9f; font-size: 20px;
           box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.hd-view { width: min(96vw, 1100px); max-width: none; height: 92vh; max-height: none; padding: 0; border: 0;
           border-radius: 16px; background: #1b1916; overflow: hidden; }
.hd-view::backdrop { background: rgba(20,16,12,.78); }
.hd-scroll { height: calc(100% - 40px); overflow: auto; display: flex; align-items: center; justify-content: center; }
/* % heights don't resolve inside the scroller, so fit against the dialog's own size */
.hd-scroll img { display: block; width: auto; height: auto; max-width: min(96vw, 1100px); max-height: calc(92vh - 40px); cursor: zoom-in; }
.hd-view.actual .hd-scroll { display: block; }
.hd-view.actual .hd-scroll img { max-width: none; max-height: none; cursor: zoom-out; }
.hd-tip { margin: 0; height: 40px; line-height: 40px; text-align: center; color: #d8cfc2; font-size: 14px; }
.hd-close { position: absolute; top: 10px; right: 12px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
            border: 0; background: rgba(255,255,255,.92); color: #222; font-size: 26px; line-height: 1; cursor: pointer; }
@media (max-width: 640px) {
  .hd { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .hd-view { width: 100vw; height: 100dvh; border-radius: 0; }
  .hd-scroll img { max-width: 100vw; max-height: calc(100dvh - 56px); }
  .hd-scroll { height: calc(100% - 56px); }
  .hd-tip { height: 56px; line-height: 1.3; padding: 8px 16px; font-size: 13px; }
}

/* Prices */
.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.price { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); position: relative; }
a.price { display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.price:hover { transform: translateY(-3px); border-color: var(--box); }
a.price:focus-visible { outline: 3px solid var(--box); outline-offset: 3px; }
.price .pick { margin-top: auto; padding-top: 16px; color: var(--box); font-weight: 600; font-size: 15px; }
a.price:hover .pick { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { a.price { transition: none; } a.price:hover { transform: none; } }
.price.best { border: 2px solid var(--box); }
.price .tag { position: absolute; top: -13px; left: 20px; background: var(--box); color: #fff; font: 700 15px/1 var(--hand); padding: 6px 10px; border-radius: 999px; }
.price h3 { margin: 0; font-size: 20px; }
.price .amt { font: 600 36px/1.1 var(--serif); margin: 10px 0 4px; }
.price .amt small { font-size: 15px; color: var(--ink-soft); font-weight: 400; }
.price ul { padding-left: 18px; margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; }
@media (max-width: 860px) { .prices { grid-template-columns: 1fr; } }

/* FAQ */
details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
details p { margin: 0 0 14px; color: var(--ink-soft); }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--ink-soft); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
footer .ai { flex-basis: 100%; }

/* Builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 36px; padding: 32px 0 64px; align-items: start; }
@media (max-width: 960px) { .builder { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel h2 .n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--sun); color: #3a2a05; font: 700 19px/1 var(--hand); flex: none; }
.field { margin-bottom: 16px; }
.field label, .field .lbl { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field .hint { font-size: 13.5px; color: var(--ink-soft); margin-top: 5px; }
.field .err { font-size: 13.5px; color: #b3261e; margin-top: 5px; display: none; }
@media (prefers-color-scheme: dark) { .field .err { color: #ff8a80; } }
.field.bad .err { display: block; }
.field.bad input, .field.bad textarea { border-color: #b3261e; }
input[type="text"], textarea, select { width: 100%; font: 400 17px/1.3 var(--serif); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--box); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--box) 25%, transparent); }
textarea { resize: vertical; min-height: 84px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 11px; font: 400 14px/1.2 var(--serif); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--box); border-color: var(--box); color: #fff; }

.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt > span { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 15px; background: var(--paper); cursor: pointer; }
.opt input:checked + span { border-color: var(--box); box-shadow: 0 0 0 2px var(--box); }
.opt input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.sw { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12); flex: none; }
.opt.swatch > span { padding: 6px; border-radius: 50%; }
.opt.swatch .sw { width: 34px; height: 34px; }

.fmt { display: grid; gap: 10px; }
.fmt .opt > span { justify-content: space-between; padding: 14px 16px; }
.fmt .opt b { font-weight: 600; }
.fmt .opt em { font-style: normal; color: var(--ink-soft); font-size: 14px; display: block; }

.preview { position: sticky; top: 84px; }
@media (max-width: 960px) { .preview { position: static; order: -1; } .stage .page-cover { max-width: 78%; } }
.stage { background: var(--paper-2); border-radius: var(--radius); padding: 18px; }
.stage .page-cover { max-width: 62%; margin: 0 auto; border-radius: 4px 10px 10px 4px; overflow: hidden; box-shadow: -7px 0 0 -3px var(--box-deep), var(--shadow); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pager button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; width: 44px; height: 44px; font-size: 20px; cursor: pointer; }
.pager button:disabled { opacity: .35; cursor: default; }
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--box); }
.note { font-size: 13.5px; color: var(--ink-soft); margin: 10px 2px 0; }
.note.warn { color: var(--es); }

.summary { margin-top: 18px; }
.summary .line { display: flex; justify-content: space-between; font-size: 15px; padding: 4px 0; }
.summary .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 600; font-size: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; margin: 14px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--box); flex: none; }
.msg { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--sun) 22%, var(--card)); font-size: 15px; display: none; }
.msg.show { display: block; }

/* Legal pages */
.doc { max-width: 760px; padding: 40px 0 64px; }
.doc h1 { font-size: 38px; }
.doc h2 { font-size: 23px; margin-top: 32px; }
.doc .draft { background: color-mix(in srgb, var(--sun) 25%, var(--card)); border-radius: 12px; padding: 12px 16px; font-size: 15px; }
