/* Notes reader: a quiet page-turning viewer for the free study notes. */
:root { --rd-bar: #fbfaf6; --rd-ink: #0e1320; --rd-muted: #626a7b; --rd-line: #e2ded2; --rd-desk: #e9e5d9; --rd-accent: #003080; }
.rd-sepia { --rd-bar: #efe4c9; --rd-ink: #3b2f1c; --rd-muted: #7b6a4c; --rd-line: #d9c9a2; --rd-desk: #dccba3; --rd-accent: #6b4a12; }
.rd-night { --rd-bar: #131722; --rd-ink: #e8ecf6; --rd-muted: #8e98b3; --rd-line: #262c3d; --rd-desk: #0b0e15; --rd-accent: #9db6ee; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px 1fr 60px; height: 100dvh; background: var(--rd-desk); color: var(--rd-ink); font-family: "Instrument Sans", system-ui, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; transition: background .3s; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.rd-top, .rd-bar { background: var(--rd-bar); display: flex; align-items: center; gap: 12px; padding: 0 14px; transition: background .3s; }
.rd-top { border-bottom: 1px solid var(--rd-line); justify-content: space-between; }
.rd-bar { border-top: 1px solid var(--rd-line); justify-content: center; }
.rd-back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; padding: 8px 10px; border-radius: 6px; flex: none; }
.rd-back:hover, .rd-btn:hover { background: color-mix(in srgb, var(--rd-ink) 8%, transparent); }
.rd-title { min-width: 0; flex: 1; text-align: center; line-height: 1.15; }
.rd-title b { display: block; font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title span { font-size: .72rem; color: var(--rd-muted); white-space: nowrap; }
.rd-tools { display: flex; gap: 2px; flex: none; position: relative; }
.rd-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 6px; cursor: pointer; }
.rd-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--rd-accent) 16%, transparent); color: var(--rd-accent); }
.rd-btn:disabled { opacity: .3; cursor: default; }
.rd-btn:disabled:hover { background: transparent; }

.rd-stage { position: relative; display: flex; overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.rd-stage.zoomed { overflow: auto; touch-action: auto; }
.rd-book { position: relative; margin: auto; flex: none; width: var(--bw); height: var(--ph); perspective: 2600px; transition: transform .8s cubic-bezier(.4, .1, .2, 1); }
.rd-book.instant, .rd-book.instant * { transition-duration: 0s !important; }
.rd-stage.zoomed .rd-book { transform: none !important; }
.leaf { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; transition: transform .85s cubic-bezier(.45, .05, .25, 1); }
.spread .leaf { left: 50%; width: 50%; transform-origin: left center; }
.spread .leaf.turned { transform: rotateY(-180deg); }
.single .leaf { left: 0; width: 100%; transform-origin: left center; transition: transform .7s cubic-bezier(.45, .05, .25, 1), opacity .5s ease .12s, visibility 0s; }
.single .leaf.turned { transform: rotateY(-100deg); opacity: 0; visibility: hidden; transition: transform .7s cubic-bezier(.45, .05, .25, 1), opacity .45s ease .2s, visibility 0s .7s; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 6px 18px rgba(0, 0, 0, .10); }
.face.back { transform: rotateY(180deg); }
.face.blank { background: #f6f3ea; }
.face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.spread .face.front::after { background: linear-gradient(to right, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 7%); }
.spread .face.back::after { background: linear-gradient(to left, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 7%); }
.single .face::after { background: linear-gradient(to right, rgba(0, 0, 0, .10), rgba(0, 0, 0, 0) 4%); }
.face img { width: 100%; height: 100%; object-fit: fill; display: block; opacity: 0; transition: opacity .3s; pointer-events: none; -webkit-user-drag: none; }
.face img.ready { opacity: 1; }
.face:not(.ready-face)::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, #fff 30%, #f1eee5 50%, #fff 70%); background-size: 200% 100%; animation: sheen 1.4s linear infinite; }
.face.ready-face::before { display: none; }
@keyframes sheen { to { background-position: -200% 0; } }
.rd-sepia .face img { filter: sepia(.3) saturate(.9) brightness(.97); }
.rd-night .face img { filter: invert(.9) hue-rotate(180deg) contrast(.95) brightness(.95); }
.rd-night .face { background: #151a26; }

.rd-count { font-size: .88rem; font-weight: 600; min-width: 112px; text-align: center; font-variant-numeric: tabular-nums; }
.rd-slider { flex: 1 1 0; min-width: 0; max-width: 460px; accent-color: var(--rd-accent); }
.rd-end { position: absolute; right: 14px; bottom: 72px; z-index: 5; background: var(--rd-accent); color: #fff; padding: 12px 18px; border-radius: 6px; font-weight: 600; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.rd-end:hover { color: #fff; filter: brightness(1.1); }
.rd-menu { position: absolute; right: 0; top: 46px; z-index: 20; min-width: 200px; background: var(--rd-bar); border: 1px solid var(--rd-line); border-radius: 8px; padding: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); }
.rd-menu a, .rd-menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; background: transparent; border-radius: 6px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.rd-menu a:hover, .rd-menu button:hover { background: color-mix(in srgb, var(--rd-ink) 8%, transparent); }
.rd-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(14, 19, 32, .82); color: #fff; font-size: .8rem; font-weight: 600; padding: 8px 14px; border-radius: 999px; pointer-events: none; transition: opacity .6s; z-index: 4; }
.rd-hint.gone { opacity: 0; }
.rd-fallback { padding: 24px; overflow: auto; }
.rd-fallback img { max-width: 720px; width: 100%; margin: 0 auto 16px; display: block; background: #fff; }
.rd-toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #0e1320; color: #fff; padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: .88rem; z-index: 50; opacity: 0; transition: opacity .25s; pointer-events: none; }
.rd-toast.show { opacity: 1; }

@media (max-width: 640px) {
  .rd-back span { display: none; }
  .rd-count { min-width: 0; font-size: .8rem; white-space: nowrap; }
  .rd-bar { gap: 4px; padding: 0 6px; }
  .rd-top { padding: 0 6px; gap: 6px; }
  .rd-slider { max-width: none; }
  .rd-btn { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .leaf, .rd-book { transition-duration: .01ms !important; }
  .face::before { animation: none; }
}
