@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700;800&display=swap');
:root{
  --cream:#fff7ef;--ink:#3f2d3c;--muted:#8a7580;
  --coral:#ff7a59;--coral-dark:#ef5f3c;
  --sky:#5cc6e8;--teal:#37c2a8;--sun:#ffca4b;--plum:#7a5aa8;
  --line:#f0e0d2;--radius:26px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
  font-size: 17.5px;
  font-weight: 600;
}
h1, h2, h3, .logo { font-family: 'Fredoka', sans-serif; font-weight: 600; letter-spacing: .2px; }
a { color: var(--coral-dark); }
.skip-link {
  position: fixed; top: -5rem; left: 1rem; z-index: 50;
  padding: .65rem .9rem; border-radius: .6rem; background: var(--ink); color: #fff;
}
.skip-link:focus { top: 1rem; }

/* Nav - matches main site */
.site-nav { position: sticky; top: 0; background: rgba(255,247,239,.92); backdrop-filter: blur(10px); border-bottom: 2px solid var(--line); z-index: 30; }
.site-nav .inner { max-width: 900px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 72px; }
.site-nav .logo { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.site-nav .logo .moon { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3a1, var(--sun)); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 4px 12px rgba(255,202,75,.5); }
.site-nav .logo b { color: var(--coral); }
.site-nav .actions { display: flex; align-items: center; gap: 18px; }
.site-nav a.back-link { font-weight: 700; text-decoration: none; color: var(--muted); font-size: .95rem; }
.site-nav a.back-link:hover { color: var(--coral-dark); }
.site-nav button.print-btn { border: 0; border-radius: 999px; padding: .6rem 1.3rem; background: var(--coral); color: #fff; font-family: 'Fredoka', sans-serif; font-weight: 600; cursor: pointer; box-shadow: 0 6px 0 0 var(--coral-dark); transition: transform .15s, box-shadow .15s; font-size: .95rem; }
.site-nav button.print-btn:hover { transform: translateY(-2px); }
.site-nav button.print-btn:active { transform: translateY(2px); box-shadow: 0 3px 0 0 var(--coral-dark); }

main { width: min(100% - 2rem, 860px); margin: 0 auto; padding: 3rem 0 5rem; }

/* leaflet detail header */
.leaflet-header { margin-bottom: 2rem; }
.leaflet-header .topic-icon { width: 78px; height: 78px; border-radius: 22px; margin-bottom: 18px; box-shadow: 0 12px 26px rgba(63,45,60,.16); display: block; }
.tag { display: inline-block; font-family: 'Fredoka', sans-serif; font-size: .82rem; text-transform: uppercase; letter-spacing: .6px; padding: 6px 16px; border-radius: 999px; margin-bottom: 14px; font-weight: 600; background: #efe6fb; color: #6a4c93; }
h1 { max-width: 820px; margin: 0; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.1; letter-spacing: -.01em; color: var(--ink); }

.source-part { margin-top: 1.5rem; padding: clamp(1.4rem, 3vw, 2.2rem); border: 2px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 15px 38px rgba(63,45,60,.06); }
.source-part .part-label { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 1.3rem; color: var(--coral-dark); font-family: 'Fredoka', sans-serif; font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; background: #ffe6de; padding: 6px 14px; border-radius: 999px; }

.source-text { font-size: 1.02rem; }
.source-text h3 { font-family: 'Fredoka', sans-serif; font-size: 1.18rem; color: var(--plum); margin: 1.7rem 0 .7rem; letter-spacing: 0; }
.source-text h3:first-child { margin-top: 0; }
.source-text p { margin: 0 0 1.05rem; color: #5f4d57; }
.source-text ul { margin: 0 0 1.2rem; padding-left: 0; list-style: none; }
.source-text li { position: relative; padding-left: 28px; margin-bottom: .65rem; color: #5f4d57; }
.source-text li::before { content: ''; position: absolute; left: 4px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }

.site-footer { padding: 2rem 1rem 3rem; color: var(--muted); text-align: center; font-size: .85rem; }

/* library index */
.hero { max-width: 820px; margin-bottom: 2rem; }
.hero h1 { font-size: clamp(2.3rem, 7vw, 3.7rem); }
.hero .lede { max-width: 680px; margin: 1rem 0 0; color: var(--muted); font-size: 1.08rem; }

.tools { margin-bottom: 1.5rem; }
.tools label { display: block; margin-bottom: .5rem; font-weight: 700; font-family: 'Fredoka', sans-serif; }
input { width: min(100%, 620px); border: 2px solid var(--line); border-radius: 16px; padding: .9rem 1.1rem; background: #fff; color: inherit; font: inherit; box-shadow: 0 8px 20px rgba(63,45,60,.05); }
input:focus { outline: 3px solid rgba(255,122,89,.25); border-color: var(--coral); }
.count { margin: .7rem 0 0; color: var(--muted); font-size: .9rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 1rem; }
.card { display: flex; min-height: 100px; flex-direction: row; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 12px 30px rgba(63,45,60,.05); text-decoration: none; color: inherit; transition: transform .18s, box-shadow .18s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(255,120,80,.16); border-color: #ffd9c7; }
.card .card-icon { flex: none; width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--cream); }
.card h2 { margin: 0; font-size: 1.08rem; line-height: 1.28; letter-spacing: 0; font-family: 'Fredoka', sans-serif; font-weight: 600; color: var(--ink); }
.card[hidden] { display: none; }

@media (max-width: 620px) {
  .site-nav .inner { padding: 0 16px; }
  .site-nav .actions { gap: 10px; }
  .site-nav button.print-btn { padding: .55rem .9rem; font-size: .85rem; }
  main { width: min(100% - 1.2rem, 860px); padding-top: 2.25rem; }
  .source-part { border-radius: 18px; }
}
@media print {
  @page { margin: 16mm; }
  body { background: #fff; }
  .skip-link, .site-nav, .site-footer { display: none !important; }
  main { width: auto; margin: 0; padding: 0; }
  .source-part { border: 0; box-shadow: none; padding: 0; break-inside: avoid; }
}
