@font-face{font-family:'Fraunces';font-style:normal;font-weight:300 700;font-display:swap;src:url(fonts/fraunces-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Fraunces';font-style:normal;font-weight:300 700;font-display:swap;src:url(fonts/fraunces-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Nunito';font-style:normal;font-weight:500 800;font-display:swap;src:url(fonts/nunito-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Nunito';font-style:normal;font-weight:500 800;font-display:swap;src:url(fonts/nunito-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

:root {
  color-scheme: dark;
  --night: #100f26;
  --night-2: #19173a;
  --ink: #f6eedf;
  --ink-soft: #d8d0e6;
  --muted: #a9a0c4;
  --tati: #8fb6ff;
  --tati-gold: #f3c969;
  --mami: #ff9fbe;
  --mami-amber: #ffb35c;
  --lit: #ffe08f;
  --sung: #f3c98f;
  --line: rgba(246, 238, 223, .14);
  --gutter: 16px;
  --radius: 22px;
  --turn: 520ms;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --font-story: "Fraunces", Georgia, serif;
  --font-ui: "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Two lighthouse glows in the sky: tati left (blue-gold), mami right (rose-amber). */
.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vmax 50vmax at -10% -10%, rgba(143, 182, 255, .20), transparent 60%),
    radial-gradient(50vmax 40vmax at 0% 0%, rgba(243, 201, 105, .10), transparent 60%),
    radial-gradient(60vmax 50vmax at 110% -10%, rgba(255, 159, 190, .18), transparent 60%),
    radial-gradient(50vmax 40vmax at 100% 0%, rgba(255, 179, 92, .10), transparent 60%),
    linear-gradient(180deg, var(--night-2), var(--night) 70%);
}

.book {
  position: relative; z-index: 1;
  height: 100svh;
  display: flex; flex-direction: column;
  padding: 0 var(--gutter) max(12px, env(safe-area-inset-bottom));
  max-width: 1440px; margin: 0 auto;
}

.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 2px 8px;
}
.top h1 {
  margin: 0; font-family: var(--font-story); font-weight: 500; font-size: 17px; letter-spacing: .01em;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pageno { font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.top h1 { flex: 1 1 auto; min-width: 0; }
.top { align-items: center; }

/* The film on YouTube: small, always there, never louder than "Cântă cu mine". */
.yt {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px 0 9px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
  color: var(--ink); font: 700 14px/1 var(--font-ui); text-decoration: none; white-space: nowrap;
}
.yt svg { width: 22px; height: 16px; flex: none; }
.yt:hover { background: rgba(255, 255, 255, .12); }
.pageno { flex: none; white-space: nowrap; }
@media (max-width: 489px) {
  .top { gap: 10px; }
  .top h1 { font-size: 16px; }
  .yt { height: 28px; padding: 0 10px 0 8px; gap: 6px; font-size: 13px; }
  .yt svg { width: 20px; height: 14px; }
  .pageno { font-size: 15px; }
}
/* Too narrow for title + label + page number: the YouTube mark alone still says what it is. */
@media (max-width: 369px), (orientation: landscape) and (max-height: 560px) and (max-width: 739px) {
  .yt { width: 36px; padding: 0; justify-content: center; }
  .yt-l { display: none; }
}

/* ---------- pages ---------- */
.stage {
  position: relative; flex: 1; min-height: 0;
  touch-action: pan-y;
}
.page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  visibility: hidden;
}
.page.is-current { visibility: visible; }

.art {
  --art: min(calc(100vw - 2 * var(--gutter)), calc(100svh - 330px));
  width: var(--art); height: var(--art); flex: none;
  margin: 0; border-radius: var(--radius); overflow: hidden;
  background: #221d3f;
  box-shadow: 0 0 0 1px var(--line), 0 18px 50px -18px rgba(0, 0, 0, .7);
}
.art img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Placeholder until the final illustration lands: warm night, the scene title, a small lighthouse. */
.ph {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; text-align: center;
  background:
    radial-gradient(80% 70% at 20% 15%, rgba(143, 182, 255, .28), transparent 65%),
    radial-gradient(80% 70% at 85% 20%, rgba(255, 159, 190, .26), transparent 65%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 179, 92, .30), transparent 70%),
    #2a2150;
}
.ph svg { width: 44px; height: 44px; opacity: .9; }
.ph strong { font-family: var(--font-story); font-weight: 500; font-size: clamp(22px, 6vw, 34px); line-height: 1.15; }
.ph small { font-size: 13px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.text {
  width: 100%; max-width: 34em; flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 2px 4px 6px;
}
.text::-webkit-scrollbar { display: none; }
.text p {
  margin: 0 0 .5em;
  font-family: var(--font-story); font-weight: 400; font-optical-sizing: auto;
  font-size: clamp(18px, 4.9vw, 22px); line-height: 1.55;
  text-wrap: pretty;
}
.page.cover .text { display: flex; align-items: center; justify-content: center; text-align: center; }
.page.cover .text p {
  font-weight: 600; font-size: clamp(30px, 9vw, 48px); line-height: 1.12;
  color: var(--tati-gold);
}

.w { border-radius: 6px; cursor: pointer; transition: color 260ms ease, text-shadow 260ms ease; }
.singing .w.sung { color: var(--sung); }
.w.now {
  color: var(--lit);
  text-shadow: 0 0 14px rgba(255, 210, 122, .75), 0 0 2px rgba(255, 224, 143, .9);
  transition: color 60ms linear, text-shadow 60ms linear;
}

/* ---------- controls ---------- */
.controls { flex: none; padding-top: 10px; }
.buttons { display: flex; align-items: center; justify-content: center; gap: 16px; }
.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: rgba(255, 255, 255, .04); color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.play {
  height: 56px; min-width: 196px; padding: 0 24px 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-ui); font-weight: 800; font-size: 17px; letter-spacing: .01em;
  color: #2b1a05;
  background: linear-gradient(95deg, var(--tati-gold), var(--lit) 50%, var(--mami-amber));
  position: relative;
}
.play svg { width: 26px; height: 26px; fill: currentColor; }
.play .i-pause { display: none; }
.is-playing .play .i-play { display: none; }
.is-playing .play .i-pause { display: block; }
/* Visible the instant it's pressed, even while the audio is still buffering. */
.is-playing .play::after {
  content: ""; position: absolute; inset: -5px; border-radius: inherit;
  border: 2px solid rgba(255, 224, 143, .55);
  animation: breathe 2.4s ease-in-out infinite;
}
.is-waiting .play::after { animation-duration: .8s; }
@keyframes breathe { 0%, 100% { opacity: .25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.03); } }

.progress {
  display: flex; gap: 3px; height: 24px; align-items: center;
  margin: 10px auto 0; max-width: 560px; cursor: pointer;
}
.progress i {
  flex: 1; height: 5px; border-radius: 3px;
  background: rgba(246, 238, 223, .16); overflow: hidden; position: relative;
}
.progress i b {
  position: absolute; inset: 0; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--tati-gold), var(--mami-amber));
}
.progress i.done b { transform: scaleX(1); opacity: .7; }
.progress i.cur { height: 7px; background: rgba(246, 238, 223, .28); }

:focus-visible { outline: 2px solid var(--lit); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tablet / desktop: illustration left, text right ---------- */
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
  .book { padding-left: 32px; padding-right: 32px; }
  .top h1 { font-size: 19px; }
  .page {
    flex-direction: row; justify-content: center; align-items: center;
    gap: clamp(28px, 4vw, 64px);
  }
  .art { --art: min(52vw, calc(100svh - 190px)); }
  .text {
    flex: 0 1 30em; max-height: calc(100svh - 190px); height: auto;
    display: flex; flex-direction: column; justify-content: center;
  }
  .text p { font-size: clamp(20px, 1.7vw, 27px); }
  .page.cover .text { align-items: flex-start; text-align: left; }
  .page.cover .text p { font-size: clamp(40px, 4.4vw, 68px); }
}
@media (min-width: 1440px) {
  .text p { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .is-playing .play::after { animation: none; }
  .w, .w.now { transition: none; }
}

/* Dedication (last page): George's words, not sung. */
.page.dedication .text { display: flex; flex-direction: column; justify-content: center; }
.page.dedication .text p { font-size: 16px; color: var(--ink-soft); margin-bottom: .6em; }
.page.dedication .text p.msg { font-weight: 600; font-size: clamp(28px, 8vw, 38px); line-height: 1.15; color: var(--tati-gold); margin-bottom: .2em; }
.page.dedication .text p.sig { font-size: clamp(19px, 5vw, 22px); color: var(--ink); margin-bottom: 1.6em; }
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
  .page.dedication .text p.credit { font-size: clamp(16px, 1.25vw, 19px); }
  .page.dedication .text p.msg { font-size: clamp(38px, 3.6vw, 56px); }
  .page.dedication .text p.sig { font-size: clamp(22px, 1.8vw, 28px); }
}

/* ---------- the living scene (web/src/scene.js) over the illustration ---------- */
.scene-stack { position: absolute; z-index: 3; border-radius: var(--radius); overflow: hidden; opacity: 0; transition: opacity .6s ease; }
.scene-stack.on { opacity: 1; }
.scene-stack canvas.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Singing: one line at a time, large, the sung word lit. Browsing: the whole page. */
.is-playing .page:not(.cover):not(.dedication) .text { display: flex; align-items: center; justify-content: center; }
.is-playing .page:not(.cover):not(.dedication) .text p:not(:has(.cur-line)) { display: none; }
.is-playing .page:not(.cover):not(.dedication) .text .w:not(.cur-line) { display: none; }
.is-playing .page:not(.cover):not(.dedication) .text p { text-align: center; font-size: clamp(24px, 6.6vw, 31px); line-height: 1.35; margin: 0; }
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
  .is-playing .page:not(.cover):not(.dedication) .text p { font-size: clamp(30px, 2.6vw, 42px); text-align: left; }
  .is-playing .page:not(.cover):not(.dedication) .text { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .scene-stack { display: none; } }

/* ---------- phone landscape: the illustration as tall as the screen on the left;
   title, text and controls in the column on the right, all inside one viewport ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .book {
    --pad-y: 8px; --gap: clamp(16px, 3vw, 32px);
    --side: min(calc(100svh - 2 * var(--pad-y)), 52vw);
    --col: calc(var(--side) + var(--gap));
    --pad-l: max(16px, env(safe-area-inset-left)); --pad-r: max(16px, env(safe-area-inset-right));
    justify-content: space-between; max-width: none;
    padding: var(--pad-y) var(--pad-r) var(--pad-y) var(--pad-l);
  }
  .top, .controls { margin-left: var(--col); position: relative; z-index: 2; }
  .top { padding: 0; min-height: 32px; }
  .top h1 { font-size: 15px; }
  .pageno { font-size: 14px; }
  .stage { position: absolute; top: var(--pad-y); bottom: var(--pad-y); left: var(--pad-l); right: var(--pad-r); }
  .page { flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--gap); }
  .art { --art: var(--side); }
  .text {
    flex: 1 1 auto; max-width: 30em; height: 100%; max-height: none;
    padding: 40px 2px 74px;                       /* clears the title row above and the controls below */
    display: flex; flex-direction: column; justify-content: center;
  }
  .text p { font-size: clamp(15px, 2vw, 17px); line-height: 1.5; }
  .page.cover .text { align-items: flex-start; text-align: left; }
  .page.cover .text p { font-size: clamp(26px, 4vw, 36px); }
  .page.dedication .text p, .page.dedication .text p.credit { font-size: 13px; margin-bottom: .5em; }
  .page.dedication .text p.msg { font-size: clamp(20px, 3vw, 28px); }
  .page.dedication .text p.sig { font-size: 15px; margin-bottom: .9em; }
  .is-playing .page:not(.cover):not(.dedication) .text p { font-size: clamp(19px, 2.8vw, 25px); text-align: left; }
  .controls { padding-top: 0; }
  .buttons { gap: 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .play { height: 44px; min-width: 164px; font-size: 15px; padding: 0 18px 0 14px; }
  .play svg { width: 22px; height: 22px; }
  .progress { margin-top: 6px; height: 16px; }
}
