/* Illustrate page. Tokens (colours, fonts, .btn, .pill, .field, .themefab) come
   from /browse/browse.css so both themes match the rest of the site. */
[hidden] { display: none !important; }   /* .btn/.eraPreview set display, which would beat the attribute */
.note { color: var(--ink-faint); font-size: 13px; margin-top: 6px; max-width: 640px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 14px 0; }
.panel h2 { font-size: 22px; margin-bottom: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.field.small { flex: 0 0 96px; }
.field textarea { font: inherit; font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg-elev-2);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; width: 100%; resize: vertical; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.samples .pill { font-size: 13px; padding: 4px 10px; }
.muted { color: var(--ink-dim); font-size: 13px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { font: inherit; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-elev-2); color: var(--ink); cursor: pointer; }
.tab.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.card { font: inherit; text-align: start; background: var(--bg-elev-2); border: 2px solid transparent; border-radius: 10px; padding: 4px; cursor: pointer; color: var(--ink); }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 7px; background: var(--border); }
.card .name { display: block; font-size: 13px; padding: 5px 2px 2px; line-height: 1.3; }
.card.on { border-color: var(--accent); box-shadow: 0 2px 10px var(--shadow); }
.tip { margin-top: 8px; color: var(--ink-dim); font-size: 14px; background: var(--bg-elev-2); border-inline-start: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; }
.eraPreview { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; }
.eraPreview img { width: 108px; height: auto; aspect-ratio: 3 / 4; border-radius: 8px; object-fit: cover; }
.seg { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.seg legend { font-size: 13px; color: var(--ink-dim); padding: 0 4px; }
.seg label { font-size: 15px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.keybox { background: var(--bg-elev-2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.keybox p { margin-bottom: 8px; }
.go { margin-top: 0; }
.btn:disabled { opacity: .55; cursor: default; }
.status { margin-top: 10px; color: var(--ink-dim); min-height: 1.4em; }
.hint, .banner { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elev-2); border: 1px solid var(--border-strong); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.banner { color: var(--warn); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 14px 0 40px; }
.result { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.result .frame { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--bg-elev-2); display: flex; align-items: center; justify-content: center; }
.result .frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result .wait { color: var(--ink-dim); font-size: 14px; padding: 12px; text-align: center; }
.result .ai { position: absolute; inset-inline-end: 6px; bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .5px; background: rgba(0,0,0,.45); color: #fff; padding: 2px 6px; border-radius: 5px; }
.result figcaption { font-size: 14px; padding: 6px 2px; }
.result .bar { display: flex; gap: 6px; flex-wrap: wrap; }
.result .pill { font-size: 13px; padding: 4px 12px; text-decoration: none; }
.pill.quiet { color: var(--ink-dim); }
.lb { border: 0; padding: 16px; background: transparent; max-width: 100vw; max-height: 100vh; }
.lb[open] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb::backdrop { background: rgba(0,0,0,.85); }
.lb .close { align-self: flex-end; }
.result .zoom { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.result .zoom:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.lb img { max-width: 100%; max-height: 86vh; border-radius: 6px; }
.lb p { color: #eee; font-size: 14px; text-align: center; }
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .card .name { font-size: 12px; }
  .go .btn { width: 100%; }
}

textarea:disabled, input:disabled, select:disabled { opacity: .6; }

.more { margin-top: 10px; }
.gallery .ghead { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin: 4px 0 6px; }
.gallery .ghead h3, .gallery .ghead h4 { font-family: var(--sans); font-size: 17px; font-weight: 600; letter-spacing: 0; }
.gallery .ggroup { font-family: var(--serif); font-weight: 300; font-size: 20px; margin: 18px 0 8px; }
.gallery .gtip { font-size: 13px; color: var(--ink-dim); font-weight: 400; }
.gallery .gitem { border-top: 1px solid var(--border); padding: 12px 0; }
.gallery .strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gallery .strip button { all: unset; cursor: zoom-in; display: block; border-radius: 6px; overflow: hidden; }
.gallery .strip button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.gallery .strip img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; background: var(--border); }
.gallery .use { font-size: 13px; padding: 3px 12px; }
@media (max-width: 520px) { .gallery .strip { grid-template-columns: repeat(3, 1fr); } }

/* round 5: nav, credits line, Unsure? tabs, auto-pick cards, bigger action row, buy box, footer */
.topnav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; margin-inline-start: auto; margin-inline-end: 12px; }
.topnav a { color: var(--ink-dim); text-decoration: none; }
.topnav a:hover, .topnav a[aria-current] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.credits { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elev-2); border: 1px solid var(--border); }
.creditLine { font-size: 14px; color: var(--ink); }
.creditActs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.linklike { all: unset; cursor: pointer; color: var(--accent); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.linklike:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.emailBox { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.emailBox .field { flex: 1 1 240px; }
.emailBox .status { flex-basis: 100%; margin-top: 2px; }
.tab.unsure { border-style: dashed; }
.tab.unsure.on { border-style: solid; }
.card.auto { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; aspect-ratio: auto; min-height: 150px; padding: 10px; border: 2px dashed var(--border-strong); }
.card.auto.on { border-style: solid; border-color: var(--accent); }
.card .autoface { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.card .sub { display: block; font-size: 12px; color: var(--ink-dim); line-height: 1.3; padding: 2px; }
.unsureNote { grid-column: 1 / -1; align-self: center; }
.btn.big { font-size: 17px; padding: 12px 22px; }
.actions .go { align-items: center; }
.actions .btn.ghost, .more .btn.ghost { border-width: 2px; font-weight: 600; }
.more .btn { text-decoration: none; }
#pickLine { margin-top: 8px; }
.buy { border-color: var(--accent); }
.buy .btn { display: inline-block; margin-top: 8px; text-decoration: none; }
.sitefoot { padding-top: 18px; padding-bottom: 40px; color: var(--ink-dim); font-size: 13px; text-align: center; }
.sitefoot a { color: var(--ink-dim); }
@media (max-width: 720px) {
  .topnav { order: 3; width: 100%; margin: 6px 0 0; }
}
@media (max-width: 520px) {
  .actions .go .btn { width: 100%; }
}
@media (max-width: 720px) { .topbar .bar { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; } }

/* whole book */
.drop { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 22px 14px; border: 2px dashed var(--border-strong); border-radius: 12px; background: var(--bg-elev-2); cursor: pointer; }
.drop:focus-within, .drop:hover { border-color: var(--accent); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropIcon { font-size: 30px; }
#quote, #bookRun { margin-top: 12px; }
#quote h3, #bookRun h3 { font-size: 19px; margin-bottom: 4px; }
#qChapters { margin: 8px 0; font-size: 14px; }
#qChapters ol { max-height: 220px; overflow: auto; padding-inline-start: 22px; }
.modes { flex-direction: column; margin: 10px 0; }
.modes select, .modes input[type=number] { font: inherit; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-elev-2); color: var(--ink); }
.modes input[type=number] { width: 70px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 15px; cursor: pointer; }
.costline { font-weight: 600; margin: 10px 0; }
.progress { height: 10px; border-radius: 99px; background: var(--bg-elev-2); border: 1px solid var(--border); overflow: hidden; margin: 8px 0 12px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.results.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.dlrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
#bookRun > .btn { margin-top: 6px; }

/* Arabic page (/ar/illustrate/): the layout above uses logical properties, so only
   Arabic-script details need care. Letter-spacing breaks joined Arabic letters. */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
[dir="rtl"] .result .ai, [dir="rtl"] .themefab button { letter-spacing: 0; }
[dir="rtl"] .panel h2, [dir="rtl"] .hero h1, [dir="rtl"] .gallery .ggroup { line-height: 1.4; }
[dir="rtl"] .card .name, [dir="rtl"] .card .sub { line-height: 1.45; }
[dir="rtl"] .seg label, [dir="rtl"] .check { line-height: 1.6; }
/* your own style / era row + recent chips */
.customRow { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; flex-wrap: wrap; }
.customRow .customCard { flex: 0 0 140px; min-height: 96px; }
.customField { flex: 1 1 240px; display: flex; flex-direction: column; gap: 5px; }
.customField label { font-size: 13px; color: var(--ink-dim); }
.customField input { font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-elev-2); color: var(--ink); }
.customField p { margin: 0; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.chip button { font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 3px 8px; }
/* round 6: heading row with the sample chips, privacy note in the footer, saved pictures, viewer zoom */
.headrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 10px; }
.headrow h2 { margin-bottom: 0; }
.headrow .samples { margin-bottom: 0; flex: 1 1 280px; }
.sitefoot .footnote { margin: 0 auto 10px; }
.actions + section .results { margin-bottom: 8px; }
.results:empty { margin: 0; }
.galBar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 18px; }
.result .rm { margin-inline-start: auto; padding: 4px 10px; }
.lbTools { display: flex; gap: 6px; align-self: stretch; justify-content: flex-end; flex-wrap: wrap; }
.lbTools .pill:disabled { opacity: .45; cursor: default; }
.lb .close { margin-inline-start: 10px; }
.lbView { overflow: hidden; border-radius: 6px; touch-action: none; cursor: zoom-in; max-width: 100%; line-height: 0; }
.lbView.zoomed { cursor: grab; }
.lbView.dragging { cursor: grabbing; }
.lbView img { transform-origin: center center; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
@media (max-width: 520px) { .headrow .samples { flex-basis: 100%; } }
.chip .chipX { padding: 3px 7px; color: var(--ink-dim); border-inline-start: 1px solid var(--border); }
/* round 7: bring your book to life (sneak peek, the whole-book offer, extras) */
.audience { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: 15px; color: var(--ink-dim); }
.audience b { color: var(--ink); }
.peekRow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 4px 0 12px; }
.peekSub { flex: 1 1 240px; margin: 0; }
#bookGo.ghost { border-width: 2px; }
.paidBox { margin: 8px 0; border-color: var(--accent); }
.paidBox a { color: var(--accent); }
.bookExtras { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -6px 0 16px; }
.bookExtras .btn.ghost { border-width: 2px; }
.ico { margin-inline-end: 6px; }
.gift { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.prop { margin: 4px 0 18px; padding: 18px; border: 2px solid var(--accent); border-radius: 14px;
  background: linear-gradient(160deg, var(--bg-elev-2), var(--bg-elev)); box-shadow: 0 4px 18px var(--shadow); }
.prop h3 { font-size: 22px; margin-bottom: 4px; }
.propLead { color: var(--ink-dim); margin-bottom: 4px; }
.propModes label { font-size: 15px; }
.propRange { width: 100%; padding: 2px 0 2px; }
.propRange input[type=range] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.prop .costline { font-size: 17px; }
.propGo { display: block; width: 100%; max-width: 520px; text-wrap: balance; }
.propNote { margin-top: 8px; }
.upsell { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border-strong); display: flex; flex-wrap: wrap;
  gap: 6px 12px; align-items: center; font-size: 14px; }
.upsell a { color: var(--accent); font-weight: 600; }
/* flip through */
.flip { border: 0; padding: 12px; background: transparent; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; }
.flip[open] { display: flex; flex-direction: column; gap: 8px; }
.flip::backdrop { background: rgba(10,7,4,.9); }
.flipTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #eee; }
.flipCount { font-size: 14px; }
.flipStage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 10px; touch-action: pan-y; perspective: 1600px; }
.flipNav { flex: 0 0 auto; width: 48px; height: 64px; font-size: 34px; line-height: 1; border-radius: 12px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.flipNav:disabled { opacity: .25; cursor: default; }
.flipNav:focus-visible, .flipZoom:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.flipPage { margin: 0; height: 100%; max-height: calc(100vh - 90px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-width: 0; transform-origin: left center; }
[dir="rtl"] .flipPage { transform-origin: right center; }
.flipZoom { all: unset; cursor: zoom-in; min-height: 0; display: flex; justify-content: center; }
.flipZoom img { max-width: min(78vw, 720px); max-height: calc(100vh - 140px); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.6); background: #fff; }
.flipPage figcaption { color: #eee; font-size: 14px; text-align: center; }
.flipPage.turnFwd { animation: flipFwd .5s cubic-bezier(.2,.7,.3,1); }
.flipPage.turnBack { animation: flipBack .5s cubic-bezier(.2,.7,.3,1); }
[dir="rtl"] .flipPage.turnFwd { animation-name: flipBack; }
[dir="rtl"] .flipPage.turnBack { animation-name: flipFwd; }
@keyframes flipFwd { from { transform: rotateY(-70deg); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes flipBack { from { transform: rotateY(70deg); opacity: .2; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flipPage.turnFwd, .flipPage.turnBack { animation: none; } }
@media (max-width: 520px) {
  .flipNav { width: 36px; height: 52px; font-size: 26px; }
  .flipZoom img { max-width: calc(100vw - 110px); }
}
/* colouring pages: a sheet over the page on screen, only the sheet on paper */
.colourSheet { position: fixed; inset: 0; z-index: 50; overflow: auto; background: #fff; color: #222; padding: 16px; }
.colourTools { position: sticky; top: -16px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; background: #fff;
  padding: 10px 0; border-bottom: 1px solid #ddd; margin-bottom: 14px; }
.colourTools h2 { font-size: 20px; margin: 0; color: #222; }
.colourTools .status { flex: 1 1 220px; margin: 0; color: #555; }
.colourTools .pill { background: #fff; color: #222; border-color: #bbb; }
.colourPages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.colourPage { margin: 0; text-align: center; }
.colourPage img { width: 100%; height: auto; border: 1px solid #ddd; background: #fff; }
.colourPage figcaption { font-size: 13px; color: #555; margin-top: 4px; }
body.colouring { overflow: hidden; }
@media print {
  body.colouring { overflow: visible; background: #fff !important; }
  body.colouring > *:not(#colour) { display: none !important; }
  body.colouring .colourSheet { position: static; overflow: visible; padding: 0; }
  body.colouring .colourTools { display: none; }
  body.colouring .colourPages { display: block; }
  body.colouring .colourPage { break-after: page; page-break-after: always; break-inside: avoid; }
  body.colouring .colourPage img { width: auto; max-width: 100%; max-height: 92vh; border: 0; }
}/* partner plan section + free-book mark note */
.partner { border-color: var(--accent); }
.partner .pBenefits { margin: 0 0 12px; padding-inline-start: 20px; line-height: 1.6; }
.partner .pCalc { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 10px 0; max-width: 560px; }
.partner .pCalcRow { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.partner .pCalcRow input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.partner .pCalcRow input[type=number] { width: 110px; font: inherit; font-size: 16px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--ink); }
.partner .pTotal { font-size: 24px; font-weight: 700; margin: 10px 0 2px; }
.partner > .btn { display: inline-block; margin-top: 10px; text-decoration: none; }
.markNote { margin: 4px 0 12px; }
/* developer guide */
.dev h2 { margin-top: 4px; }
.dev h3 { font-size: 17px; margin: 14px 0 6px; }
.dev p, .dev li { line-height: 1.6; }
.dev ul, .dev ol { padding-inline-start: 22px; margin: 6px 0; }
.dev table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14px; }
.dev th, .dev td { border: 1px solid var(--border); padding: 6px 8px; text-align: start; vertical-align: top; }
.dev code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--bg-elev-2); padding: 1px 4px; border-radius: 4px; }
.codebox { position: relative; margin: 8px 0 14px; direction: ltr; }
.codebox pre { overflow-x: auto; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; padding-top: 34px; font-size: 13px; line-height: 1.5; text-align: left; }
.codebox pre code { background: none; padding: 0; }
.codebox .copy { position: absolute; top: 6px; right: 6px; font-size: 12px; padding: 3px 10px; }
.dev details { border-top: 1px solid var(--border); padding: 8px 0; }
.dev summary { cursor: pointer; font-weight: 600; }
