/* Habib Family hub — classroom-newsletter look: paper, stickers, marker pens. */
:root {
  --paper: #FBF6EC;
  --ink: #23231f;
  --card: #ffffff;
  --line: #23231f;
  --mint: #DDF0E2;
  --mint-deep: #2E7D5B;
  --blush: #FADCE1;
  --blush-deep: #C2566B;
  --butter: #FDEBC2;
  --butter-deep: #A9761B;
  --sky: #D9EDF7;
  --red: #D0342C;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root { --glow-a: rgba(46,125,91,.06); --glow-b: rgba(194,86,107,.06); }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, var(--glow-a), transparent 34%),
    radial-gradient(circle at 88% 30%, var(--glow-b), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family: "Nunito", -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding: calc(14px + env(safe-area-inset-top)) clamp(10px, 3vw, 28px) calc(60px + env(safe-area-inset-bottom));
  max-width: 1080px;
  margin-inline: auto;
}

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 4px 5px 0 rgba(35, 35, 31, .12);
}

/* ---------- masthead ---------- */
.masthead { padding: 14px 18px; margin-bottom: 18px; background: var(--card); }
.masthead-top { display: flex; align-items: center; gap: 14px; }
.sticker { font-size: 40px; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.15)); }
.masthead h1 {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: clamp(26px, 5vw, 36px);
  margin: 0;
  letter-spacing: .5px;
}
.sub { margin: 2px 0 0; font-weight: 700; color: #6b675e; }

/* ---------- panels ---------- */
.panel { margin-bottom: 22px; border-radius: 22px; padding: 14px; }
.panel-today { background: var(--mint); border: 2px solid var(--line); }
.panel-cal { background: transparent; padding: 0; }
.panel-lists { background: var(--butter); border: 2px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel-news { background: var(--blush); border: 2px solid var(--line); }
.panel-title, .card-title {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 22px;
  margin: 2px 4px 10px;
}
.card-title { margin: 0 0 10px; }
.sticker-sm { font-size: 18px; }

/* ---------- today ---------- */
.today-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kid-card { padding: 12px 14px; }
.kid-card h3 {
  font-family: "Baloo 2", cursive; font-weight: 800; font-size: 19px;
  margin: 0 0 6px; display: flex; align-items: center; gap: 8px;
}
.kid-chip { font-size: 13px; font-weight: 800; padding: 1px 10px; border-radius: 99px; border: 2px solid var(--line); }
.kid-card.noah .kid-chip { background: var(--mint); }
.kid-card.sama .kid-chip { background: var(--blush); }
.kid-card.fam  .kid-chip { background: var(--butter); }
.kid-line { margin: 4px 0; font-weight: 700; }
.kid-line .lbl { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.kid-line.flag { color: var(--red); font-weight: 800; }
.kid-line.muted { color: #6c6754; font-weight: 600; font-style: italic; }

/* ---------- month head ---------- */
.month-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin-bottom: 0;
}
.month-title { font-family: "Baloo 2", cursive; font-weight: 800; font-size: clamp(30px, 7vw, 52px); letter-spacing: 2px; line-height: 1; user-select: none; }
.month-title .L { display: inline-block; transform: rotate(var(--tilt, 0deg)); text-shadow: 2px 2px 0 rgba(0,0,0,.18); }
.month-title .yr { font-size: .4em; font-weight: 700; color: #6b675e; margin-left: 10px; letter-spacing: 0; }
.nav-btn {
  font-size: 26px; font-weight: 800; width: 44px; height: 44px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--butter);
  cursor: pointer; box-shadow: 2px 3px 0 rgba(0,0,0,.15);
}
.nav-btn:active { transform: translate(1px, 2px); box-shadow: none; }
.dots { display: flex; justify-content: space-evenly; padding: 10px 8px; }
.dots::before { content: "● ● ● ● ● ● ● ●"; letter-spacing: 1.2em; font-size: 13px; color: var(--ink); opacity: .9; white-space: nowrap; overflow: hidden; }

/* ---------- calendar ---------- */
.cal { overflow: hidden; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(5, 1fr) .55fr .55fr;
  background: #23231f; color: #fff;
}
.cal-weekdays div { min-width: 0; overflow: hidden;
  font-family: "Baloo 2", cursive; font-weight: 800; text-align: center;
  padding: 8px 2px; font-size: clamp(11px, 1.9vw, 17px); letter-spacing: .5px;
}
.wd-0 { color: #ff8fc0; } .wd-1 { color: #ffb648; } .wd-2 { color: #ffe83d; }
.wd-3 { color: #7be382; } .wd-4 { color: #59d8e6; } .wd-5, .wd-6 { color: #cfcabc; }
.cal-grid { display: grid; grid-template-columns: repeat(5, 1fr) .55fr .55fr; }
.cell { min-width: 0; overflow: hidden;
  min-height: 92px; border-top: 2px solid var(--line); border-right: 2px solid var(--line);
  padding: 4px 5px; cursor: pointer; position: relative; background: #fff;
}
.cell:nth-child(7n) { border-right: none; }
.cell.weekend { background: #F4EFE3; }
.cell.other { background: #FAFAF6; }
.cell.other .dnum { opacity: .25; }
.cell.today { outline: 4px solid #FFD44D; outline-offset: -4px; }
.dnum { font-family: "Baloo 2", cursive; font-weight: 800; font-size: 17px; }
.cycle { font-weight: 800; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
.cycle .subj { font-weight: 700; }
.flagline { color: var(--red); font-weight: 800; font-size: 12px; line-height: 1.2; margin-top: 1px; overflow-wrap: anywhere; }
.flagline.nice { color: #1c8a3c; }
.evt { overflow-wrap: anywhere;
  display: block; width: 100%; text-align: left; margin-top: 3px;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 1px 6px;
  font-family: "Nunito", sans-serif; font-weight: 800; font-size: 11.5px; line-height: 1.3;
  cursor: pointer; background: #fff;
}
.evt.noah { background: var(--mint); }
.evt.sama { background: var(--blush); }
.evt.family { background: var(--butter); }
.evt .t { font-weight: 700; opacity: .85; }
.cal-hint { text-align: center; font-weight: 700; color: #5f5b50; font-size: 14px; margin: 10px 0 0; }

/* ---------- lists ---------- */
.list-card { padding: 14px 16px; }
.up-item { margin: 0 0 10px; font-weight: 700; }
.up-item .date { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.up-item .who { font-size: 12.5px; font-weight: 800; border: 1.5px solid var(--line); border-radius: 99px; padding: 0 8px; margin-left: 6px; }
.up-item .who.noah { background: var(--mint); } .up-item .who.sama { background: var(--blush); } .up-item .who.family { background: var(--butter); }
.rem-item { display: flex; gap: 8px; margin-bottom: 10px; font-weight: 700; align-items: baseline; }
.rem-item .bullet { font-size: 15px; }
.ann-item { border-top: 2px dashed #d8d2c2; padding: 10px 2px 2px; margin-top: 10px; }
.ann-item:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.ann-item h4 { margin: 0 0 3px; font-family: "Baloo 2", cursive; font-size: 17px; font-weight: 800; }
.ann-item p { margin: 0; font-weight: 600; }
.ann-item .meta { font-size: 12.5px; color: #6c6754; font-weight: 700; margin-top: 3px; }
.todo-tag { background: #FFD44D; border: 1.5px solid var(--line); font-size: 11px; font-weight: 800; padding: 0 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.empty { color: #6c6754; font-style: italic; font-weight: 600; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(88, 62, 30, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(440px, 100%); padding: 18px; max-height: 92vh; overflow: auto; }
#event-form label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
#event-form input[type=text], #event-form input[type=date], #event-form input[type=time] {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 700;
  border: 2px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #FFFDF7;
}
.opt { font-weight: 600; color: #85806f; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who-row { display: flex; gap: 8px; margin-top: 5px; }
.who {
  flex: 1; font: inherit; font-weight: 800; padding: 8px 0;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; opacity: .55;
}
.who.noah { background: var(--mint); } .who.sama { background: var(--blush); } .who.family { background: var(--butter); }
.who.sel { opacity: 1; box-shadow: 2px 3px 0 rgba(0,0,0,.2); }
.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }
.btn {
  font: inherit; font-weight: 800; padding: 10px 18px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 12px; box-shadow: 2px 3px 0 rgba(0,0,0,.18);
}
.btn:active { transform: translate(1px, 2px); box-shadow: none; }
.btn.primary { background: #7be382; }
.btn.ghost { background: #fff; }
.btn.danger { background: #ffb3ad; }
.modal-note { font-size: 13px; font-weight: 700; color: #6b675e; margin: 12px 0 0; }

.foot { text-align: center; font-weight: 700; color: #85806f; font-size: 13.5px; margin-top: 26px; }

@media (max-width: 640px) {
  .panel-lists { grid-template-columns: 1fr; }
  .cell { min-height: 74px; }
  body { padding-bottom: 40px; }
}

/* ---------- PIN gate ---------- */
.gate-card { text-align: center; }
.gate-sticker { font-size: 46px; margin-bottom: 4px; }
.gate-sub { font-weight: 700; color: #6b675e; margin: 0 0 14px; }
#g-pin {
  display: block; width: 60%; margin: 0 auto 10px; font: inherit; font-weight: 800;
  font-size: 26px; text-align: center; letter-spacing: 8px;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px; background: #FFFDF7;
}
.gate-err { color: var(--red); font-weight: 800; margin: 0 0 8px; }
.gate-btn { width: 60%; margin-top: 4px; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%; font-size: 24px;
  border: 2.5px solid var(--line); margin-right: 4px; background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,.12);
}
.avatar.noah { background: var(--mint); }
.avatar.sama { background: var(--blush); }

/* ---------- pack checklist ---------- */
.pack { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 4px; }
.pack-lbl { font-weight: 800; font-size: 13.5px; }
.pack-chip {
  font: inherit; font-weight: 800; font-size: 13px; padding: 4px 11px;
  border: 2px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer;
  box-shadow: 1.5px 2px 0 rgba(0,0,0,.15); transition: transform .08s;
}
.pack-chip:active { transform: scale(.94); }
.pack-chip.done { background: #7be382; text-decoration: line-through; opacity: .75; box-shadow: none; }

/* ---------- birthdays ---------- */
.bday-strip {
  grid-column: 1 / -1; padding: 10px 16px; font-size: 16px; font-weight: 700;
  background: #FFF3C6; text-align: center;
}
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 99; }

/* ---------- seasonal corner stickers ---------- */
#sprinkles { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sprinkle {
  position: absolute; font-size: clamp(26px, 4vw, 44px); opacity: .45;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.10));
}

/* ---------- the one authored motion: cards settle in like stickers ---------- */
@media (prefers-reduced-motion: no-preference) {
  .modal-backdrop:not([hidden]) .modal-card {
    animation: settle .22s cubic-bezier(.18, .9, .32, 1.1) both;
  }
  @keyframes settle {
    from { transform: scale(.94) translateY(10px) rotate(-.5deg); opacity: .4; }
    to   { transform: none; opacity: 1; }
  }
}

/* ---------- pointer feedback (desktop) + keyboard focus ---------- */
.evt, .pack-chip, .btn, .nav-btn, .who {
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
@media (hover: hover) {
  .cell { transition: background-color .15s ease; }
  .cell:hover { background: #FFFBEA; }
  .cell.weekend:hover { background: #F1EBD8; }
  .cell.other:hover { background: #F6F5EC; }
  .evt:hover, .pack-chip:hover, .who:hover {
    transform: translateY(-1px);
    box-shadow: 2px 3px 0 rgba(0, 0, 0, .22);
  }
  .btn:hover, .nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 3px 4px 0 rgba(0, 0, 0, .22);
  }
}
:focus-visible {
  outline: 3px solid #FFD44D;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .evt, .pack-chip, .btn, .nav-btn, .who, .cell { transition: none; }
}

/* ---------- skip link (keyboard users) ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 18px; font-weight: 800; color: var(--ink); text-decoration: none;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, .18);
}
.skip-link:focus { left: 12px; }

/* ---------- Miro's mobile calendar legibility pass ---------- */
@media (max-width: 480px) {
  .evt { font-size: 10.5px; padding: 1px 4px; }
  .cycle { font-size: 11.5px; }
}
