/* Browse, calendar, months & weeks, search (Revamp 6). Built on theme.css tokens;
   follows docs/design/revamp/mockups/browse-month.html, calendar.html and search.html. */

/* ---------- shared page head ---------- */
.l-head { padding: var(--s-4) 0 var(--s-4); }
.l-title { font-size: clamp(2.8rem, 1rem + 9vw, 7.5rem); line-height: .92; margin: var(--s-2) 0 var(--s-3); overflow-wrap: anywhere;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.l-head .lead { color: var(--ink-muted); font-size: var(--fs-md); max-width: 62ch; margin: 0 0 var(--s-4); }
.l-head .eyebrow a { color: inherit; }
.today-tag { display: inline-block; font: 700 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; background: var(--sun); color: var(--on-sun);
  padding: 4px 6px; border-radius: 4px; vertical-align: middle; }
.panel h2 .n, .agenda h2 .n { font: 700 var(--fs-sm)/1 var(--font-mono); color: var(--ink-muted); }

/* month pills */
.m-pills { display: flex; gap: 4px; flex-wrap: wrap; margin: var(--s-4) 0 var(--s-4); }
.m-pill { font: 700 var(--fs-sm)/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 12px 12px; min-height: 40px; display: inline-grid; place-items: center;
  border-radius: var(--r-md); color: var(--ink); text-decoration: none; border: 2px solid transparent; }
.m-pill abbr { text-decoration: none; }
.m-pill:hover { border-color: var(--line-strong); }
.m-pill[aria-current="true"] { background: var(--brand); color: var(--on-brand); box-shadow: 2px 2px 0 var(--ink); }

/* ---------- filter bar ---------- */
.l-filters { display: flex; gap: 0 var(--s-4); flex-wrap: wrap; justify-content: space-between; align-items: flex-start; }
.l-filters .filters { margin-bottom: var(--s-3); }
.filter.is-zero { color: var(--ink-muted); border-style: dashed; }
.filter .tglyph { width: 12px; height: 12px; flex: none; border-radius: 2px; }
.filter .tglyph.t-week { background: repeating-linear-gradient(90deg, var(--t-week) 0 2px, transparent 2px 4px); }
.filter .tglyph.t-month { background: linear-gradient(var(--t-month) 0 0) 0 0/5px 5px no-repeat, linear-gradient(var(--t-month) 0 0) 7px 0/5px 5px no-repeat,
  linear-gradient(var(--t-month) 0 0) 0 7px/5px 5px no-repeat, linear-gradient(var(--t-month) 0 0) 7px 7px/5px 5px no-repeat; }
.filter[aria-current="true"] .tglyph { filter: brightness(1.6); }
.l-more { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; margin: 0 0 var(--s-2); }
.l-select { display: grid; gap: 4px; font: 700 var(--fs-xs)/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.l-select select { font: 600 var(--fs-sm)/1.2 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--bg-raised); min-height: 42px; max-width: min(78vw, 280px);
  border: 2px solid var(--line-strong); border-radius: var(--r-pill); padding: 0 34px 0 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.l-select select:hover { border-color: var(--ink); }
.js .l-apply { display: none; }
.l-active { flex-basis: 100%; }
.l-chip { min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); background: var(--sun); color: var(--on-sun); border-color: var(--sun); }
.l-chip .l-what { font: 700 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; opacity: .75; }

/* ---------- kind-dot pill lists (browse days, month chips) ---------- */
.pill-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-content: start; }
.pill-list a { display: inline-flex; gap: 8px; align-items: center; padding: 7px 12px 7px 10px; min-height: 34px; border-radius: var(--r-pill); background: var(--bg-raised);
  border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; overflow-wrap: anywhere; }
.pill-list a:hover { background: var(--c-soft); border-color: var(--c-solid); }
.pill-list .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-solid); flex: none; }
.pill-list .is-week a { border-style: dashed; border-color: var(--t-week); }
.pill-list .wk-tag { font: 700 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--t-week-ink); }

/* ---------- browse ---------- */
.b-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-6); margin-top: var(--s-5); align-items: start; }
.b-grid.no-side { grid-template-columns: minmax(0, 1fr); }
.b-day { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-top: 1.5px dashed var(--line-strong); scroll-margin-top: 70px; }
.b-day.is-today { background: color-mix(in srgb, var(--sun) 22%, transparent); border-radius: var(--r-lg); padding: var(--s-4); border-top-color: transparent; margin: var(--s-2) calc(-1 * var(--s-4)); }
.b-dayhead-link { display: flex; gap: var(--s-3); align-items: center; align-self: start; position: sticky; top: 12px; color: var(--ink); text-decoration: none; border-radius: var(--r-md); }
.b-dayhead-link:hover .b-cards { text-decoration: underline; }
.b-dayname { display: grid; gap: 3px; }
.b-dayname strong { font-size: var(--fs-md); }
.b-count { font-size: var(--fs-xs); color: var(--ink-muted); }
.b-cards { font: 700 11px/1.2 var(--font-mono); color: var(--brand-ink); letter-spacing: .04em; }
.b-side { display: grid; gap: var(--s-5); position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 2px 2px var(--s-4); }
.panel { background: var(--bg-raised); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
.panel h2 { font-size: var(--fs-lg); margin: var(--s-2) 0 var(--s-4); }
.panel .link-more { display: inline-block; margin-top: var(--s-3); }
.all-month { background: var(--t-month-soft); border-color: transparent; }
.all-month .pill-list a { font-size: 13px; padding: 6px 10px 6px 8px; }
.weeks { background: var(--t-week-soft); border-color: transparent; }
.wk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wk-list li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: var(--fs-sm); }
.wk-day { font: 700 11px/1 var(--font-mono); color: var(--t-week-ink); }
.wk-list a { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.b-dayhead { display: flex; gap: var(--s-5); align-items: center; }
.b-dayhead .date-badge.lg { rotate: -6deg; }
.b-dayhead .l-title { margin-top: 0; }
.b-daynav { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-2) 0 var(--s-2); }

/* ---------- calendar ---------- */
.c-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); padding: var(--s-4) 0 var(--s-4); flex-wrap: wrap; }
.c-title { font-size: clamp(2.6rem, 1rem + 7vw, 6rem); margin-bottom: 0; }
.c-title .yr { color: var(--brand-ink); font-weight: 400; font-style: italic; }
.c-nav { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.c-toolbar { display: flex; gap: var(--s-3); justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: var(--s-5); }
.c-toolbar .filters { margin: 0; }
.month-link { text-decoration: none; min-height: 34px; }
.month-link:hover { background: var(--bg-raised); }
.cal { background: var(--bg-raised); border: 2px solid var(--ink); border-radius: var(--r-xl); overflow: hidden; box-shadow: 6px 6px 0 var(--ink); }
[data-theme="dark"] .cal { border-color: var(--line-strong); box-shadow: 6px 6px 0 #160C40; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal { border-color: var(--line-strong); box-shadow: 6px 6px 0 #160C40; } }
.c-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.c-wd { font: 700 var(--fs-xs)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; padding: 12px; background: var(--ink); color: var(--bg); }
.c-wd .short { display: none; }
.c-cell { min-height: 150px; padding: 10px; border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); position: relative; min-width: 0; }
.c-cell:nth-child(7n) { border-right: 0; }
.c-grid:last-child .c-cell { border-bottom: 0; }
.c-cell.out { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--bg-sunken) 8px 10px); color: var(--ink-muted); }
.c-cell.is-today { background: color-mix(in srgb, var(--sun) 26%, var(--bg-raised)); outline: 3px solid var(--sun); outline-offset: -3px; }
.c-cell.is-selected:not(.is-today) { box-shadow: inset 0 0 0 3px var(--brand); }
.c-num { display: flex; justify-content: space-between; align-items: center; gap: 4px; font: 800 1.35rem/1 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1;
  margin-bottom: 8px; color: var(--ink); text-decoration: none; min-height: 28px; border-radius: 6px; }
a.c-num:hover { color: var(--brand-ink); text-decoration: underline; }
.c-cell ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.c-cell li { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }
.c-cell li a { color: var(--ink); text-decoration: none; font-weight: 600; }
.c-cell li a:hover { text-decoration: underline; }
.c-cell li .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-solid); flex: none; translate: 0 -1px; }
.c-cell li.is-week a { border-bottom: 1.5px dashed var(--t-week); }
.c-more { display: inline-block; margin-top: 6px; font: 700 11px/1 var(--font-mono); color: var(--brand-ink); }
.c-dots, .c-count { display: none; }
.legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); margin-top: var(--s-4); }
.lg-week { display: inline-flex; gap: 6px; align-items: center; border-bottom: 1.5px dashed var(--t-week); }
.agenda { scroll-margin-top: 16px; }
.agenda:focus { outline: none; }
.agenda .section-head h2 .n { font-size: var(--fs-md); }
.agenda-hint { margin: 0; padding: var(--s-5); border: 2px dashed var(--line-strong); border-radius: var(--r-lg); text-align: center; color: var(--ink-muted); }
.agenda-more { margin-top: var(--s-4); }

/* ---------- search ---------- */
.s-head { padding: var(--s-4) 0 var(--s-4); }
.big-search { display: flex; align-items: center; gap: 12px; background: var(--bg-raised); border: 3px solid var(--ink); border-radius: var(--r-pill); padding: 8px 8px 8px 20px;
  box-shadow: 4px 4px 0 var(--brand); max-width: 760px; }
.big-search:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.big-search svg { width: 26px; height: 26px; flex: none; color: var(--ink-muted); }
.big-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 700 clamp(1.3rem, 1rem + 2vw, 2rem)/1.2 var(--font-display); color: var(--ink); }
.big-search input::placeholder { color: var(--ink-muted); opacity: .8; font-weight: 500; }
.s-count { margin: var(--s-5) 0 var(--s-3); font-size: var(--fs-md); font-weight: 650; }
.results { list-style: none; padding: 0; margin: var(--s-4) 0 0; display: grid; gap: var(--s-4); }
.result { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-5); padding: 12px; background: var(--bg-raised); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.result:hover, .result:focus-within { border-color: var(--c-solid); box-shadow: var(--shadow-2); }
.result .art { border-radius: var(--r-md); align-self: start; }
.result .meta { display: flex; gap: 10px; align-items: center; font: 700 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0; }
.result h3 { font-size: 1.45rem; margin: 10px 0 6px; overflow-wrap: anywhere; }
.result h3 a { color: var(--ink); text-decoration: none; }
.result h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }
.result h3 a:hover { text-decoration: underline; }
.result h3 a:focus-visible { outline: none; }
.result h3 a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.result .r-text { color: var(--ink-muted); font-size: var(--fs-sm); margin: 0 0 10px; }
.result .flags { display: inline-flex; gap: 4px; align-items: center; font-size: 18px; line-height: 1; }
.result .flags .more, .result .flag-name { font: 700 11px/1 var(--font-mono); color: var(--ink-muted); }
.s-today { margin-top: var(--s-6); }

/* ---------- months & weeks ---------- */
.m-section { margin: var(--s-6) 0; scroll-margin-top: 16px; }
.m-banner { position: relative; display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4);
  background: var(--t-month-soft); border: 2px solid var(--t-month); border-radius: var(--r-lg); box-shadow: 4px 4px 0 var(--t-month); }
/* ribbon tails: the banner spans the month, notched at both ends */
.m-banner::before, .m-banner::after { content: ""; position: absolute; top: 14px; bottom: -10px; width: 18px; background: var(--t-month); z-index: -1; }
.m-banner::before { left: -10px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 45% 50%); }
.m-banner::after { right: -10px; clip-path: polygon(0 0, 100% 0, 55% 50%, 100% 100%, 0 100%); }
.m-section { isolation: isolate; }
.m-banner-month { font: 800 1.6rem/1 var(--font-mono); letter-spacing: .06em; color: var(--t-month-on); background: var(--t-month); padding: 10px 12px; border-radius: var(--r-md); }
.m-banner-text { flex: 1; min-width: 0; }
.m-banner h2 { font-size: var(--fs-xl); margin: 0; overflow-wrap: anywhere; }
.m-banner h2 a { color: var(--ink); text-decoration: none; }
.m-banner h2 a:hover { text-decoration: underline; }
.m-banner-sub { margin: 4px 0 0; font: 700 var(--fs-xs)/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--t-month-ink); }
.m-section.is-current .m-banner { box-shadow: 4px 4px 0 var(--sun); }
.m-pills-list a { font-size: 13px; }
.m-cards { margin-bottom: var(--s-5); }
.m-weeks { margin-top: var(--s-5); padding: var(--s-4) var(--s-5); background: var(--t-week-soft); border-radius: var(--r-lg); }
.m-weeks-h { font-size: var(--fs-md); display: flex; gap: var(--s-2); align-items: center; margin: 0 0 var(--s-3); }
.ribbons { --label: minmax(0, 2fr); }
.ruler, .ribbon { display: grid; grid-template-columns: var(--label) minmax(0, 3fr); gap: var(--s-3); align-items: center; }
.ruler-track, .ribbon-track { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); }
.ruler { font: 700 10px/1 var(--font-mono); color: var(--t-week-ink); margin-bottom: 6px; }
.ruler-track span { border-left: 1.5px solid var(--t-week); padding-left: 3px; }
.ribbon-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ribbon { padding: 4px 0; border-top: 1px dashed color-mix(in srgb, var(--t-week) 45%, transparent); }
.ribbon-label { display: flex; gap: 8px; align-items: baseline; min-width: 0; font-size: var(--fs-sm); }
.ribbon-label a { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.ribbon-dates { flex: none; font: 700 11px/1 var(--font-mono); color: var(--t-week-ink); white-space: nowrap; }
.ribbon-track { height: 16px; border-radius: var(--r-pill); background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--t-week) 16%, transparent) 0 1px, transparent 1px calc(100% / var(--days))); }
.ribbon-bar { height: 100%; border-radius: var(--r-pill); background: var(--c-solid); border: 1.5px solid var(--edge); box-shadow: 2px 2px 0 var(--pop); }
.ribbon-bar.spills { border-top-right-radius: 2px; border-bottom-right-radius: 2px; background: linear-gradient(90deg, var(--c-solid) 80%, color-mix(in srgb, var(--c-solid) 30%, transparent)); }
.m-note { margin: var(--s-3) 0 0; font-size: var(--fs-sm); }
.m-links { margin-top: var(--s-4); }
.m-prevnext { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; margin: var(--s-7) 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .b-grid { grid-template-columns: minmax(0, 1fr); }
  .b-side { position: static; max-height: none; order: -1; overflow: visible; }
  .fade-list { max-height: 210px; overflow: auto; mask-image: linear-gradient(#000 80%, transparent); padding-bottom: 24px; }
}
@media (max-width: 760px) {
  .cal { border-radius: var(--r-lg); box-shadow: 4px 4px 0 var(--ink); }
  .c-wd { padding: 8px 0; text-align: center; } .c-wd .full { display: none; } .c-wd .short { display: inline; }
  .c-cell { min-height: 64px; padding: 6px 2px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .c-num { justify-content: center; font-size: 1.05rem; margin: 0; min-width: 40px; min-height: 36px; }
  /* phone: the whole cell is the tap target */
  a.c-num::after { content: ""; position: absolute; inset: 0; }
  .c-num .today-tag { display: none; }
  .c-cell ul, .c-more { display: none; }
  .c-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 34px; }
  .c-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-solid); }
  .c-nav .btn { padding: 10px 12px; }
  .ruler, .ribbon { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ruler-pad { display: none; }
}
@media (max-width: 700px) {
  .result { grid-template-columns: 96px minmax(0, 1fr); gap: var(--s-3); padding: 10px; }
  .result .art { aspect-ratio: 1; }
  .result .art-fallback .sticker { width: 60px; font-size: 24px; border-width: 2px; }
  .result .art-fallback .sticker small { display: none; }
  .result h3 { font-size: 1.15rem; margin-top: 6px; }
  .result .r-text { -webkit-line-clamp: 2; line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .result .meta .date-badge { display: none; }
  .big-search { padding-left: 14px; } .big-search .btn { padding: 12px 14px; }
}
@media (max-width: 640px) {
  .b-day { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .b-dayhead-link { position: static; }
  .m-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); padding: 0 var(--s-4); }
  .m-pill { flex: none; }
  .l-filters { display: block; }
  .b-dayhead { gap: var(--s-4); }
  .b-dayhead .date-badge.lg { width: 84px; } .b-dayhead .date-badge.lg .db-d { font-size: 42px; }
  .m-banner { padding: var(--s-3) var(--s-4); gap: var(--s-3); flex-wrap: wrap; }
  .m-banner-month { font-size: 1.15rem; }
  .m-banner .type-chip { display: none; }
  .m-weeks { padding: var(--s-3) var(--s-3); }
  .cards { gap: var(--s-4); }
}
/* phone list view: day cards become compact rows (same treatment as the home page) */
@media (max-width: 640px) {
  .list-cards { gap: var(--s-3); }
  .list-cards .card { flex-direction: row; align-items: stretch; gap: 4px; }
  .list-cards .card .art { width: 104px; flex: none; aspect-ratio: auto; min-height: 100%; }
  .list-cards .art .art-chip { display: none; }
  .list-cards .art-fallback .sticker { width: 64px; font-size: 26px; border-width: 2px; box-shadow: 2px 2px 0 var(--c-solid); }
  .list-cards .art-fallback .sticker small { display: none; }
  .list-cards .card .card-text { -webkit-line-clamp: 2; line-clamp: 2; }
  .list-cards .card h3 { font-size: 1.12rem; }
  .list-cards .card .meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { .result { transition: none; } }
