/* Byavisa: one shared visual system for the calendar, activities and forms. */
:root {
  --ink: #192c35;
  --muted: #66665f;
  --paper: #faf6ee;
  --surface: #fffcf6;
  --soft: #efe6d8;
  --teal: #9c3e2b;
  --dark: #79301f;
  --gold: #bd7346;
  --border: #d5cbbd;
  --shadow: 0 8px 24px #192c3514;
  --r-lg: 4px;
  --r-md: 4px;
  --r-sm: 3px;
  --max: 1040px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Arial, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-block: 1rem 8rem; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.6 var(--sans); overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button, summary { cursor: pointer; }
a { color: var(--dark); text-underline-offset: .2em; }
button:disabled { cursor: wait; opacity: .6; }
h1, h2, h3, h4, p { margin: 0 0 .75rem; }
h1, h2, h3, h4 { text-wrap: pretty; }
h2 { font: 700 clamp(1.8rem, 3vw, 2.5rem)/1.2 var(--serif); letter-spacing: -.035em; }
button, .button, select, input, summary { min-height: 44px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--dark); outline-offset: 4px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; inset-block-start: .75rem; inset-inline-start: .75rem; z-index: 100; padding: .65rem 1rem; background: var(--ink); color: #fff; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.hero, main, .site-footer { width: min(var(--max), calc(100% - 3rem)); margin-inline: auto; }

/* Masthead and the stable, native language links. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-block: .6rem; border-bottom: 1px solid var(--border); direction: ltr; }
.edition-line { margin: 0; font-size: .8125rem; letter-spacing: .025em; color: var(--muted); }
.language-switcher { display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem; direction: ltr; font-family: var(--sans); }
.language-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .4rem .6rem; font-size: .875rem; font-weight: 600; color: var(--muted); text-decoration: none; unicode-bidi: isolate; }
.language-button.is-active { color: var(--dark); box-shadow: inset 0 -2px var(--teal); font-weight: 600; }
.hero-copy { text-align: center; padding-block: 1.5rem 1.35rem; border-bottom: 5px double var(--ink); }
.masthead { font: 700 clamp(2rem, 7.6vw, 5rem)/1.05 var(--serif); letter-spacing: -.065em; margin: 0; }
.masthead a { color: var(--ink); text-decoration: none; }
.masthead em { color: var(--teal); font-weight: 400; }
.masthead-tagline { color: var(--muted); font-size: .9375rem; margin: .7rem 0 0; }
.hero-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; max-width: 720px; margin: 1.25rem auto 0; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); padding: .65rem .8rem; font-size: 1rem; }
input::placeholder, textarea::placeholder { color: #6e6e67; opacity: 1; }
select { max-width: 100%; text-overflow: ellipsis; }
textarea { resize: vertical; }
.hero-search input { min-height: 50px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem 1.25rem; margin: .4rem auto 1rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .65rem 1rem; border: 1px solid var(--ink); border-radius: var(--r-sm); background: var(--ink); color: var(--surface); font-weight: 700; line-height: 1.35; text-decoration: none; }
.hero-search .button { background: var(--teal); border-color: var(--teal); padding-inline: 1.6rem; }
.button-chip { padding: .45rem .15rem; background: transparent; color: var(--ink); border: 0; border-radius: 0; font-size: .9375rem; font-weight: 500; }
.button-chip[aria-pressed="true"] { box-shadow: inset 0 -2px var(--teal); color: var(--dark); font-weight: 700; }

/* Section navigation becomes a persistent, labelled bar on smaller screens. */
.view-switch { container: navigation / inline-size; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--border); }
.view-tab { display: flex; align-items: center; justify-content: center; gap: .6rem; border: 0; border-radius: 0; min-width: 0; padding: .8rem .5rem; color: var(--muted); background: transparent; font-weight: 700; }
.view-tab.is-active, .view-tab[aria-pressed="true"] { color: var(--dark); background: var(--soft); box-shadow: inset 0 -3px var(--teal); }
#favoriteCount { font: 700 .75rem/1.5 var(--sans); background: var(--soft); min-width: 1.5em; border-radius: 1rem; padding-inline: .25em; }
.guide-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-block: .4rem; }
.guide-meta > a { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.updated-line { color: var(--muted); font-size: .8125rem; }
.text-button { display: inline-flex; align-items: center; justify-self: start; border: 0; background: transparent; color: var(--dark); font-weight: 700; padding: .45rem 0; min-height: 44px; text-decoration: underline; text-underline-offset: .2em; text-align: start; }
.guide-meta .text-button { font-size: .875rem; flex-shrink: 0; }

/* Filters stay available without pushing the first events far down the page. */
.filters-card { margin-block: .5rem 1.25rem; }
.filter-panel { border-block: 1px solid var(--border); }
.filter-panel > summary { padding: .7rem .15rem; font-size: .9375rem; font-weight: 700; }
.filter-panel > summary::marker { color: var(--teal); }
.filter-hint { font-weight: 400; color: var(--muted); margin-inline-start: .65rem; }
.filter-panel-body { padding-block: .35rem 1rem; }
.filters { display: grid; gap: .85rem; align-items: end; }
.filters-primary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.filters-extra { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: .5rem; }
.filters label, .feedback-card label { display: grid; gap: .4rem; min-width: 0; font-weight: 700; font-size: .875rem; }
.reset-button { min-height: 48px; }
.advanced-filters { margin-block-start: .5rem; }
.advanced-filters summary { padding-block: .6rem; color: var(--dark); font-weight: 700; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter-chips:not(:empty) { margin-block: .8rem; }
.filter-chip { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; background: var(--soft); border: 1px solid var(--border); color: var(--dark); padding: .45rem .65rem; border-radius: var(--r-sm); text-align: start; font-size: .875rem; }

/* Editorial event rows, with real dates and the existing complete detail panels. */
.results-layout, .recurring-section, #holidays-section, #favorites-section { margin-block: 1.5rem 2.5rem; scroll-margin-top: 1rem; }
.recurring-section { container: recurring / inline-size; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: .5rem 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .8rem; margin-bottom: .25rem; }
.recurring-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
.recurring-heading > div > p:last-child { margin-bottom: 0; }
.recurring-quick-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 32rem; width: 100%; gap: .75rem; padding-block: .25rem; }
.recurring-quick-filters label { color: var(--muted); font-weight: 400; gap: .2rem; }
.section-heading h2 { margin-bottom: .3rem; }
.section-heading p { max-width: 68ch; color: var(--muted); }
.eyebrow { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--teal); margin-bottom: .4rem; }
.result-count { font-size: .875rem; color: var(--muted); margin: 0; flex-shrink: 0; }
.events, .recurring-grid { container-type: inline-size; }
.day-group { margin-block: 0 1rem; }
.day-heading { font: 700 .875rem/1.4 var(--sans); padding-block: 1rem .6rem; margin: 0; color: var(--muted); border-bottom: 1px solid var(--border); }
.activity-card { display: grid; grid-template-columns: minmax(0, 1fr) 2.75rem; column-gap: 1rem; padding-block: 1.3rem; border-bottom: 1px solid var(--border); position: relative; }
.event-card { grid-template-columns: 4rem minmax(0, 1fr) 2.75rem; }
.event-date { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; padding-top: .3rem; color: var(--teal); line-height: 1.1; text-align: center; }
.event-date strong { font: 400 2.5rem/1 var(--serif); letter-spacing: -.05em; }
.event-date span { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-top: .4rem; }
.event-date.event-date-range strong { font-size: .95rem; line-height: 1.3; letter-spacing: -.03em; white-space: nowrap; }

.card-main { grid-area: 1 / 1; display: grid; gap: .4rem; min-width: 0; }
.event-card .card-main { grid-column: 2; }
.activity-label-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.activity-label { color: var(--dark); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.activity-card h3 { font: 700 clamp(1.4rem, 2.5vw, 1.9rem)/1.2 var(--serif); letter-spacing: -.025em; margin: 0; }
.title-button { display: block; min-height: 44px; font: inherit; letter-spacing: inherit; color: var(--ink); background: transparent; border: 0; padding: 0; text-align: start; }
.card-kicker { color: var(--ink); font-weight: 700; font-size: .9375rem; }
.card-summary { color: var(--muted); margin: 0; font-size: 1rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: .15rem .75rem; color: var(--muted); font-size: .9375rem; }
.card-meta span { display: inline; }
.card-meta span:not(:last-child)::after { content: "·"; margin-inline-start: .75rem; color: var(--border); }
.card-meta span:first-child { color: var(--ink); }
.card-primary-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card-primary-actions .text-button { font-size: .875rem; }
.favorite-button { grid-column: -2 / -1; grid-row: 1; align-self: start; padding: .6rem; width: 44px; height: 44px; background: transparent; color: var(--muted); border: 1px solid transparent; }
.favorite-button[aria-pressed="true"] { background: var(--soft); color: var(--dark); border-color: var(--border); }
.favorite-button[aria-pressed="true"] svg { fill: currentColor; }
.card-detail { grid-column: 1 / -1; border: 1px solid var(--border); background: var(--surface); padding: 1.3rem; margin-top: 1rem; }
.fact-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.fact-list > div { min-width: 0; }
.fact-list dt { color: var(--muted); font-size: .875rem; }
.fact-list dd { margin: .15rem 0 0; font-weight: 700; }
.muted { color: var(--muted); font-weight: 400; }
.description { margin-bottom: 1rem; }
.source-line { font-size: .875rem; color: var(--muted); margin-block: 1rem .75rem; }
.tag-row, .card-actions, .source-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tag { padding: .2rem .5rem; font-size: .875rem; color: var(--dark); background: var(--soft); }
.small-button, .ghost-action { padding: .6rem .75rem; font-size: .875rem; color: var(--ink); background: transparent; border: 1px solid var(--border); }
.primary-action { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.source-links { margin-block: .5rem 1rem; }
.source-links a { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .4rem; min-height: 44px; padding: .4rem .65rem; border: 1px solid var(--border); font-size: .875rem; }
.source-type { color: var(--muted); font-size: .8125rem; }
.source-verification { font-size: .875rem; padding-inline-start: .8rem; border-inline-start: 3px solid var(--border); color: var(--muted); }
.verification-detail { display: block; margin-top: .25rem; }
.record-status { padding: .65rem .8rem; border-inline-start: 3px solid var(--teal); background: var(--soft); color: var(--dark); font-size: 1rem; }
.calendar-controls { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem; border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }
.calendar-choice { display: grid; gap: .3rem; font-weight: 700; flex: 1 1 11rem; max-width: 20rem; }
.calendar-button:disabled { cursor: default; }
.calendar-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .875rem; }
.show-more { display: flex; min-width: min(14rem, 100%); max-width: 100%; margin: 1.5rem auto; }
.empty-state { border-block: 1px solid var(--border); padding: 2rem 1rem; text-align: center; }
.empty-state h3 { font: 700 1.5rem/1.3 var(--serif); }
.empty-action { margin-top: .5rem; }
.holiday-teaser { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1.5rem; margin-block: 1.5rem; background: var(--soft); }
.holiday-teaser h3 { font: 700 1.65rem/1.2 var(--serif); margin-bottom: .5rem; letter-spacing: -.025em; }
.holiday-teaser p:last-child { margin: 0; color: var(--muted); font-size: .9375rem; }
.holiday-teaser .button { background: transparent; color: var(--dark); border-color: var(--border); }
.direction-arrow { display: inline-block; font-size: 1.4em; }

/* About, feedback and status share the same paper, rules and typography. */
.quality-section, .feedback-section { margin-block: 3rem; padding-top: 1.5rem; border-top: 2px solid var(--ink); scroll-margin-top: 1rem; }
.about-guide p { max-width: 72ch; }
.quality-card { padding-block: .5rem; }
.feedback-card { position: relative; display: grid; gap: 1rem; max-width: 48rem; background: var(--surface); border: 1px solid var(--border); padding: 1.5rem; }
.feedback-card .button { justify-self: start; }
.feedback-card .submission-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.feedback-card input[dir="ltr"] { direction: ltr; text-align: left; }
.form-status { margin: 0; color: var(--dark); font-size: 1rem; font-weight: 700; }
.form-status[data-state="error"] { color: #982923; }
.load-status { border: 1px solid var(--border); padding: 1rem; margin-block: 1rem; background: var(--surface); }
.share-status { position: fixed; inset-inline: 1rem; bottom: 1rem; width: fit-content; max-width: calc(100% - 2rem); margin-inline: auto; z-index: 30; background: var(--ink); color: #fff; padding: .85rem 1.2rem; box-shadow: var(--shadow); }
.site-footer { border-top: 5px double var(--ink); padding-block: 1.5rem 2rem; color: var(--muted); font-size: .875rem; }
.site-footer p { max-width: 72ch; }

/* Bidi isolation and touch behaviour are preserved across all four languages. */
.ltr-token, bdi.ltr-token { direction: ltr; unicode-bidi: isolate; display: inline-block; }
html[lang="ar"] body { text-align: right; }
html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4 { letter-spacing: normal; line-height: 1.45; }
html[lang="ar"] .eyebrow, html[lang="ar"] .activity-label { letter-spacing: normal; }
html[lang="ar"] .card-kicker, html[lang="ar"] .card-meta, html[lang="ar"] .fact-list dd, html[lang="ar"] .description, html[lang="ar"] .source-line { unicode-bidi: plaintext; }
html[dir="rtl"] .direction-arrow { transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
  .language-button:hover, .button-chip:hover, .text-button:hover { color: var(--dark); text-decoration: underline; text-underline-offset: .2em; }
  .title-button:hover { color: var(--teal); }
  .button:not(.button-chip):hover, .view-tab:hover { box-shadow: inset 0 0 0 1px var(--teal); }
  .source-links a:hover { background: var(--soft); }
}
@media (min-width: 900px) {
  #recurringList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
}
@media (max-width: 760px) {
  body { padding-bottom: 8rem; }
  .hero, main, .site-footer { width: calc(100% - 2rem); }
  .topbar { flex-direction: column; gap: .15rem; padding-block: .35rem; }
  .edition-line { font-size: .75rem; }
  .language-switcher { width: 100%; }
  .language-button { padding-inline: .55rem; }
  .hero-copy { padding-block: .65rem .9rem; }
  .masthead { font-size: clamp(2.25rem, 9.7vw, 4rem); }
  .hero-search { margin-top: 1rem; }
  .hero-search .button { padding-inline: 1rem; }
  .hero-actions { justify-content: space-between; column-gap: .5rem; margin-bottom: .5rem; }
  .button-chip { font-size: .875rem; }
  .view-switch { grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.5rem), 1fr)); position: fixed; z-index: 20; inset-inline: 0; bottom: 0; border-top: 1px solid var(--border); background: var(--paper); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .view-switch .view-tab { flex-direction: column; gap: .25rem; font-size: .875rem; line-height: 1.3; padding: .65rem .2rem; position: relative; }
  .view-switch .view-tab.is-active { box-shadow: inset 0 3px var(--teal); }
  .view-switch #favoriteCount { position: absolute; top: .35rem; inset-inline-end: max(.15rem, calc(50% - 2rem)); }
  .guide-meta { margin-block: .2rem; }
  .filters-card { margin-bottom: 1rem; }
  .filters-primary, .filters-extra { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dateFilterWrap, .filters-primary .reset-button { grid-column: 1 / -1; }
  .results-heading { flex-wrap: wrap; padding-bottom: .6rem; }
  .results-layout, .recurring-section { margin-top: 1rem; }
  .events .day-heading { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .day-group { margin-bottom: 0; }
  .result-count { flex-shrink: 1; }
  .event-card { grid-template-columns: 2.5rem minmax(0, 1fr) 2.75rem; column-gap: .65rem; }
  .activity-card h3 { font-size: 1.4rem; }
  .event-date strong { font-size: 2rem; }
  .card-meta { display: grid; gap: .1rem; }
  .card-meta span:not(:last-child)::after { content: none; }
  .card-detail, .feedback-card { padding: 1rem; }
  .fact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .holiday-teaser { padding: 1.1rem; }
  .share-status { bottom: 8rem; }
}
@container (max-width: 20em) {
  .event-card { grid-template-columns: minmax(0, 1fr) 2.75rem; }
  .event-date { display: none; }
  .event-card .card-main { grid-column: 1; }
  .fact-list { grid-template-columns: 1fr; }
}
/* Text enlargement keeps navigation compact and labels readable. */
@container navigation (max-width: 14em) {
  .view-switch .view-tab { padding: .4rem .15rem; }
  .view-switch .view-tab svg, .view-switch #favoriteCount { display: none; }
}
@media (max-width: 400px) {
  .filter-hint { display: none; }
  .filters-primary, .filters-extra { grid-template-columns: 1fr; }
  .guide-meta { flex-wrap: wrap; gap: 0; }
  .updated-line { font-size: .75rem; }
}
@container recurring (max-width: 20em) {
  .recurring-quick-filters { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .hero-search, .hero-actions, .filters-card, .recurring-quick-filters, .card-actions, .card-primary-actions, .favorite-button, .feedback-section, .view-switch, .show-more, .load-status, .share-status, .holiday-teaser { display: none !important; }
  body { padding: 0; background: #fff; }
  .activity-card { break-inside: avoid; }
  .card-detail { display: block !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
