/* ---------- theme tokens ---------- */
:root {
  --page: #eef2f7;
  --surface: #ffffff;
  --raised: #f5f7fb;
  --ink: #18212d;
  --muted: #5b6676;
  --line: #dde3eb;
  --navy: #182b49;
  --heading: #182b49;
  --appbar: #182b49;
  --appbar-ink: #ffffff;
  --strip-a: #dfe8f3;
  --strip-b: #eef2f7;
  --blue: #00629b;
  --link: #00629b;
  --blue-soft: #e3eff8;
  --gold: #ffcd00;
  --gold-deep: #b58500;
  --gold-soft: #fff5cc;
  --gold-ink: #6e5200;
  --green: #1d7a3a;
  --green-soft: #e3f3e8;
  --amber: #8a5300;
  --amber-soft: #fcefdc;
  --red: #c4320a;
  --red-soft: #fdecea;
  --skeleton-a: #e6ebf2;
  --skeleton-b: #f3f6fa;
  --img-filter: none;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(24, 43, 73, .06);
  --shadow-md: 0 12px 28px -14px rgba(24, 43, 73, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #0d1420;
  --surface: #151e2c;
  --raised: #1c2738;
  --ink: #e6ecf3;
  --muted: #9aa8ba;
  --line: #263247;
  --heading: #f1f4f8;
  --appbar: #0a1220;
  --strip-a: #13203a;
  --strip-b: #0d1420;
  --link: #6cb8f0;
  --blue: #3a8fd0;
  --blue-soft: #14304a;
  --gold-deep: #ffcd00;
  --gold-soft: #3a3110;
  --gold-ink: #ffd84d;
  --green: #6fd08a;
  --green-soft: #12301d;
  --amber: #f3b867;
  --amber-soft: #33240d;
  --red: #ff7b66;
  --red-soft: #3d1a14;
  --skeleton-a: #1a2433;
  --skeleton-b: #222e40;
  --img-filter: brightness(.9);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 14px 30px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--page); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
body, .appbar, .sidebar, .side-card, .ecard, .agenda-wrap, .tstat, .chip, .cat-item, .btn, .drawer, .search {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
a { color: var(--link); }
img { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: var(--appbar); color: var(--appbar-ink); border-bottom: 3px solid var(--gold); }
.appbar-inner { position: relative; max-width: 1440px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex: none; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1); font-size: 18px; box-shadow: inset 0 -3px 0 var(--gold); }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; font-size: 1.1rem; cursor: pointer; transition: background .2s; }
.appbar .icon-btn { color: #fff; border-color: rgba(255,255,255,.2); }
.appbar .icon-btn:hover { background: rgba(255,255,255,.1); }
.filters-btn { display: none; }
.filters-btn .pill { position: absolute; top: -6px; right: -6px; }
.theme-btn span { position: absolute; transition: transform .4s var(--ease), opacity .3s; }
.theme-btn .moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
.theme-btn[data-mode="dark"] .sun { opacity: 0; transform: rotate(90deg) scale(.5); }
.theme-btn[data-mode="dark"] .moon { opacity: 1; transform: none; }
.pill { background: var(--gold); color: #182b49; border-radius: 999px; padding: 0 6px; font-size: .7rem; font-weight: 700; line-height: 1.5; }


/* ---------- layout ---------- */
.layout { max-width: 1440px; margin: 0 auto; padding: 22px 24px 40px; display: grid; grid-template-columns: 284px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { position: sticky; top: 86px; max-height: calc(100vh - 100px); overflow-y: auto; display: grid; gap: 14px; scrollbar-width: thin; padding-bottom: 4px; }
.side-head { display: none; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 16px; box-shadow: var(--shadow-sm); }
.side-card h2 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }
.side-card h2:first-child { margin-top: 0; }
.reset { justify-self: start; }
.scrim { display: none; }

/* mini calendar */
.mc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mc-title { font-family: var(--serif); font-weight: 700; color: var(--heading); font-size: 1.02rem; }
.mc-nav { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--heading); cursor: pointer; font-size: 1rem; }
.mc-nav:hover { background: var(--raised); }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mc-dow { font-size: .68rem; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.mc-day {
  position: relative; aspect-ratio: 1; border: none; background: none; border-radius: 9px; font: inherit; font-size: .82rem; color: var(--ink);
  cursor: pointer; display: grid; place-items: center; padding: 0 0 6px; font-variant-numeric: tabular-nums; transition: background .15s, transform .15s var(--ease);
}
.mc-day:hover:not(:disabled) { background: var(--raised); transform: scale(1.06); }
.mc-day:disabled { color: var(--muted); opacity: .45; cursor: default; }
.mc-day.past { opacity: .35; }
.mc-day.today { box-shadow: inset 0 0 0 2px var(--gold); font-weight: 700; }
.mc-day.sel { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .mc-day.sel { background: #2b4c7e; }
.mc-day .dot { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); border-radius: 50%; background: var(--blue); }
.mc-day .dot.l0 { display: none; }
.mc-day .dot.l1 { width: 4px; height: 4px; opacity: .55; }
.mc-day .dot.l2 { width: 5px; height: 5px; opacity: .8; }
.mc-day .dot.l3 { width: 6px; height: 6px; background: var(--gold-deep); }
.mc-day.sel .dot { background: var(--gold); opacity: 1; }

/* category list */
.cat-list { display: grid; gap: 2px; }
.cat-item {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 6px; padding: 8px 10px 8px 8px; border: none; border-radius: 9px;
  background: none; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; position: relative;
  transition: background .15s, padding-left .2s var(--ease);
}
.cat-item:hover:not(:disabled) { background: var(--raised); padding-left: 11px; }
.cat-item:disabled { opacity: .4; cursor: default; }
.cat-item .ci { font-size: 1.05rem; }
.cat-item .cn { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--raised); border-radius: 999px; padding: 0 8px; }
.cat-item[aria-pressed="true"] { background: var(--blue-soft); color: var(--heading); font-weight: 600; }
.cat-item[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--gold); }
.cat-item[aria-pressed="true"] .cn { background: var(--surface); }

/* chips & buttons */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 11px;
  font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--blue); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .n { opacity: .6; margin-left: 5px; font-size: .74rem; font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s, transform .15s var(--ease), box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn.small { padding: 6px 12px; font-size: .84rem; border-radius: 8px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #22395f; }
:root[data-theme="dark"] .btn-primary { background: #2b4c7e; }
.btn-gold { background: var(--gold); color: #182b49; }
.btn-gold:hover { background: #ffd633; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--heading); }
.btn-outline:hover { border-color: var(--heading); }
.link { background: none; border: none; padding: 0; font: inherit; color: var(--link); font-weight: 600; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- main column ---------- */
.content { min-width: 0; }
.greet { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.greet h1 { font-family: var(--serif); color: var(--heading); font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0; letter-spacing: -.015em; }
.greet p { margin: 0; color: var(--muted); }
.section { margin-top: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 14px; box-shadow: var(--shadow-sm); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2, .sk-title { font-family: var(--serif); color: var(--heading); font-size: 1.35rem; margin: 0; letter-spacing: -.01em; position: relative; padding-bottom: 6px; }
.section-head h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 3px; border-radius: 2px; background: var(--gold); }
.rail-nav { display: flex; gap: 6px; }
.arrow { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--heading); font-size: 1.15rem; cursor: pointer; transition: border-color .2s, background .2s; }
.arrow:hover { border-color: var(--heading); background: var(--raised); }

.rail-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px 2px 8px; }
.rail-track::-webkit-scrollbar { display: none; }
.rail-track > * { scroll-snap-align: start; }
@media (min-width: 1100px) { .rail-track { grid-auto-columns: calc((100% - 48px) / 4); } }
@media (min-width: 1380px) { .rail-track { grid-auto-columns: calc((100% - 64px) / 5); } }

/* ---------- photo card ---------- */
.ecard {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 0;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.ecard:hover, .ecard:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-md); outline: none; }
.ecard:focus-visible { box-shadow: 0 0 0 3px var(--blue-soft), var(--shadow-md); }
.media { position: relative; aspect-ratio: 16 / 9; background: var(--raised); overflow: hidden; }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .4s; opacity: 0; filter: var(--img-filter); }
.media img.loaded { opacity: 1; }
.ecard:hover .media img { transform: scale(1.04); }
.media .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; background: linear-gradient(135deg, #182b49, #2a4a7a); }
.datebadge { position: absolute; top: 10px; left: 10px; background: #fff; border-radius: 8px; text-align: center; min-width: 46px; padding: 4px 6px 5px; box-shadow: 0 2px 8px rgba(0,0,0,.18); line-height: 1.05; }
.datebadge .m { display: block; font-size: .64rem; font-weight: 700; color: #b58500; letter-spacing: .08em; }
.datebadge .d { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: #182b49; }
.ebody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.etime { font-size: .8rem; font-weight: 600; color: var(--link); font-variant-numeric: tabular-nums; }
.etime.live { color: var(--red); }
.etime.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(196, 50, 10, .45); } 70% { box-shadow: 0 0 0 7px rgba(196, 50, 10, 0); } 100% { box-shadow: 0 0 0 0 rgba(196, 50, 10, 0); } }
.etitle { font-weight: 650; font-size: .98rem; line-height: 1.3; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eloc { font-size: .83rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ebody .tags { margin-top: auto; padding-top: 6px; }

/* tags & badges */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags:empty { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--raised); color: var(--muted); border-radius: 6px; padding: 2px 8px; font-size: .76rem; font-weight: 500; white-space: nowrap; }
.tag.food { background: var(--green-soft); color: var(--green); font-weight: 600; }
.tag.snack { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.tag.signup { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.tag.dropin { background: var(--blue-soft); color: var(--link); font-weight: 600; }
.tag.cat { background: var(--surface); border: 1px solid var(--line); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badges:empty { display: none; }
.badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-radius: 6px; padding: 2px 7px; }
.badge.new { background: var(--blue-soft); color: var(--link); }
.badge.updated { background: var(--gold-soft); color: var(--gold-ink); }
.badge.cancelled { background: var(--red-soft); color: var(--red); }
.is-cancelled .etitle, .is-cancelled .a-title { text-decoration: line-through; color: var(--muted); }

/* ---------- agenda ---------- */
.agenda { display: grid; gap: 18px; }
.aday { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.aday:first-child { border-top: none; padding-top: 0; }
.dblock { position: sticky; top: 86px; align-self: start; text-align: center; border-radius: 10px; padding: 8px 0 9px; background: var(--raised); box-shadow: inset 0 3px 0 var(--gold); }
.dblock .w { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--gold-deep); text-transform: uppercase; }
.dblock .n { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--heading); line-height: 1.1; }
.dblock .rel { display: block; font-size: .7rem; color: var(--muted); }
.arows { display: grid; gap: 2px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.arow {
  display: grid; grid-template-columns: 76px 56px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 7px 10px; border-radius: 10px;
  cursor: pointer; background: none; border: none; font: inherit; color: inherit; text-align: left; width: 100%; transition: background .2s;
}
.arow:hover, .arow:focus-visible { background: var(--raised); outline: none; }
.a-time { font-size: .84rem; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }
.a-time.live { color: var(--red); }
.a-thumb { width: 56px; height: 42px; border-radius: 7px; overflow: hidden; background: var(--raised); }
.a-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; filter: var(--img-filter); }
.a-thumb img.loaded { opacity: 1; }
.a-main { min-width: 0; display: block; overflow: hidden; }
.a-title, .a-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-title { font-weight: 600; font-size: .94rem; line-height: 1.3; }
.a-sub { font-size: .8rem; color: var(--muted); }
.a-icons { display: flex; gap: 4px; }
.a-more { justify-self: start; margin: 4px 0 0 10px; font-size: .86rem; }
.a-extra { display: grid; gap: 2px; overflow: hidden; transition: max-height .35s var(--ease); }

/* ---------- results ---------- */
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 0 14px; }
.results-head p { margin: 0; color: var(--muted); }
.results-head strong { color: var(--heading); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.more { display: flex; margin: 24px auto 0; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.empty-title { font-family: var(--serif); font-size: 1.3rem; color: var(--heading); margin-bottom: 4px; }

/* ---------- skeleton & reveal ---------- */
#skeleton { margin-top: 26px; }
.sk-title { width: 220px; height: 26px; border-radius: 6px; margin-bottom: 14px; }
.sk-card { height: 250px; border-radius: var(--radius); }
.sk-title, .sk-card { background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: var(--d, 0ms); }

/* ---------- drawer & modal ---------- */
dialog { padding: 0; border: none; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(8, 14, 24, .5); animation: fade .25s ease; }
.drawer { margin: 0 0 0 auto; height: 100%; max-height: 100%; max-width: 100%; width: min(540px, 100%); box-shadow: -12px 0 40px rgba(0,0,0,.2); }
.drawer[open] { animation: slidein .35s var(--ease); }
.drawer-inner { position: relative; height: 100%; overflow-y: auto; }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: #18212d; box-shadow: var(--shadow-sm); font-size: 1rem; cursor: pointer; transition: transform .2s; }
.close:hover { transform: rotate(90deg); }
.d-media { aspect-ratio: 16 / 9; background: var(--raised); overflow: hidden; }
.d-media img { width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); }
.d-body { padding: 18px 22px 28px; }
.d-body h2 { font-family: var(--serif); color: var(--heading); font-size: 1.55rem; line-height: 1.2; margin: 6px 0 12px; }
.d-meta { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: .93rem; }
.d-meta li { display: grid; grid-template-columns: 22px 1fr; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.d-desc { white-space: pre-line; color: var(--ink); opacity: .9; font-size: .94rem; margin: 0 0 16px; }
.save-btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-ink); background: var(--gold-soft); }
.save-btn.pop { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.12); } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.modal { border-radius: 16px; width: min(560px, calc(100% - 32px)); box-shadow: var(--shadow-md); }
.modal[open] { animation: drop .25s var(--ease); }
.dlg { padding: 24px; }
.dlg h2 { font-family: var(--serif); color: var(--heading); margin: 0 0 6px; }
.dlg p, .dlg li { color: var(--muted); font-size: .92rem; }
.feed-list { display: grid; gap: 6px; max-height: 44vh; overflow: auto; margin: 14px 0; }
.feed { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.feed .name { flex: 1; font-weight: 600; font-size: .9rem; color: var(--heading); }
.dlg-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

.site-footer { margin-top: 32px; padding: 18px 2px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.site-footer p { margin: 4px 0; max-width: 80ch; }

/* ---------- tablet & phone: sidebar becomes a slide-in panel ---------- */
@media (max-width: 1099px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 32px; }
  .filters-btn { display: inline-grid; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); max-height: none; padding: 14px;
    background: var(--page); transform: translateX(-105%); visibility: hidden;
    transition: transform .3s var(--ease), visibility 0s linear .3s;
  }
  body.sidebar-open .sidebar { box-shadow: 12px 0 40px rgba(0,0,0,.25); visibility: visible; transition: transform .3s var(--ease); }
  .side-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--heading); }
  .side-head .icon-btn { color: var(--heading); }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(8, 14, 24, .45); opacity: 0; pointer-events: none; transition: opacity .3s; display: block; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .dblock { top: 80px; }
}
@media (max-width: 700px) {
  .appbar-inner { padding: 0 12px; gap: 10px; height: 58px; }
  .wordmark, .hide-sm { display: none; }
  .section { padding: 14px 12px 10px; border-radius: 14px; }
  .rail-nav { display: none; }
  .rail-track { grid-auto-columns: 78%; }
  .aday { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .dblock { position: static; display: flex; align-items: baseline; gap: 8px; text-align: left; padding: 0; background: none; box-shadow: none; }
  .dblock .n { font-size: 1.2rem; }
  .arow { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; padding: 8px 4px; }
  .a-thumb { display: none; }
  .drawer { margin: auto 0 0; width: 100%; height: auto; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .drawer[open] { animation: slideup .35s var(--ease); }
  .drawer-inner { max-height: 92vh; }
  @keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .media img, .a-thumb img { opacity: 1; }
}

/* ---------- day view: hour grid ---------- */
:root {
  --c-stem: #2f6fd6; --c-biz: #b07a00; --c-bio: #1f9a6b; --c-arts: #b0428f;
  --c-career: #6a4fd1; --c-social: #d0612b; --c-well: #3c9a3c; --c-none: #8a96a8;
  --food-tint: rgba(29, 122, 58, .07);
}
:root[data-theme="dark"] {
  --c-stem: #6aa3ff; --c-biz: #e6b84a; --c-bio: #4fd1a0; --c-arts: #e27cc4;
  --c-career: #a18bff; --c-social: #ff9a66; --c-well: #7ed37e; --c-none: #7a879b;
  --food-tint: rgba(111, 208, 138, .08);
}
.dayview { position: relative; margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px 18px; box-shadow: var(--shadow-sm); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.day-nav { display: flex; align-items: center; gap: 10px; }
.day-nav h2 { font-family: var(--serif); color: var(--heading); font-size: 1.35rem; margin: 0; min-width: 0; }
.day-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; }

.day-strip-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; min-width: 0; }
.strip-label { flex: none; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.day-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; min-width: 0; }
.strip-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 280px; border: 1px solid var(--line); border-left: 3px solid var(--cat, var(--c-none));
  background: var(--raised); color: var(--ink); border-radius: 8px; padding: 4px 10px 4px 8px; font: inherit; font-size: .8rem; cursor: pointer;
  transition: border-color .2s, transform .15s var(--ease);
}
.strip-chip:hover { transform: translateY(-1px); border-color: var(--cat, var(--c-none)); }
.sc-time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.sc-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

.day-grid-wrap { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr); max-height: 72vh; overflow-y: auto; padding: 10px 2px 6px 0; scrollbar-width: thin; }
.day-gutter { position: relative; }
.day-gutter span { position: absolute; right: 10px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-grid {
  position: relative; border-left: 1px solid var(--line);
  background-image:
    linear-gradient(to bottom, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, transparent 31px, color-mix(in srgb, var(--line) 55%, transparent) 32px, transparent 33px);
  background-size: 100% 64px, 100% 64px;
}

.dblk {
  position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); font: inherit; padding: 4px 8px 4px 9px; border-radius: 7px;
  border: 1px solid var(--line); border-left: 4px solid var(--cat, var(--c-none)); box-shadow: var(--shadow-sm);
  animation: blockin .4s var(--ease) both; animation-delay: var(--d, 0ms);
  transition: box-shadow .2s, transform .2s var(--ease), min-height .2s;
}
.dblk::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--cat, var(--c-none)) 9%, transparent); pointer-events: none; }
.dblk.has-food::before { background: linear-gradient(var(--food-tint), var(--food-tint)), color-mix(in srgb, var(--cat, var(--c-none)) 9%, transparent); }
.dblk:hover, .dblk:focus-visible { z-index: 5; transform: translateY(-1px); box-shadow: var(--shadow-md); min-height: 64px; height: auto !important; overflow: visible; outline: none; }
.dblk.live { box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 55%, transparent), var(--shadow-sm); }
.b-title { position: relative; font-weight: 600; font-size: .82rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-right: 16px; }
.dblk.tiny { padding-top: 2px; padding-bottom: 2px; }
.dblk.tiny .b-title { -webkit-line-clamp: 1; font-size: .76rem; }
.dblk:hover .b-title { -webkit-line-clamp: 4; }
.b-time, .b-loc { position: relative; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.b-food { position: absolute; top: 3px; right: 5px; font-size: .8rem; }
.dblk.is-cancelled { opacity: .55; }
.dblk.is-cancelled .b-title { text-decoration: line-through; }
@keyframes blockin { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.c-stem { --cat: var(--c-stem); } .c-biz { --cat: var(--c-biz); } .c-bio { --cat: var(--c-bio); } .c-arts { --cat: var(--c-arts); }
.c-career { --cat: var(--c-career); } .c-social { --cat: var(--c-social); } .c-well { --cat: var(--c-well); }

.more-pill {
  position: absolute; right: 4px; z-index: 4; transform: translateY(2px); border: 1px solid var(--line); background: var(--navy); color: #fff;
  border-radius: 999px; padding: 2px 10px; font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm);
}
.more-pill:hover { background: var(--blue); }
.more-pop {
  position: absolute; z-index: 20; width: min(320px, calc(100% - 16px)); max-height: 320px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); padding: 8px; animation: drop .2s var(--ease);
}
.mp-head { margin: 2px 6px 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.mp-item { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; border: none; background: none; color: var(--ink); font: inherit; font-size: .85rem; text-align: left; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.mp-item:hover { background: var(--raised); }
.mp-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.mp-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

.now-line { position: absolute; left: -6px; right: 0; height: 0; border-top: 2px solid var(--red); z-index: 6; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -1px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.now-line span { position: absolute; right: 4px; top: -20px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; }

@media (max-width: 700px) {
  .dayview { padding: 12px 10px 14px; }
  .day-nav h2 { font-size: 1.1rem; }
  .day-grid-wrap { grid-template-columns: 46px minmax(0, 1fr); max-height: 70vh; }
  .day-gutter span { right: 6px; font-size: .66rem; }
  .strip-label { display: none; }
  .dblk { padding: 3px 6px 3px 7px; }
}
.dblk.past, .strip-chip.past { opacity: .5; }
.dblk.past:hover { opacity: 1; }


/* ---------- top bar: stat pills + icon search ---------- */
.top-stats { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; transition: opacity .2s; }
.top-stats::-webkit-scrollbar { display: none; }
.tstat {
  flex: none; display: inline-flex; align-items: baseline; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: rgba(255,255,255,.82); font: inherit; font-size: .84rem;
  line-height: 34px; transition: background .2s, border-color .2s, color .2s, transform .15s var(--ease);
}
.tstat:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); transform: translateY(-1px); }
.tstat strong { font-family: var(--serif); font-size: 1.05rem; color: #fff; font-variant-numeric: tabular-nums; }
.tstat .ti { align-self: center; line-height: 1; }
.tstat[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #182b49; }
.tstat[aria-pressed="true"] strong { color: #182b49; }

.search { position: relative; display: flex; align-items: center; height: 40px; border-radius: 12px; border: 1px solid transparent; transition: background .25s, border-color .25s, box-shadow .25s; }
.search input {
  width: 0; padding: 0; border: none; outline: none; background: transparent; color: #18212d; font: inherit; font-size: .95rem;
  opacity: 0; transition: width .3s var(--ease), padding .3s var(--ease), opacity .2s;
}
.search input::placeholder { color: #8a94a3; }
.search-btn { color: var(--gold) !important; border: 1.5px solid var(--gold) !important; background: rgba(255, 205, 0, .1) !important; }
.search-btn:hover { background: rgba(255, 205, 0, .22) !important; }
.search-close { display: none !important; }
.appbar.search-open .search { background: #fff; border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 205, 0, .45); }
.appbar.search-open .search input { width: min(340px, 34vw); padding: 0 6px 0 14px; opacity: 1; }
.appbar.search-open .search-btn { color: #182b49 !important; border-color: transparent !important; background: transparent !important; }
.appbar.search-open .top-stats { opacity: .35; }

@media (max-width: 900px) {
  .tstat .tl { display: none; }
  .tstat { padding: 0 10px; }
}
@media (max-width: 700px) {
  .top-stats { flex: 1; }
  .appbar.search-open .search { position: absolute; left: 8px; right: 8px; z-index: 5; }
  .appbar.search-open .search input { width: 100%; flex: 1; }
  .appbar.search-open .search-close { display: inline-grid !important; color: #182b49 !important; border: none !important; }
  .appbar.search-open .top-stats { opacity: 0; }
}
