/* =========================================================================
   Note board: cork board, sticky notes, polaroids, leave-a-note dialog, viewer.
   Style keys (colors/shapes/fonts/pins) mirror note_style_pools() in functions.php.
   ========================================================================= */

/* ---- Handwriting fonts (self-hosted, SIL OFL 1.1, see fonts/OFL.txt) ---- */
@font-face{font-family:"Note Caveat";src:url("../fonts/caveat.woff2") format("woff2");font-weight:400 700;font-display:swap}
@font-face{font-family:"Note Patrick";src:url("../fonts/patrick.woff2") format("woff2");font-display:swap}
@font-face{font-family:"Note Kalam";src:url("../fonts/kalam.woff2") format("woff2");font-display:swap}
@font-face{font-family:"Note Shadows";src:url("../fonts/shadows.woff2") format("woff2");font-display:swap}
@font-face{font-family:"Note Indie";src:url("../fonts/indie.woff2") format("woff2");font-display:swap}

/* ---- Board ---- */
.nb-intro{margin:0 0 1.2rem;max-width:70ch}
.nb-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.8rem 1.2rem;margin:0 0 1.4rem}
.nb-actions .btn{cursor:pointer;font-size:1.05rem;display:inline-flex;align-items:center;gap:.5em}
.nb-count{color:var(--muted);font-size:.92rem}
.section.has-bg .nb-count{color:rgba(255,255,255,.85)}

.cork-frame{position:relative;border-radius:12px;padding:14px;
  background:
    repeating-linear-gradient(92deg,rgba(255,255,255,.06) 0 2px,transparent 2px 9px),
    repeating-linear-gradient(88deg,rgba(0,0,0,.08) 0 1px,transparent 1px 13px),
    linear-gradient(135deg,#8a5a34 0%,#6d4325 45%,#7d4f2c 70%,#5c381d 100%);
  box-shadow:0 18px 40px rgba(20,10,0,.35),inset 0 1px 0 rgba(255,255,255,.18),inset 0 -2px 0 rgba(0,0,0,.3)}
.cork-board{position:relative;min-height:340px;border-radius:4px;padding:44px clamp(14px,3vw,40px) 40px;
  background-color:#bf8a55;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .18 0 0 0 0 .07 0 0 0 1.6 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.45' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .78 0 0 0 0 .55 0 0 0 1.4 -.72'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 30% 20%,rgba(255,220,170,.25),transparent 60%),
    radial-gradient(ellipse at 80% 90%,rgba(80,40,10,.25),transparent 55%);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.25),inset 0 6px 18px rgba(40,20,0,.45),inset 0 0 60px rgba(60,30,5,.35)}
.nb-empty{margin:3rem auto;max-width:30ch;text-align:center;font:1.6rem/1.3 "Note Caveat",cursive;color:#3b2410;
  background:rgba(255,248,225,.85);padding:1rem 1.4rem;border-radius:3px;transform:rotate(-1.5deg);
  box-shadow:0 8px 14px -6px rgba(0,0,0,.4)}

.note-grid{list-style:none;margin:0;padding:0;display:grid;justify-content:center;align-items:end;
  grid-template-columns:repeat(auto-fill,var(--note-w));gap:46px 34px;--note-w:220px}
.note-grid > li{display:flex;justify-content:center}
.note-grid > li[hidden]{display:none}
.nb-more{display:flex;justify-content:center;margin-top:1.4rem}
.nb-more .btn{cursor:pointer}

/* ---- One note "card": optional polaroid + sticky note ---- */
.note-card{--note-w:220px;position:relative;width:var(--note-w);transform:rotate(var(--tilt,0deg));
  transition:transform .25s ease;outline:none}
.note-card.is-openable{cursor:pointer}
.note-card.is-openable:hover,.note-card.is-openable:focus-visible{transform:rotate(var(--tilt,0deg)) translateY(-4px) scale(1.03);z-index:2}
.note-card:focus-visible .note{outline:3px solid var(--accent);outline-offset:4px}
.note-card.has-photo{padding-top:118px}

.note{--c1:#fff59a;--c2:#f6e35c;--fold:#e7d14a;position:relative;z-index:1;width:var(--note-w);aspect-ratio:1/1;
  filter:drop-shadow(0 7px 7px rgba(30,15,0,.35)) drop-shadow(0 1px 1px rgba(30,15,0,.25))}
.note-paper{position:absolute;inset:0;background:linear-gradient(170deg,var(--c1) 0%,var(--c1) 55%,var(--c2) 100%)}
/* Subtle shading on every note: slightly darker adhesive strip at the top, faint sheen below it */
.note-paper::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;
  background:linear-gradient(to bottom,rgba(0,0,0,.04) 0,rgba(0,0,0,.03) 13%,rgba(255,255,255,.14) 18%,transparent 40%,transparent 80%,rgba(0,0,0,.035) 100%)}
.note-body{position:absolute;inset:0;display:flex;flex-direction:column;padding:30px 18px 12px;color:#25222e;
  font-family:var(--nf);font-size:var(--nfs);line-height:var(--nlh,1.22)}
.note-msg{flex:1 1 auto;min-height:0;margin:0;overflow:hidden;white-space:pre-line;overflow-wrap:anywhere;word-break:break-word}
.note-more{display:inline;border:0;background:rgba(0,0,0,.08);color:#2c2a3a;border-radius:999px;cursor:pointer;
  font:600 .72rem/1 system-ui,-apple-system,"Segoe UI",sans-serif;padding:.28em .6em;margin-left:.15em;vertical-align:.12em;white-space:nowrap}
.note-more:hover,.note-more:focus-visible{background:rgba(0,0,0,.18)}
.note-sig{flex:0 0 auto;margin:.15em 0 0;padding-right:.25em;text-align:right;font-size:.92em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Colors */
.note.c-yellow  {--c1:#fff59a;--c2:#f3df52;--fold:#e2cc3e}
.note.c-pink    {--c1:#ffc6dc;--c2:#f9a3c4;--fold:#ee8fb2}
.note.c-lavender{--c1:#e3d6ff;--c2:#c9b5f6;--fold:#b9a2ec}
.note.c-lime    {--c1:#e0f7a0;--c2:#c4e56c;--fold:#b2d65a}
.note.c-sky     {--c1:#c8ecff;--c2:#9fd6f6;--fold:#8bc8ec}
.note.c-peach   {--c1:#ffdcb8;--c2:#f9bd86;--fold:#eeaa70}
.note.c-cream   {--c1:#fffbea;--c2:#f2e8c4;--fold:#e2d6ac}

/* Fonts (size tuned so each holds roughly the same amount of text) */
.note.f-caveat  {--nf:"Note Caveat",cursive;--nfs:23px;--nlh:1.12}
.note.f-patrick {--nf:"Note Patrick",cursive;--nfs:19px;--nlh:1.18}
.note.f-kalam   {--nf:"Note Kalam",cursive;--nfs:16.5px;--nlh:1.3}
.note.f-shadows {--nf:"Note Shadows",cursive;--nfs:19px;--nlh:1.25}
.note.f-indie   {--nf:"Note Indie",cursive;--nfs:17px;--nlh:1.3}

/* Shapes */
/* flat: square with a gently lifted bottom edge */
.note.s-flat .note-paper{border-radius:1px 1px 3px 3px / 1px 1px 10px 10px}

/* curl-br: bottom-right corner lifting slightly off the board (soft curve + shading, no fold) */
.note.s-curl-br .note-paper{border-radius:1px 1px 80px 2px / 1px 1px 9px 2px;
  background:
    radial-gradient(ellipse 60% 45% at 100% 100%,rgba(0,0,0,.12),transparent 70%),
    linear-gradient(170deg,var(--c1) 0%,var(--c1) 55%,var(--c2) 100%)}
.note.s-curl-br::before{content:"";position:absolute;z-index:-1;right:6px;bottom:3px;width:52%;height:22%;
  background:rgba(30,15,0,.5);filter:blur(8px);transform:skew(12deg) rotate(4deg)}

/* curl-tl (key kept for stored notes): mirror of curl-br, bottom-left corner lifting slightly */
.note.s-curl-tl .note-paper{border-radius:1px 1px 2px 80px / 1px 1px 2px 9px;
  background:
    radial-gradient(ellipse 60% 45% at 0% 100%,rgba(0,0,0,.12),transparent 70%),
    linear-gradient(190deg,var(--c1) 0%,var(--c1) 55%,var(--c2) 100%)}
.note.s-curl-tl::before{content:"";position:absolute;z-index:-1;left:6px;bottom:3px;width:52%;height:22%;
  background:rgba(30,15,0,.5);filter:blur(8px);transform:skew(-12deg) rotate(-4deg)}

/* curl-both: both bottom corners lifting off the board */
.note.s-curl-both{filter:drop-shadow(0 3px 3px rgba(30,15,0,.3))}
.note.s-curl-both .note-paper{border-radius:2px 2px 14px 14px / 2px 2px 26px 26px;
  background:
    radial-gradient(ellipse at 0% 100%,rgba(0,0,0,.10),transparent 30%),
    radial-gradient(ellipse at 100% 100%,rgba(0,0,0,.10),transparent 30%),
    linear-gradient(170deg,var(--c1) 0%,var(--c1) 55%,var(--c2) 100%)}
.note.s-curl-both::before,.note.s-curl-both::after{content:"";position:absolute;z-index:-1;bottom:14px;width:46%;height:22%;
  background:rgba(30,15,0,.55);filter:blur(7px)}
.note.s-curl-both::before{left:8px;transform:skew(-10deg) rotate(-5deg)}
.note.s-curl-both::after{right:8px;transform:skew(10deg) rotate(5deg)}

/* leaf: two rounded corners, two sharp */
.note.s-leaf .note-paper{border-radius:3px 46px 3px 46px}
.note.s-leaf .note-body{padding:30px 22px 14px}

/* Pins (also used on polaroids) */
.pin{--p1:#ff5a6e;--p2:#b5142b;position:absolute;z-index:5;top:-7px;left:50%;width:20px;height:20px;margin-left:-10px;border-radius:50%;
  background:radial-gradient(circle at 34% 30%,#fff 0 2px,var(--p1) 4px,var(--p2) 100%);
  box-shadow:3px 5px 4px rgba(0,0,0,.4),inset -2px -2px 3px rgba(0,0,0,.25);pointer-events:none}
.pin::after{content:"";position:absolute;left:11px;top:13px;width:2px;height:8px;border-radius:1px;
  background:linear-gradient(#bbb,#777);transform:rotate(-28deg);transform-origin:top;z-index:-1}
.pin.p-red   {--p1:#ff5a6e;--p2:#b5142b}
.pin.p-blue  {--p1:#5aa8ff;--p2:#1a4fb5}
.pin.p-yellow{--p1:#ffe066;--p2:#d39b00}
.pin.p-white {--p1:#ffffff;--p2:#bdbdbd}
.pin.p-black {--p1:#6a6a6a;--p2:#141414}
.note.s-curl-both .pin,.note.s-leaf .pin{left:auto;right:30px}

/* Polaroid pinned above the note, its bottom edge tucked under the note */
.polaroid{position:absolute;z-index:0;right:2px;top:0;width:150px;margin:0;padding:7px 7px 24px;background:#fbfaf6;
  transform:rotate(6deg);box-shadow:0 6px 10px rgba(0,0,0,.35),0 0 0 1px rgba(0,0,0,.05)}
.note-card.ph-left .polaroid{right:auto;left:2px;transform:rotate(-6deg)}
.polaroid img{display:block;width:100%;aspect-ratio:1/1;object-fit:cover;background:#ddd}
.polaroid .pin{top:-8px}

/* ---- Viewer (large note) ---- */
.nv-modal,.nn-modal{position:fixed;inset:0;z-index:1300;background:rgba(8,26,40,.72);display:flex;align-items:center;
  justify-content:center;padding:1.2rem;overflow-y:auto}
.nv-modal[hidden],.nn-modal[hidden]{display:none}
.nv-stage{position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:2.4rem 3rem;
  max-width:980px;width:100%;padding:2.4rem 1rem}
.nv-close,.nn-close{position:absolute;top:.4rem;right:.6rem;background:none;border:0;font-size:2.2rem;line-height:1;cursor:pointer;color:#fff}
.nv-close:hover,.nv-close:focus-visible{color:var(--accent)}
.nv-stage .note-card{--note-w:min(400px,84vw);transform:rotate(var(--tilt,0deg))}
.nv-stage .note{aspect-ratio:auto;min-height:var(--note-w)}
.nv-stage .note-body{position:relative;inset:auto;min-height:var(--note-w);padding:44px 34px 22px;font-size:calc(var(--nfs) * 1.45)}
.nv-stage .note-msg{overflow:visible}
.nv-stage .polaroid{position:relative;right:auto;left:auto;top:auto;width:min(380px,80vw);transform:rotate(3deg);padding:12px 12px 46px}
.nv-stage .polaroid img{aspect-ratio:auto;max-height:70vh;object-fit:contain;background:#eee}
@media (min-width:600px){
  .nv-stage.has-photo{flex-wrap:nowrap;gap:2.4rem}
  .nv-stage.has-photo .note-card{--note-w:min(400px,42vw);flex:0 0 auto}
  .nv-stage.has-photo .polaroid{width:min(380px,38vw);flex:0 0 auto}
}

/* ---- Leave-a-note dialog ---- */
.nn-dialog{position:relative;background:#fff;color:var(--ink);border-radius:16px;width:min(760px,100%);
  padding:1.6rem 1.6rem 1.3rem;box-shadow:0 24px 60px rgba(0,0,0,.4);margin:auto}
.nn-dialog h3{margin:0 2rem .3rem 0;font-size:1.35rem}
.nn-close{color:#666;top:.5rem;right:.7rem;font-size:2rem}
.nn-close:hover,.nn-close:focus-visible{color:#111}
.nn-sub{margin:0 0 1rem;color:var(--muted);font-size:.92rem}
.nn-grid{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:1.4rem;align-items:start}
.nn-form label{display:block;font-weight:600;font-size:.9rem;margin-bottom:.9rem;color:var(--ink)}
.nn-form input[type=text],.nn-form textarea{display:block;width:100%;margin-top:.3rem;padding:.6em .75em;border:1px solid #cfd8de;
  border-radius:10px;font:inherit;font-weight:400;color:var(--ink);background:#fff}
.nn-form textarea{min-height:130px;resize:vertical}
.nn-form input:focus,.nn-form textarea:focus{outline:2px solid var(--accent);outline-offset:1px}
.nn-opt{font-weight:400;color:var(--muted)}
.nn-counter{display:flex;justify-content:flex-end;font-weight:400;font-size:.8rem;color:var(--muted);margin-top:.25rem}
.nn-counter.is-near{color:#a35d00}
.nn-counter.is-max{color:#b3261e;font-weight:700}
.nn-warn{margin:-.4rem 0 .9rem;padding:.55rem .75rem;border-radius:10px;background:#fff4d6;color:#7a4b00;font-size:.85rem;border:1px solid #f1d58f}
.nn-warn[hidden]{display:none}
.nn-photo{display:flex;align-items:center;gap:.7rem;flex-wrap:wrap;margin-bottom:.9rem}
.nn-photo-btn{cursor:pointer}
.nn-photo input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.nn-photo-name{font-size:.85rem;color:var(--muted);max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nn-photo-remove{background:none;border:0;color:#b3261e;cursor:pointer;font-size:.85rem;text-decoration:underline}
.nn-photo-remove[hidden]{display:none}
.nn-preview{position:sticky;top:0}
.nn-preview-label{display:flex;justify-content:space-between;align-items:center;font-weight:600;font-size:.9rem;margin:0 0 .5rem}
.nn-shuffle{cursor:pointer;display:inline-flex;align-items:center;gap:.35em}
.nn-stage{border-radius:10px;padding:34px 10px 26px;display:flex;justify-content:center;overflow:hidden;
  background-color:#bf8a55;background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .18 0 0 0 0 .07 0 0 0 1.6 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow:inset 0 4px 14px rgba(40,20,0,.45)}
.nn-stage .note-card{transform:rotate(var(--tilt,0deg))}
.nn-hint{font-size:.78rem;color:var(--muted);margin:.5rem 0 0;text-align:center}
.nn-err{margin:.2rem 0 .8rem;padding:.55rem .75rem;border-radius:10px;background:#fde7e9;color:#8c1d18;font-size:.88rem}
.nn-err[hidden]{display:none}
.nn-actions{display:flex;justify-content:flex-end;gap:.6rem;margin-top:1rem;flex-wrap:wrap}
.nn-actions .btn{cursor:pointer}
.nn-actions .btn[disabled]{opacity:.6;cursor:progress}
.nn-done{text-align:center;padding:1.4rem .4rem .4rem}
.nn-done[hidden]{display:none}
.nn-done-ico{font-size:2.6rem;line-height:1}
.nn-done h3{margin:.5rem 0 .4rem}
.nn-done p{color:var(--muted);margin:0 auto 1.2rem;max-width:44ch}
.nn-form .cf-turnstile{margin:.2rem 0 .4rem}

body.nn-lock{overflow:hidden}

@media (max-width:720px){
  .nn-grid{grid-template-columns:1fr}
  .nn-preview{position:static;order:-1}
  .nn-dialog{padding:1.3rem 1rem 1rem}
}
/* Phones: shrink notes uniformly (zoom keeps line breaks identical to the preview). */
@media (max-width:540px){
  .note-grid{--note-w:220px;grid-template-columns:repeat(auto-fill,calc(var(--note-w) * .7));gap:30px 18px}
  .note-grid > li > .note-card{zoom:.7}
  .cork-board{padding:34px 10px 30px}
  .cork-frame{padding:9px}
}
@media (prefers-reduced-motion:reduce){
  .note-card{transition:none}
}
