/* Sticker notebook layer + reader-app player.
   Fun lives around the text, never behind it. Body text keeps the rules in blog.css. */
:root { --tape: rgba(255, 255, 255, .6); --note-shadow: 0 1px 0 rgba(0,0,0,.04), 0 10px 18px -12px rgba(60, 40, 10, .45);
  --note-pink: #fbc3ef; --note-blue: #bfd0fa; --note-gold: #f6e3aa; --note-mint: #bfe7cf; }
:root[data-page="dark"] { --tape: rgba(255, 255, 255, .3); --note-shadow: 0 10px 18px -10px rgba(0,0,0,.8); }
.hand { font-family: "Fredoka", var(--read-font); font-weight: 500; }

/* title: marker swoosh under it, star doodle beside it */
h1.title::after { content: ""; display: block; width: min(9em, 80%); height: .38em; margin-top: .15em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cpath d='M4 16 C 60 4, 140 6, 200 12 S 280 14, 296 6' fill='none' stroke='%23a9dfbf' stroke-width='9' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; }
.b-hero { position: relative; }
.b-hero::before { content: ""; position: absolute; right: -.2em; top: 1.4em; width: 1.6em; height: 1.6em; transform: rotate(12deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 56 56'%3E%3Cpath d='M24 4 L29 18 L44 18.5 L32 27.5 L36.5 42 L24 33.5 L11.5 42 L16 27.5 L4 18.5 L19 18 Z' fill='%23f3d98f' stroke='%23fff' stroke-width='5.4' stroke-linejoin='round' paint-order='stroke'/%3E%3C/svg%3E") no-repeat center / contain; }

/* ===== reader-app player (like Pagepurr's own bottom bar) ===== */
.player { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px 14px; background: var(--ink); color: #fff; border-radius: 22px; padding: 12px 14px 12px 12px; margin: 0 0 6px; box-shadow: var(--note-shadow); }
:root[data-page="dark"] .player { background: #f6efe1; color: var(--ink); }
.player .listen { grid-row: span 2; width: 56px; height: 56px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; background: var(--pg-accent); color: var(--ink); }
.player .listen .b-dot, :root[data-page] .player .listen .b-dot { width: auto; height: auto; background: none; color: inherit; }
.player .listen .icon { width: 28px; height: 28px; margin-left: 3px; }
.player .listen .b-dot svg { width: 30px; height: 30px; }
.player .listen .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.player .p-title { font: 700 17px/1.2 var(--read-font); align-self: end; }
.player .p-time { font: 600 14px/1 var(--read-font); opacity: .7; align-self: end; justify-self: end; }
.player .p-track { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.22); overflow: hidden; align-self: start; margin-top: 4px; }
:root[data-page="dark"] .player .p-track { background: rgba(0,0,0,.15); }
.player .p-track span { display: block; height: 100%; width: 0; background: var(--pg-accent); border-radius: 3px; transition: width .3s; }
:root[data-page="dark"] .player .p-track span { background: #2f8a5a; }
.player .p-speed { grid-column: 3; grid-row: 1; }
.p-speed { min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1.5px solid currentColor; background: none; color: inherit; font: 700 14px/1 var(--read-font); cursor: pointer; opacity: .85; }
.player .p-time { display: none; }
/* while reading, the player floats at the bottom of the screen */
.player.is-live { position: fixed; z-index: 35; left: 50%; bottom: 14px; translate: -50% 0; width: min(560px, calc(100% - 24px)); box-sizing: border-box; margin: 0; }
.player-spot { min-height: 0; }
.player-spot.holding { min-height: 84px; }
.b-bar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 4px; }

/* summary = taped index card */
.tldr { position: relative; background: #fffdf7; color: #1f1b16; border-radius: 6px; padding: 1.3em 1.2em .4em; margin: 2em 0 2.4em; transform: rotate(-.8deg); box-shadow: var(--note-shadow); }
:root[data-page="dark"] .tldr { background: #f6efe1; }
.tldr::before { content: ""; position: absolute; top: -12px; left: 50%; width: 110px; height: 26px; translate: -50% 0; rotate: 2deg; background: var(--tape); border: 1px solid rgba(0,0,0,.06); }
.tldr h2 { font-family: "Fredoka", var(--read-font); font-weight: 500; font-size: .95em; color: #a23b74; }

/* tips: heading on a taped sticky note, text plain below */
.tip { border-top: 0; padding-top: .6em; }
.tip-head { position: relative; display: inline-flex; align-items: center; gap: .5em; max-width: 100%; box-sizing: border-box; padding: .7em 1em .7em .8em; margin: 0 0 .9em; border-radius: 4px; color: var(--ink); box-shadow: var(--note-shadow); transform: rotate(-1.2deg); }
.tip:nth-of-type(even) .tip-head { transform: rotate(1deg); margin-left: .6em; }
.tip-head::before { content: ""; position: absolute; top: -11px; left: 22px; width: 64px; height: 22px; rotate: -4deg; background: var(--tape); border: 1px solid rgba(0,0,0,.06); }
.tip-head h2 { color: var(--ink); font-size: 1.15em; }
.tip .num { background: none; width: auto; height: auto; font: 500 1.6em/1 "Fredoka", var(--read-font); color: var(--ink); opacity: .85; margin: 0; }
.c-pink .tip-head { background: var(--note-pink); } .c-blue .tip-head { background: var(--note-blue); } .c-gold .tip-head { background: var(--note-gold); } .c-mint .tip-head { background: var(--note-mint); }
.tip + .tip::before { content: ""; display: block; width: 46px; height: 18px; margin: -.2em 0 1.2em 1em; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 20'%3E%3Cpath d='M2 10 Q 9 2 16 10 T 30 10 T 44 10 T 58 10' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain; }

/* key words: marker highlight */
.article strong { background: linear-gradient(104deg, transparent .2em, var(--pg-hl) .2em, var(--pg-hl) calc(100% - .15em), transparent calc(100% - .15em)) 0 .6em / 100% .65em no-repeat; padding: 0 .08em; }

/* study number = round sticker */
.stat { background: none; padding: 0; gap: 4px 18px; }
.stat b { display: grid; place-items: center; width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--note-blue); color: var(--ink); font: 500 1.5em/1 "Fredoka", var(--read-font); transform: rotate(-8deg); box-shadow: var(--note-shadow); }

/* end card = big taped sticker with paws */
.endcard { position: relative; border-radius: 8px; transform: rotate(.6deg); box-shadow: var(--note-shadow); }
.endcard::before { content: ""; position: absolute; top: -12px; right: 40px; width: 90px; height: 24px; rotate: 5deg; background: var(--tape); border: 1px solid rgba(0,0,0,.06); }
.endcard::after { content: ""; position: absolute; right: 18px; bottom: 16px; width: 70px; height: 56px; opacity: .3;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 56'%3E%3Cg fill='%230a0a0a'%3E%3Cellipse cx='18' cy='40' rx='7' ry='6'/%3E%3Ccircle cx='10' cy='31' r='3'/%3E%3Ccircle cx='16' cy='27' r='3'/%3E%3Ccircle cx='23' cy='28' r='3'/%3E%3Ccircle cx='27' cy='34' r='3'/%3E%3Cellipse cx='50' cy='20' rx='7' ry='6'/%3E%3Ccircle cx='42' cy='11' r='3'/%3E%3Ccircle cx='48' cy='7' r='3'/%3E%3Ccircle cx='55' cy='8' r='3'/%3E%3Ccircle cx='59' cy='14' r='3'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain; }
.endcard h2 { font-family: "Fredoka", var(--read-font); font-weight: 500; font-size: 1.4em; }

/* front page: posts pinned as sticky notes */
.ix-hero h1::after { content: ""; display: block; width: 5.5em; height: .35em; margin-top: .1em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cpath d='M4 16 C 60 4, 140 6, 200 12 S 280 14, 296 6' fill='none' stroke='%23f9abee' stroke-width='9' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; }
.b-cards { gap: 30px; }
.b-cards li { border-top: 0; }
.b-card { position: relative; padding: 1.2em 1.2em 1em; border-radius: 4px; color: var(--ink); box-shadow: var(--note-shadow); transform: rotate(-1deg); }
.b-cards li:nth-child(even) .b-card { transform: rotate(1deg); }
.b-card::before { content: ""; position: absolute; top: -11px; left: 50%; width: 80px; height: 22px; translate: -50% 0; rotate: -3deg; background: var(--tape); border: 1px solid rgba(0,0,0,.06); }
.b-card.c-pink { background: var(--note-pink); } .b-card.c-blue { background: var(--note-blue); } .b-card.c-gold { background: var(--note-gold); } .b-card.c-mint { background: var(--note-mint); }
.b-card .kicker, .b-card .go { color: rgba(10,10,10,.7); }
.b-card:hover, .b-card:focus-visible { transform: rotate(0) translateY(-2px); }

@media (max-width: 560px) {
  .b-hero::before { right: 0; top: .5em; width: 1.2em; height: 1.2em; }
  .tip:nth-of-type(even) .tip-head { margin-left: .3em; }
}
@media (prefers-reduced-motion: reduce) {
  .tldr, .tip-head, .tip:nth-of-type(even) .tip-head, .endcard, .b-card, .stat b, .b-hero::before { transform: none !important; }
}
@media (forced-colors: active) { .tip-head, .tldr, .b-card, .player { border: 2px solid CanvasText; } }
body:has(.player.is-live) { padding-bottom: 110px; }

/* app sticker icons */
.listen .icon { width: 24px; height: 24px; }
.quiet .icon, .toplink .icon, .b-card .go .icon { width: 22px; height: 22px; }
.endcard .cta .icon { width: 22px; height: 22px; }

.p-close { grid-column: 4; grid-row: 1; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.p-close[hidden] { display: none; }
.p-close .icon { width: 22px; height: 22px; }
.p-close:hover { background: rgba(127,127,127,.18); }

/* ===== fun top: sticker chips + sticker player with a sound wave ===== */
.meta { gap: 10px 10px; align-items: center; margin: 0 0 1.4em; }
.m-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; font: 600 15px/1 var(--read-font); color: var(--ink); border: 3px solid #fff; box-shadow: var(--note-shadow); }
.m-chip .icon { width: 20px; height: 20px; }
.m-date { background: var(--note-gold); transform: rotate(-2deg); }
.m-read { background: var(--note-blue); transform: rotate(1.5deg); }
.m-listen { background: var(--note-pink); transform: rotate(-1deg); }

.player { position: relative; grid-template-columns: auto 1fr auto auto; background: var(--note-mint) !important; color: var(--ink) !important; border: 4px solid #fff; border-radius: 26px; padding: 16px 16px 14px 14px; transform: rotate(-.6deg); }
.player::before { content: ""; position: absolute; top: -13px; right: 70px; width: 96px; height: 26px; rotate: 4deg; background: var(--tape); border: 1px solid rgba(0,0,0,.06); }
.player.is-live { transform: none; }
.player.is-live::before { display: none; }
.player .listen, :root[data-page] .player .listen { width: 64px; height: 64px; background: var(--ink); color: #fff; box-shadow: 0 0 0 4px #fff; }
.player .listen:hover { transform: scale(1.05); }
.player .listen:active { transform: scale(.96); }
.p-text { display: grid; gap: 3px; align-self: end; }
.player .p-title { font: 500 21px/1.1 "Fredoka", var(--read-font); }
.p-sub { font: 600 14px/1.2 var(--read-font); opacity: .72; }
.player.is-live .p-sub { display: none; }
.p-speed { background: var(--note-gold) !important; border: 3px solid #fff !important; color: var(--ink) !important; opacity: 1 !important; min-width: 48px; box-shadow: var(--note-shadow); transform: rotate(4deg); }
.p-wave { grid-column: 2 / -1; display: flex; align-items: center; gap: 3px; height: 30px; margin-top: 4px; }
.p-wave i { flex: 1; height: var(--h); min-height: 4px; border-radius: 3px; background: rgba(10,10,10,.22); transition: background .3s; }
.p-wave i.done { background: var(--ink); }
.player.is-playing .p-wave i { animation: pp-bounce 1.1s ease-in-out infinite alternate; }
.player.is-playing .p-wave i:nth-child(3n) { animation-delay: -.4s; }
.player.is-playing .p-wave i:nth-child(3n+1) { animation-delay: -.8s; }
@keyframes pp-bounce { from { transform: scaleY(.55); } to { transform: scaleY(1); } }
.p-close { color: var(--ink) !important; }

#settings-toggle { margin-top: 10px; padding: 0 16px; border-radius: 999px; background: var(--note-blue); color: var(--ink); border: 3px solid #fff; box-shadow: var(--note-shadow); transform: rotate(1deg); text-decoration: none; }
#settings-toggle[aria-expanded="true"] { background: var(--note-gold); }

@media (max-width: 560px) { .p-sub { display: none; } .player .p-title { font-size: 18px; } }
@media (prefers-reduced-motion: reduce) {
  .m-chip, .player, .p-speed, #settings-toggle { transform: none !important; }
  .player.is-playing .p-wave i { animation: none; }
}
