/* ============================================================================
   notebook.css — Senspot sidebar filter (notebook layout, brand colours).
   Loaded after custom.css. Covers the sidebar only.
   ============================================================================ */

:root {
  --nb-hand:     'Caveat', ui-rounded, cursive;
  --nb-type:     'Nunito', sans-serif;
  --nb-paper:    #ffffff;
  --nb-paper-2:  #f5f3ff;
  --nb-ink:      #1e0a42;
  --nb-ink-soft: #6b4ea0;
  --nb-rule:     rgba(107,33,168,.08);
  --nb-margin:   #6B21A8;
  --nb-line:     #e9d5ff;
  --nb-tape:     rgba(251,191,36,.4);
}

/* ── Layout: notebook fills the sidebar flex column ────────────────────────── */
.events-sidebar {
  background: transparent;
  overflow: visible; /* allow spiral to peek above */
}
.events-sidebar > .nb {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: visible; /* spiral overflows top */
}
/* scroll wrapper — replaces .sb-scroll-area visually */
.nb-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--nb-line) transparent;
}
.nb-scroll::-webkit-scrollbar { width: 4px; }
.nb-scroll::-webkit-scrollbar-thumb { background: var(--nb-line); border-radius: 2px; }

/* ── Shell ──────────────────────────────────────────────────────────────────── */
.nb {
  position: relative;
  background: var(--nb-paper);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(107,33,168,.18), 0 2px 0 rgba(0,0,0,.04);
  overflow: visible;
  color: var(--nb-ink);
  font-family: 'Nunito', sans-serif;
}
.nb::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(107,33,168,.04) 1px, transparent 1px);
  background-size: 7px 7px;
  opacity: .6;
  border-radius: 16px;
}

/* ── Close button (mobile drawer) ───────────────────────────────────────────── */
.nb-close {
  display: none;
  position: absolute;
  top: .7rem;
  right: .7rem;
  z-index: 20;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: rgba(107,33,168,.12);
  color: var(--nb-ink);
  align-items: center;
  justify-content: center;
}
.nb-close:hover { background: rgba(107,33,168,.22); }
.nb-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ── Spiral binding (real twin-loop wire image, tiled) ──────────────────────── */
.nb-spiral {
  position: relative;
  z-index: 12;
  height: 34px;
  margin-top: -39px;
  margin-bottom: -3px;
  background: url("../images/spiral-tile.png") repeat-x top center;
  background-size: auto 34px;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.22));
  border-radius: 16px 16px 0 0;
}

/* ── On-paper masthead ──────────────────────────────────────────────────────── */
.nb-masthead {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.15rem .5rem 1.35rem;
}
.nb-mast-glass {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  color: var(--nb-margin);
  transform: rotate(-8deg);
}
.nb-mast-glass svg { width: 1.35rem; height: 1.35rem; }
.nb-mast-label {
  font-family: var(--nb-hand);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--nb-ink);
}
.nb-mast-caseno {
  margin-left: auto;
  font-family: var(--nb-type);
  font-size: .62rem;
  letter-spacing: .05em;
  color: var(--nb-ink-soft);
  border: 1.5px solid var(--nb-line);
  border-radius: 4px;
  padding: .16rem .42rem;
  transform: rotate(2deg);
  white-space: nowrap;
}

/* ── Pages ──────────────────────────────────────────────────────────────────── */
.nb-pages {
  position: relative;
  z-index: 2;
  background: linear-gradient(var(--nb-paper), var(--nb-paper));
}

/* ── Location block ─────────────────────────────────────────────────────────── */
.nb-loc {
  position: relative;
  padding: 1rem 1.15rem 1.1rem 1.35rem;
  border-bottom: 1.5px dashed var(--nb-line);
}
.nb-loc-head {
  font-family: var(--nb-hand);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--nb-margin);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.nb-loc-pin { font-size: 1rem; }
.nb-field { margin-bottom: .8rem; }
.nb-field:last-child { margin-bottom: 0; }
.nb-lbl {
  display: block;
  font-family: var(--nb-type);
  font-size: .66rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--nb-ink-soft);
  margin-bottom: .3rem;
}
.nb-input-wrap { position: relative; }
.nb-input-glass {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.05rem;
  height: 1.05rem;
  color: var(--nb-margin);
  pointer-events: none;
}
.nb-input {
  width: 100%;
  border: 2px solid var(--nb-ink);
  border-radius: 10px;
  background: rgba(255,255,255,.7);
  padding: .6rem .7rem;
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--nb-ink);
  box-shadow: 2px 2px 0 rgba(107,33,168,.10);
}
.nb-input-wrap .nb-input { padding-left: 2.1rem; }
.nb-input::placeholder { color: #a99a82; font-weight: 600; }
.nb-input:focus {
  outline: none;
  border-color: var(--nb-margin);
  box-shadow: 2px 2px 0 rgba(107,33,168,.25), 0 0 0 3px rgba(107,33,168,.18);
}
.nb-select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232c2150' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  padding-right: 2.2rem;
}
.nb-range-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .1rem;
}
.nb-range-val {
  font-family: var(--nb-hand);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--nb-margin);
  white-space: nowrap;
}
.nb-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--nb-line);
  margin: .45rem 0 .35rem;
  cursor: pointer;
}
.nb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nb-margin);
  border: 3px solid var(--nb-paper);
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  cursor: pointer;
}
.nb-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nb-margin);
  border: 3px solid var(--nb-paper);
  cursor: pointer;
}
.nb-range:disabled { opacity: .5; }
.nb-range:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.nb-link {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--nb-margin);
  font-weight: 800;
  font-size: .84rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-style: wavy;
  text-decoration-thickness: 1px;
  padding: .1rem 0;
  font-family: 'Nunito', sans-serif;
}
.nb-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Clue board (active filters pinned) ─────────────────────────────────────── */
.nb-board {
  position: relative;
  padding: .85rem 1.15rem 1rem 1.35rem;
  background: rgba(248,184,30,.1);
  border-bottom: 1.5px dashed var(--nb-line);
}
.nb-board[hidden] { display: none; }
.nb-board-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
}
.nb-board-title {
  font-family: var(--nb-hand);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--nb-ink);
}
.nb-board-count {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: .78rem;
  background: var(--nb-margin);
  color: #fff;
  border-radius: 99px;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 .45rem;
  display: grid;
  place-items: center;
}
.nb-wipe {
  margin-left: auto;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--nb-ink-soft);
  font-weight: 800;
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
}
.nb-wipe:hover { color: var(--nb-margin); }
.nb-wipe:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nb-board-pins {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.nb-pin-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  background: #fff;
  border: 1.5px solid var(--nb-ink);
  border-radius: 7px;
  padding: .28rem .45rem .28rem .6rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--nb-ink);
  box-shadow: 1.5px 1.5px 0 rgba(107,33,168,.12);
  transform: rotate(-1deg);
  font-family: 'Nunito', sans-serif;
}
.nb-board-pins .nb-pin-chip:nth-child(even) { transform: rotate(1.5deg); }
.nb-pin-chip:hover { background: #fff5f2; border-color: var(--nb-margin); }
.nb-pin-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nb-pin-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--nb-margin);
  box-shadow: 0 0 0 2px rgba(107,33,168,.25);
  flex: none;
}
.nb-pin-x {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--nb-ink);
  color: #fff;
  font-size: .7rem;
  line-height: 1;
}

/* ── Clue section (collapsible) ─────────────────────────────────────────────── */
.nb-sec {
  position: relative;
  border-bottom: 1.5px dashed var(--nb-line);
}
.nb-sec:last-child { border-bottom: 0; }
.nb-sec-h { margin: 0; }
.nb-sec-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .7rem;
  cursor: pointer;
  background: none;
  border: 0;
  padding: .85rem 1.15rem .85rem 1.35rem;
  text-align: left;
  color: var(--nb-ink);
}
.nb-sec-btn.nb-sec-static { cursor: default; }
.nb-sec-btn:hover:not(.nb-sec-static) { background: rgba(107,33,168,.06); }
.nb-sec-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.nb-file {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--nb-type);
  font-size: .9rem;
  color: #fff;
  background: var(--nb-ink);
  box-shadow: 1.5px 1.5px 0 rgba(107,33,168,.14);
  transform: rotate(-3deg);
}
.nb-sec-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.nb-sec-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--nb-ink);
  line-height: 1.1;
}
.nb-sec-hint {
  font-family: var(--nb-hand);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--nb-margin);
  line-height: 1.05;
  margin-top: .1rem;
}
.nb-sec-n {
  flex: none;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: .74rem;
  background: var(--gold);
  color: var(--on-gold);
  border-radius: 99px;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 .42rem;
  display: grid;
  place-items: center;
}
.nb-sec-n[hidden] { display: none; }
.nb-chev {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--nb-ink-soft);
  transition: transform .2s;
}
.nb-sec[data-open="false"] .nb-chev { transform: rotate(-90deg); }
.nb-sec-body {
  padding: 0 1rem .9rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.nb-sec-body[hidden] { display: none; }

/* ── A single clue row ──────────────────────────────────────────────────────── */
.clue {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: .45rem .5rem;
  text-align: left;
  color: var(--nb-ink);
  position: relative;
  min-height: 44px;
  font-family: 'Nunito', sans-serif;
}
.clue:hover { background: rgba(107,33,168,.07); }
.clue[aria-disabled="true"] { opacity: .38; cursor: not-allowed; }
.clue[aria-disabled="true"]:hover { background: none; }
.clue:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.clue-label {
  flex: 1;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.25;
}
.clue[aria-checked="true"] .clue-label { color: #fff; }
.clue[aria-checked="true"] { color: #fff; }
.clue-glyph {
  flex: none;
  font-size: 1rem;
  line-height: 1;
  width: 1.3rem;
  text-align: center;
  filter: saturate(1.1);
}
.clue-dot {
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  flex: none;
}

/* count badge */
.clue-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  font-size: .76rem;
  font-weight: 800;
  color: var(--nb-ink-soft);
  background: rgba(107,33,168,.07);
  border-radius: 99px;
  padding: .08rem .42rem .08rem .34rem;
  font-variant-numeric: tabular-nums;
  font-family: 'Nunito', sans-serif;
}
.cc-glass { width: .78rem; height: .78rem; opacity: .7; }
.clue[aria-checked="true"] .clue-count {
  background: rgba(255,255,255,.25);
  color: #fff;
}
.clue-count[data-zero="true"] { opacity: .6; }

/* ── Clue markers (tick default) ────────────────────────────────────────────── */
.clue-mark {
  position: relative;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
}
.cm-box, .cm-pin, .cm-stamp { position: absolute; inset: 0; display: none; }

/* tick */
.nb[data-marker="tick"] .cm-box {
  display: grid;
  place-items: center;
  border: 2.2px solid var(--nb-ink);
  border-radius: 5px;
  background: rgba(255,255,255,.6);
}
.nb[data-marker="tick"] .clue[aria-checked="true"] .cm-box {
  background: var(--nb-margin);
  border-color: var(--nb-margin);
}
.cm-tick {
  width: 1.1rem;
  height: 1.1rem;
  color: #fff;
  opacity: 0;
  transform: scale(.5) rotate(-8deg);
  transition: .14s ease;
}
.nb[data-marker="tick"] .clue[aria-checked="true"] .cm-tick {
  opacity: 1;
  transform: scale(1) rotate(-6deg);
}

/* stamp */
.nb[data-marker="stamp"] .cm-box {
  display: grid;
  place-items: center;
  border: 2px dashed rgba(107,33,168,.25);
  border-radius: 5px;
  background: transparent;
}
.nb[data-marker="stamp"] .clue[aria-checked="true"] .cm-box { display: none; }
.nb[data-marker="stamp"] .clue-mark { width: 2.6rem; }
.nb[data-marker="stamp"] .clue[aria-checked="true"] .cm-stamp {
  display: grid;
  place-items: center;
  inset: -.1rem -.4rem;
  font-family: var(--nb-type);
  font-size: .6rem;
  letter-spacing: .02em;
  color: var(--nb-margin);
  border: 2px solid var(--nb-margin);
  border-radius: 5px;
  transform: rotate(-11deg);
  opacity: .9;
  box-shadow: inset 0 0 0 1px rgba(107,33,168,.3);
  background: rgba(107,33,168,.06);
}

/* pin */
.nb[data-marker="pin"] .cm-box {
  display: grid;
  place-items: center;
  border: 2px dotted rgba(107,33,168,.20);
  border-radius: 50%;
  background: transparent;
}
.nb[data-marker="pin"] .clue[aria-checked="true"] .cm-box { display: none; }
.nb[data-marker="pin"] .clue[aria-checked="true"] .cm-pin {
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a855f7 0%, #6B21A8 55%, #4C1D95 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 1px 1px rgba(255,255,255,.5);
  inset: .18rem;
}

/* ── Audience section ───────────────────────────────────────────────────────── */
.nb-aud .nb-sec-body { padding-bottom: 1rem; }

/* Audience uses real checkboxes for better semantics */
.nb-check-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .5rem;
  min-height: 44px;
  cursor: pointer;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
}
.nb-check-row:hover { background: rgba(107,33,168,.07); }
.nb-check-row input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--nb-margin);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
}
.nb-check-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.nb-check-label {
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.25;
  color: var(--nb-ink);
  cursor: pointer;
}

/* ── Case status footer ─────────────────────────────────────────────────────── */
.nb-status {
  flex-shrink: 0;
  background: linear-gradient(180deg, #f5f3ff 0%, #ede9fe 100%);
  color: var(--nb-ink);
  padding: .8rem 1.15rem;
  box-shadow: 0 -8px 22px rgba(107,33,168,.12);
  border-top: 2px dashed var(--nb-margin);
  border-radius: 0 0 16px 16px;
}
.nb-status-line {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.nb-status-stamp {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .95rem;
  color: var(--nb-margin);
  border: 2px solid var(--nb-margin);
  font-weight: 800;
  transform: rotate(-7deg);
  background: rgba(107,33,168,.06);
}
.nb-status-text {
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--nb-ink);
}
.nb-status-text b {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--nb-margin);
  font-size: 1.05rem;
}

/* ── "Show events" find button ──────────────────────────────────────────────── */
.nb-show {
  display: none; /* hidden on desktop — results visible alongside */
  width: 100%;
  margin-top: .7rem;
  justify-content: center;
  gap: .45rem;
  align-items: center;
  padding: .65rem 1rem;
  font-size: .98rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  background: linear-gradient(180deg, #FBBF24 0%, #F59E0B 100%);
  color: #1F1305;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #B45309, 0 6px 12px rgba(180,83,9,.25);
  transition: transform .12s, box-shadow .12s, filter .15s;
}
.nb-show:hover { filter: brightness(1.05); transform: translateY(-1px); }
.nb-show:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #B45309, 0 2px 6px rgba(180,83,9,.2);
}
.nb-show:focus-visible { outline: 3px solid var(--nb-ink); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════════
   SKIN: lined notebook (default) — ruled lines + red margin line
   ═══════════════════════════════════════════════════════════════════════════════ */
.nb[data-skin="lined"] .nb-pages {
  background-image:
    linear-gradient(to bottom, transparent 0, transparent calc(1.7rem - 1px), var(--nb-rule) calc(1.7rem - 1px), var(--nb-rule) 1.7rem);
  background-size: 100% 1.7rem;
}
.nb[data-skin="lined"] .nb-loc,
.nb[data-skin="lined"] .nb-board,
.nb[data-skin="lined"] .nb-sec {
  border-left: 2px solid var(--nb-margin);
  margin-left: .55rem;
}


/* ── Grid loading state ─────────────────────────────────────────────────────── */
.sb-loading { opacity: .5; pointer-events: none; transition: opacity .2s; }

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cm-tick { transition: none; }
  .nb-chev { transition: none; }
}

/* ── Mobile drawer ──────────────────────────────────────────────────────────── */
@media (max-width: 1040px) {
  .nb-close { display: flex; }
  .nb-show  { display: flex; }

  /* override desktop border-radius on mobile (drawer fills full height) */
  .events-sidebar .nb { border-radius: 0; }
  .nb-spiral { border-radius: 0; }
  .nb-status { border-radius: 0; }
}
