/* pop-up paper panels on the home scene */
dialog.panel {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
    border: 0; background: transparent; color: var(--ink); overflow: hidden;
}
dialog.panel[open] { display: grid; place-items: center; }
dialog.panel::backdrop { background: rgba(10, 6, 24, .62); backdrop-filter: blur(3px); animation: bd-in .35s ease both; transition: opacity .6s ease; }
dialog.panel.falling::backdrop { opacity: 0; }
dialog.panel.falling { pointer-events: none; }
@keyframes bd-in { from { opacity: 0; } }

.paper-wrap { filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25)) drop-shadow(0 22px 40px rgba(0, 0, 0, .55)); will-change: transform; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
dialog.panel.falling .paper-wrap { animation: none; }
@keyframes pop { from { opacity: 0; transform: translateY(40px) scale(.8) rotate(-5deg); } }

.paper {
    position: relative; width: min(940px, 94vw); max-height: min(88vh, 820px); display: flex; background: var(--paper);
    clip-path: polygon(0 .5%, 5% 0, 20% .4%, 40% 0, 62% .5%, 80% 0, 100% .4%, 99.7% 99%, 82% 100%, 60% 99.5%, 38% 100%, 18% 99.6%, 0 100%);
}
.paper::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; background: repeating-linear-gradient(0deg, transparent 0 27px, rgba(120, 90, 50, .08) 27px 28px); }
.paper-scroll { overflow: auto; width: 100%; padding: 2rem clamp(1.1rem, 3vw, 2.2rem) 2.4rem; overscroll-behavior: contain; font-family: var(--font); line-height: 1.65; }
.paper .tape { position: absolute; top: -.3rem; left: 50%; width: 5.5rem; height: 1.7rem; margin-left: -2.75rem; background: rgba(232, 128, 95, .75); transform: rotate(-3deg); z-index: 3; }
#panel-photos .tape, #panel-learn .tape { background: rgba(143, 191, 159, .85); transform: rotate(3deg); }

.panel-close {
    position: absolute; top: .9rem; right: 1rem; z-index: 4; width: 2.6rem; height: 2.6rem; border-radius: 50%; cursor: pointer; font: 700 1.6rem/1 var(--font);
    color: var(--paper); background: var(--ink); border: 2px dashed rgba(244, 234, 214, .6); display: grid; place-items: center; padding-bottom: .15em;
}
.panel-close:hover, .panel-close:focus-visible { background: var(--coral); border-style: solid; outline: none; transform: rotate(8deg) scale(1.08); }

.eyebrow { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--coral); }
.paper h2 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.1; margin: .1em 3rem .4em 0; transform: rotate(-1deg); transform-origin: left; }
.paper h2 span { color: var(--coral); }
.paper .sub { max-width: 40rem; opacity: .8; margin-bottom: 1.6rem; }
.paper a { color: inherit; }

.about { display: grid; grid-template-columns: minmax(150px, 250px) 1fr; gap: 2rem; align-items: start; margin-top: 1rem; }
.about p { margin: 0 0 1em; }
.lead { font-size: 1.1rem; font-weight: 600; }
.sticker { position: relative; isolation: isolate; transform: rotate(-3deg); background: #1c1538; border: 6px solid #fffaf0; border-radius: 18px; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); overflow: hidden; aspect-ratio: 1; }
.sticker img { position: absolute; width: 230%; max-width: none; left: -62%; top: -8%; }
.sticker::after { content: ""; position: absolute; inset: 0; background: url(assets/bg.webp) center / cover; z-index: -1; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem 1.2rem; margin: 1.3rem 0; }
.facts dt { font-size: .7rem; letter-spacing: .12em; color: var(--coral); font-weight: 700; }
.facts dd { font-weight: 600; }
.btns { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.2rem; }
.btn { display: inline-block; text-decoration: none; font-weight: 700; background: var(--ink); color: var(--paper) !important; padding: .5em 1.2em; border-radius: 8px 14px 9px 13px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); transition: transform .2s; }
.btn:hover, .btn:focus-visible { transform: translateY(-3px) rotate(-1.5deg); background: var(--coral); outline: none; }

.polaroids { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2rem 1.4rem; align-items: start; padding: .6rem .3rem; }
.polaroid { position: relative; background: #fffaf0; color: var(--ink); padding: .7rem .7rem 0; border: 0; text-align: left; font: inherit; cursor: zoom-in; box-shadow: 0 3px 0 rgba(0, 0, 0, .15), 0 12px 24px rgba(60, 40, 20, .3); transform: rotate(var(--r, 0deg)); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.polaroid:nth-child(6n+1) { --r: -2.2deg; } .polaroid:nth-child(6n+2) { --r: 1.6deg; } .polaroid:nth-child(6n+3) { --r: -1deg; }
.polaroid:nth-child(6n+4) { --r: 2.4deg; } .polaroid:nth-child(6n+5) { --r: -1.8deg; } .polaroid:nth-child(6n) { --r: 1deg; }
.polaroid:hover, .polaroid:focus-visible { transform: rotate(0) scale(1.04) translateY(-4px); outline: none; z-index: 3; }
.polaroid:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.polaroid img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: #1c1538; }
.polaroid .cap { display: block; padding: .6rem .2rem .9rem; }
.polaroid strong { display: block; font-size: .95rem; }
.polaroid small { font-size: .72rem; opacity: .65; }
.polaroid .pin { position: absolute; top: -.7rem; left: 50%; width: 1.3rem; height: 1.3rem; margin-left: -.65rem; border-radius: 50%; z-index: 2; background: radial-gradient(circle at 35% 30%, #fff6, transparent 35%), var(--coral); box-shadow: 0 3px 5px rgba(0, 0, 0, .4); }
.polaroid:nth-child(even) .pin { background: radial-gradient(circle at 35% 30%, #fff6, transparent 35%), #8fbf9f; }

.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.8rem 1.3rem; padding: .8rem .3rem; }
.note { position: relative; display: flex; flex-direction: column; text-decoration: none; background: #fffaf0; color: var(--ink); padding: 1.5rem 1.2rem 1.1rem; transform: rotate(var(--r, 0deg)); box-shadow: 0 3px 0 rgba(0, 0, 0, .15), 0 12px 24px rgba(60, 40, 20, .28); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.note:nth-child(4n+1) { --r: -1.4deg; } .note:nth-child(4n+2) { --r: 1deg; background: #f6e9c9; } .note:nth-child(4n+3) { --r: -.6deg; } .note:nth-child(4n) { --r: 1.6deg; background: #ebe8d2; }
.note:hover, .note:focus-visible { transform: rotate(0) translateY(-5px) scale(1.02); outline: none; z-index: 3; }
.note:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.note::before { content: ""; position: absolute; top: -.55rem; left: 50%; width: 4rem; height: 1.3rem; margin-left: -2rem; background: rgba(232, 128, 95, .72); transform: rotate(-2deg); }
.note:nth-child(even)::before { background: rgba(143, 191, 159, .8); transform: rotate(3deg); }
.note h3 { font-size: 1.08rem; margin-bottom: .2em; }
.tagline { align-self: flex-start; font-size: .64rem; letter-spacing: .1em; font-weight: 700; color: var(--paper); background: var(--ink); padding: .1em .7em; border-radius: 99px; margin-bottom: .6em; }
.note p { font-size: .88rem; flex: 1; }
.note .go { margin-top: .8em; font-weight: 700; color: var(--coral); font-size: .9rem; }

.lessons { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem 1.2rem; }
.lessons a { display: flex; gap: .8rem; align-items: baseline; text-decoration: none; font-weight: 600; padding: .5em .8em; border-bottom: 2px dashed rgba(42, 33, 66, .25); transition: background .2s, transform .2s; }
.lessons a:hover, .lessons a:focus-visible { background: rgba(232, 128, 95, .22); transform: translateX(4px); outline: none; }
.lessons span { color: var(--coral); font-size: .8rem; font-weight: 700; }

/* photo lightbox (above the panel) */
dialog.lightbox { border: 0; background: transparent; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; overflow: hidden; color: var(--paper); }
dialog.lightbox::backdrop { background: rgba(10, 6, 24, .88); }
.lb { height: 100%; display: grid; grid-template-rows: 1fr; justify-items: center; align-items: center; padding: 1.2rem 4rem; }
.lb figure { max-height: 100%; background: #fffaf0; padding: .7rem .7rem 0; box-shadow: 0 20px 60px #000a; transform: rotate(-.6deg); display: flex; flex-direction: column; min-height: 0; }
.lb img { height: auto; width: auto; min-height: 0; max-width: min(90vw, 1200px); max-height: calc(100vh - 8rem); object-fit: contain; display: block; }
.lb figcaption { color: var(--ink); padding: .6rem .2rem .8rem; text-align: center; font-family: var(--font); }
.lb figcaption strong { display: block; } .lb figcaption small { opacity: .65; }
.lb button { position: absolute; font: inherit; font-size: 1.6rem; width: 2.8rem; height: 2.8rem; border-radius: 50%; border: 2px dashed rgba(244, 234, 214, .6); background: rgba(18, 13, 38, .7); color: var(--paper); cursor: pointer; }
.lb button:hover, .lb button:focus-visible { background: var(--paper); color: var(--ink); border-style: solid; outline: none; }
.lb .x { top: 1rem; right: 1rem; } .lb .prev { left: .8rem; top: 50%; } .lb .next { right: .8rem; top: 50%; }

@media (max-width: 700px) {
    .about { grid-template-columns: 1fr; }
    .sticker { width: 210px; margin: 0 auto; }
    .paper { width: 96vw; max-height: 90vh; }
    .lb { padding: 1rem .5rem; }
    .lb .prev { left: .3rem; top: auto; bottom: .8rem; } .lb .next { right: .3rem; top: auto; bottom: .8rem; }
}
@media (prefers-reduced-motion: reduce) { .paper-wrap { animation: none; } }
