/* Story Shelf: a family's storybooks and a chrome-free reader. */
@font-face { font-family: "SS Fredoka"; font-weight: 500; font-display: swap; src: url("/static/fonts/fredoka-v17-latin-500.woff2") format("woff2"); }
@font-face { font-family: "SS Fredoka"; font-weight: 700; font-display: swap; src: url("/static/fonts/fredoka-v17-latin-700.woff2") format("woff2"); }

:root {
  --ss-paper: #f6efe2;
  --ss-page: #fdf6e6;
  --ss-ink: #22324a;
  --ss-soft: #6b6458;
  --ss-accent: #b8320c;
  --ss-gold: #e4a33b;
  --ss-night: #15120f;
  --ss-moon: #f4ead8;
  --ss-font: "SS Fredoka", ui-rounded, "Nunito", system-ui, sans-serif;
  --ss-safe-t: env(safe-area-inset-top, 0px);
  --ss-safe-r: env(safe-area-inset-right, 0px);
  --ss-safe-b: env(safe-area-inset-bottom, 0px);
  --ss-safe-l: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.ss-body { background: var(--ss-paper); color: var(--ss-ink); font: 500 16px/1.45 var(--ss-font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.ss-reading { overflow: hidden; background: var(--ss-page); }
.ss-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
button, a { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ss-gold); outline-offset: 3px; }

/* ---------- Shelf ---------- */
.ss-shelf { min-height: 100dvh; background:
  radial-gradient(120% 60% at 50% -10%, #fffaf0 0%, transparent 60%),
  var(--ss-paper); }
.ss-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(var(--ss-safe-t) + .7rem) calc(var(--ss-safe-r) + 1.1rem) .7rem calc(var(--ss-safe-l) + 1.1rem);
  background: color-mix(in srgb, var(--ss-paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ss-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; color: var(--ss-ink); }
.ss-brand--back { gap: .3rem; font-weight: 600; text-decoration: none; }
.ss-brand--back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ss-brand__mark { width: 28px; height: 28px; color: var(--ss-ink); }
.ss-exit, .ss-close { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; cursor: pointer; text-decoration: none; }
.ss-exit svg, .ss-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ss-exit { color: var(--ss-soft); opacity: .7; }
.ss-exit:hover { opacity: 1; background: #22324a0f; }

.ss-main { max-width: 1180px; margin: 0 auto; padding: .5rem calc(var(--ss-safe-r) + 1.25rem) calc(var(--ss-safe-b) + 3rem) calc(var(--ss-safe-l) + 1.25rem); }
.ss-heading { font-weight: 700; font-size: clamp(1.7rem, 4.2vw, 2.6rem); line-height: 1.1; margin: .6rem 0 1.4rem; letter-spacing: -.01em; text-wrap: balance; }
.ss-section-title { font-weight: 700; font-size: clamp(1.15rem, 2.4vw, 1.4rem); margin: 0 0 .9rem; }

/* Continue reading */
.ss-continue { display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 3vw, 2rem); align-items: center; width: 100%;
  margin: 0 0 2.4rem; padding: clamp(1rem, 2.5vw, 1.5rem); border: 0; border-radius: 22px; text-align: left; cursor: pointer;
  background: linear-gradient(135deg, #22324a 0%, #2f4466 100%); color: #fdf6e6; box-shadow: 0 18px 40px #22324a33; }
.ss-continue__cover { width: clamp(92px, 16vw, 150px); }
.ss-continue__eyebrow { margin: 0 0 .25rem; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ss-gold); font-weight: 700; }
.ss-continue__title { margin: 0 0 .7rem; font-size: clamp(1.2rem, 3vw, 1.75rem); line-height: 1.15; font-weight: 700; text-wrap: balance; }
.ss-continue__meta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .95rem; opacity: .9; }
.ss-continue__go { display: inline-flex; align-items: center; gap: .4rem; margin-top: 1rem; padding: .6rem 1.2rem; border-radius: 999px; background: var(--ss-gold); color: #22324a; font-weight: 700; }
.ss-continue .ss-progress { width: min(240px, 100%); background: #ffffff2e; }
.ss-continue .ss-progress > i { background: var(--ss-gold); }

/* Shelves */
.ss-row { margin: 0 0 2.6rem; }
.ss-books { position: relative; display: flex; gap: clamp(1rem, 2.6vw, 1.9rem); margin: 0; padding: .4rem .2rem 0; list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ss-books::-webkit-scrollbar { display: none; }
.ss-books > li { flex: 0 0 clamp(138px, 21vw, 236px); scroll-snap-align: start; }
.ss-book { display: flex; flex-direction: column; gap: .55rem; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.ss-book__title { font-weight: 700; font-size: .98rem; line-height: 1.25; margin-top: 1.05rem; text-wrap: balance; }
.ss-book__meta { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; color: var(--ss-soft); }
.ss-cover { position: relative; display: block; z-index: 1; border-radius: 3px 8px 8px 3px; background: var(--ss-page);
  box-shadow: 0 1px 2px #3a2c1b33, 0 10px 22px -6px #3a2c1b55; transform-origin: 50% 100%; transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s; }
.ss-cover img { display: block; width: 100%; height: auto; border-radius: inherit; }
.ss-cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, #00000038 0, #0000000f 4%, #ffffff26 6%, transparent 10%, transparent 92%, #00000014); }
.ss-book:hover .ss-cover, .ss-book:focus-visible .ss-cover { transform: translateY(-6px) rotate(-.4deg); box-shadow: 0 2px 3px #3a2c1b33, 0 20px 30px -8px #3a2c1b66; }
.ss-book:active .ss-cover { transform: translateY(-2px) scale(.985); }
.ss-new { position: absolute; top: -9px; left: -9px; z-index: 2; padding: .22rem .62rem .26rem; border-radius: 999px; transform: rotate(-8deg); background: var(--ss-accent); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .04em; box-shadow: 0 4px 10px #b8320c55; }
.ss-progress { display: block; height: 5px; border-radius: 999px; background: #22324a1a; overflow: hidden; }
.ss-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--ss-ink); }
.ss-done { color: #2f7a4f; font-weight: 700; }

.ss-empty { max-width: 34rem; margin: 3rem auto; text-align: center; font-size: 1.1rem; color: var(--ss-soft); }
.ss-empty a, .ss-tip a { color: var(--ss-accent); font-weight: 700; }
.ss-tip { margin: 1rem 0 0; font-size: .85rem; color: var(--ss-soft); text-align: center; }

/* ---------- Reader ---------- */
.ss-reader { position: fixed; inset: 0; z-index: 10; overflow: hidden; outline: none; touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--ss-page); color: var(--ss-ink); }
.ss-reader[hidden] { display: none; }
.ss-reader.is-entering { animation: ss-fade-in .28s ease-out both; }
.ss-reader.is-leaving { animation: ss-fade-out .2s ease-in both; }
@keyframes ss-fade-in { from { opacity: 0; transform: scale(1.015); } }
@keyframes ss-fade-out { to { opacity: 0; } }
.ss-stage { position: absolute; inset: calc(var(--ss-safe-t) + 44px) var(--ss-safe-r) calc(var(--ss-safe-b) + 68px) var(--ss-safe-l); }
.ss-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: var(--ss-gap, 0px);
  padding: var(--ss-pad);
  will-change: transform, opacity; }
.ss-pages { display: flex; align-items: center; justify-content: center; flex: none; }
.ss-page { position: relative; margin: 0; width: var(--ss-pw); height: var(--ss-ph); background: var(--ss-page); overflow: hidden;
  box-shadow: 0 1px 2px #0006, 0 18px 50px -10px #000c; }
.ss-page img { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.ss-page .ss-image-unavailable { visibility: hidden; }
.ss-page-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; color: var(--ss-soft); animation: ss-show-page-status 0ms .35s both; }
.ss-page-status--error { animation: none; }
@keyframes ss-show-page-status { from { opacity: 0; } to { opacity: 1; } }
.ss-page--solo { border-radius: 4px; }
.ss-page--left { border-radius: 4px 0 0 4px; }
.ss-page--right { border-radius: 0 4px 4px 0; }
/* Spine shading where the two pages of an open book meet. */
.ss-page--left::after, .ss-page--right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
.ss-page--left::after { right: 0; background: linear-gradient(90deg, transparent, #00000014 60%, #0000003a); }
.ss-page--right::after { left: 0; background: linear-gradient(270deg, transparent, #00000014 60%, #0000003a); }
.ss-page--words { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em; padding: 12% 11%;
  color: var(--ss-ink); font-size: clamp(18px, calc(var(--ss-pw) * .04), 26px); font-weight: 700; line-height: 1.45; text-align: center; }
.ss-page--words p { margin: 0; text-wrap: pretty; }
.ss-page--words::before { content: ""; width: 3.2em; height: .9em; background: radial-gradient(circle, var(--ss-gold) 0 .16em, transparent .17em) 0 50% / 1.1em .9em repeat-x; opacity: .8; }

/* Readable words for small screens. */
.ss-words { flex: none; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  width: var(--ss-ww); height: var(--ss-wh); padding: .25rem .5rem; color: var(--ss-ink); font-weight: 700; font-size: var(--ss-wf, 1.25rem); line-height: 1.45; }
.ss-words p { margin: 0; max-width: 34ch; text-wrap: pretty; }
.ss-reader[data-mode="phone"] .ss-screen { flex-direction: column; }
.ss-words { transition: opacity .25s; }
.ss-page--art { box-shadow: none; background: transparent; }

/* End of the book */
.ss-screen--end { flex-direction: column; gap: 1.1rem; text-align: center; }
.ss-end__cover { height: auto; width: min(34vw, 26vh, 190px); border-radius: 3px 8px 8px 3px; box-shadow: 0 18px 40px -8px #000c; }
.ss-end__title { margin: .4rem 0 0; font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; color: var(--ss-ink); }
.ss-end__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: .4rem; }
.ss-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 48px; padding: .65rem 1.4rem; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; text-decoration: none;
  background: #ffffff1c; color: var(--ss-moon); }
.ss-btn--main { background: var(--ss-gold); color: #22324a; }
.ss-btn img { width: 26px; height: auto; border-radius: 2px; }

.ss-close { position: absolute; z-index: 5; top: auto; bottom: calc(var(--ss-safe-b) + 12px); right: calc(50% - 92px); color: #fff; opacity: .34; transition: opacity .2s; }
.ss-close:hover, .ss-close:focus-visible { opacity: .9; }

/* Brief overlay: title, page, switcher, print. */
.ss-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; transition: opacity .25s; }
.ss-hud[hidden] { display: block; opacity: 0; visibility: hidden; }
.ss-hud__top, .ss-hud__bottom { position: absolute; left: 0; right: 0; pointer-events: auto; }
.ss-hud__top { top: 0; padding: calc(var(--ss-safe-t) + .85rem) 4rem 2.2rem; text-align: center; background: linear-gradient(#000000b0, transparent); }
.ss-hud__title { margin: 0; font-weight: 700; font-size: 1.05rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-hud__count { margin: .1rem 0 0; font-size: .85rem; opacity: .75; }
.ss-hud__bottom { bottom: calc(var(--ss-safe-b) + 68px); padding: 2.4rem calc(var(--ss-safe-r) + 1rem) calc(var(--ss-safe-b) + .9rem) calc(var(--ss-safe-l) + 1rem); background: linear-gradient(transparent, #000000c4); }
.ss-scrub { display: block; width: min(680px, 100%); margin: 0 auto .8rem; accent-color: var(--ss-gold); height: 28px; }
.ss-hud__row { display: flex; align-items: center; justify-content: center; gap: .75rem; max-width: 900px; margin: 0 auto; }
.ss-hud__books { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0; }
.ss-hud__books button { flex: none; width: 38px; padding: 0; border: 2px solid transparent; border-radius: 4px; background: none; cursor: pointer; }
.ss-hud__books button[aria-current="true"] { border-color: var(--ss-gold); }
.ss-hud__books img { display: block; width: 100%; height: auto; border-radius: 2px; }
.ss-pill { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: .45rem 1rem; border-radius: 999px; border: 0; background: #ffffff24; color: #fff; font-weight: 700; font-size: .92rem; cursor: pointer; text-decoration: none; }
.ss-pill--print { background: #fff; color: #22324a; }
@media (max-width: 520px) { .ss-hud__row { flex-wrap: wrap; } .ss-hud__books { order: 3; flex-basis: 100%; justify-content: center; } }

/* Short landscape screens (tablets on their side): keep the whole shelf in view. */
@media (orientation: landscape) and (max-height: 900px) and (min-width: 700px) {
  .ss-heading { font-size: 2.1rem; margin: .1rem 0 .9rem; }
  .ss-continue { padding: .8rem 1.2rem; margin-bottom: 1.5rem; border-radius: 18px; }
  .ss-continue__cover { width: 76px; }
  .ss-continue__title { margin-bottom: .4rem; }
  .ss-continue__go { margin-top: .55rem; padding: .45rem 1.1rem; }
  .ss-books > li { flex-basis: clamp(128px, 25vh, 205px); }
}
@media (prefers-reduced-motion: reduce) {
  .ss-reader.is-entering, .ss-reader.is-leaving { animation: none; }
  .ss-cover, .ss-hud { transition: none; }
  .ss-book:hover .ss-cover, .ss-book:focus-visible .ss-cover { transform: none; }
}

/* The home screen is a cover grid, with no decorative shelf. */
.ss-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 40vw), 1fr)); gap: 28px 24px; overflow: visible; padding: 10px 4px; }
@media (min-width: 900px) { .ss-books { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 36px 32px; } }
.ss-books > li { min-width: 0; }
.ss-cover { max-width: 236px; }
.ss-book__title { margin-top: .2rem; }
.ss-screen--end { gap: .6rem; overflow-y: auto; touch-action: pan-y; }
.ss-end__actions { flex-direction: column; align-items: center; gap: 16px; }
.ss-next { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px; border: 0; background: transparent; color: var(--ss-ink); cursor: pointer; }
.ss-next__label { font-size: 1rem; font-weight: 700; }
.ss-next img { display: block; width: auto; height: min(48dvh, 380px); max-width: 70vw; object-fit: contain; border-radius: 5px; box-shadow: 0 8px 24px #0008; }
.ss-parent { position: absolute; top: auto; bottom: calc(var(--ss-safe-b) + 12px); left: calc(50% - 92px); min-width: 60px; min-height: 44px; border: 0; border-radius: 22px; background: transparent; color: #c9c4bd; font-size: 12px; cursor: pointer; touch-action: none; }
.ss-parent.is-holding { background: #ffffff30; }
.ss-gate { width: min(340px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; background: var(--ss-paper); color: var(--ss-ink); }
.ss-gate::backdrop { background: #000b; }
.ss-gate h2 { margin: 0 0 20px; }
.ss-gate label { display: block; margin-bottom: 8px; font-size: 24px; }
.ss-gate input { width: 100%; min-height: 48px; font: inherit; font-size: 22px; padding: 8px; }
.ss-gate form > div { display: flex; gap: 12px; }
.ss-gate button { min-height: 44px; padding: 8px 14px; cursor: pointer; }
.ss-hud__books button { width: 44px; }
@media (max-height: 450px) and (orientation: landscape) {
  .ss-screen--end { flex-direction: row !important; gap: 28px; }
  .ss-end__actions { flex-direction: row; }
  .ss-next img { height: 58dvh; }
}
.ss-close, .ss-parent { background: #15120fcc; color: #f4ead8; opacity: .8; }

@font-face { font-family: Newsreader; src: url('/static/fonts/imprint/newsreader-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url('/static/fonts/imprint/sourcesans3-normal.woff2') format('woff2'); font-display: swap; }
:root {
  --ss-paper: #fbf8f1;
  --ss-page: #fbf8f1;
  --ss-ink: #1f1b16;
  --ss-gold: #5e554a;
  --ss-font: "Source Sans 3", system-ui, sans-serif;
}
.ss-shelf, .ss-top { background: var(--ss-paper); }
.ss-top { border-bottom: 1px solid #d9d2c3; }
.ss-heading, .ss-section-title, .ss-continue__title { font-family: Newsreader, Georgia, serif; font-weight: 400; }
.ss-continue { background: none; color: var(--ss-ink); box-shadow: none; border-block: 1px solid #d9d2c3; border-radius: 0; }
.ss-continue__go { background: none; color: inherit; padding: 0; text-decoration: underline; }
.ss-new, .ss-cover::after, .ss-page--words::before { display: none; }
.ss-cover, .ss-page { border-radius: 1px; box-shadow: 0 2px 10px #1f1b1626; }
.ss-print, .ss-parent, .ss-close { min-height: 44px; border-radius: 2px; }
.ss-print {
  position: absolute;
  z-index: 5;
  top: var(--ss-safe-t);
  right: calc(var(--ss-safe-r) + 16px);
  display: grid;
  place-items: center;
  padding-inline: 20px;
  color: white;
  background: var(--ss-accent);
  text-decoration: none;
}
.ss-turn {
  position: absolute;
  z-index: 5;
  inset: auto var(--ss-safe-r) calc(var(--ss-safe-b) + 12px) var(--ss-safe-l);
  display: flex;
  justify-content: space-between;
  padding-inline: 12px;
  pointer-events: none;
}
.ss-turn button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #d9d2c3;
  border-radius: 2px;
  background: var(--ss-paper);
  color: var(--ss-ink);
  font-size: 26px;
  cursor: pointer;
  pointer-events: auto;
}
.ss-btn--main { border-radius: 2px; background: transparent; color: var(--ss-ink); border: 1px solid #d9d2c3; }
.ss-back {
  position: absolute;
  z-index: 5;
  top: calc(var(--ss-safe-t) + 8px);
  left: calc(var(--ss-safe-l) + 12px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 14px 0 8px;
  border: 1px solid #d9d2c3;
  border-radius: 2px;
  background: var(--ss-paper);
  color: var(--ss-ink);
  font-size: 15px;
  text-decoration: none;
}
.ss-back[hidden] { display: none; }
.ss-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Full screen on iPad: Safari keeps its close button in the top-left corner; keep the name clear of it. */
:root:fullscreen .ss-brand { padding-inline-start: 72px; }
:root:-webkit-full-screen .ss-brand { padding-inline-start: 72px; }

/* ---------- Reading mode: the book on a dark, calm surround ----------
   The one place on the site without the paper background (owner, 26 Nov
   2026). Warm near-black ink, quiet light controls; the pages are unchanged. */
:root { --ss-night: #17130f; --ss-dim: #e9e1d3; --ss-rule: #e9e1d32e; }
body.ss-reading { background: var(--ss-night); }
.ss-reader { background: var(--ss-night); color: var(--ss-dim); }
.ss-page { box-shadow: 0 2px 6px #0007, 0 22px 60px -18px #000; }
.ss-page--left::after { background: linear-gradient(90deg, transparent, #0000001a 60%, #00000047); }
.ss-page--right::after { background: linear-gradient(270deg, transparent, #0000001a 60%, #00000047); }
.ss-words, .ss-next, .ss-end__title { color: var(--ss-dim); }
.ss-end__title { font-family: Newsreader, Georgia, serif; font-weight: 400; }
.ss-end__cover, .ss-next img { box-shadow: 0 18px 40px -10px #000; }
.ss-turn button, .ss-close, .ss-parent, .ss-btn, .ss-btn--main {
  border: 1px solid var(--ss-rule); border-radius: 2px; background: transparent; color: var(--ss-dim); opacity: .72;
  transition: opacity .2s, background-color .2s; }
.ss-turn button:hover, .ss-close:hover, .ss-parent:hover, .ss-btn:hover,
.ss-turn button:focus-visible, .ss-close:focus-visible, .ss-parent:focus-visible, .ss-btn:focus-visible { opacity: 1; background: #e9e1d314; }
.ss-turn button { display: grid; place-items: center; min-width: 48px; min-height: 48px; font-size: 0; }
.ss-turn button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ss-btn { min-height: 48px; font-weight: 600; }
.ss-close, .ss-parent { width: auto; min-width: 48px; height: 48px; }
.ss-reader :focus-visible { outline-color: var(--ss-dim); }
.ss-print { min-height: 40px; top: calc(var(--ss-safe-t) + 2px); }

/* A sample book has a single way out: the close control, top right. */
.ss-reader--sample .ss-close { top: calc(var(--ss-safe-t) + 2px); bottom: auto; right: calc(var(--ss-safe-r) + 12px); width: 48px; height: 40px; min-height: 40px; }
.ss-reader--sample .ss-close svg { width: 18px; height: 18px; stroke-width: 1.6; }
.ss-reader--sample .ss-parent, .ss-reader--sample .ss-hud { display: none; }
