/* Plain, dense directory. Shared tokens keep forms and utility pages in the same theme. */

:root {
  --bg: #fff;
  --fg: #22231f;
  --link: #234e88;
  --visited: #551a8b;
  --row: #f0f0ec;
  --card: #fafaf7;
  --card-border: #c9c9bf;
  --control-border: #7d7d70;
  --muted: #5a5b51;
  --selected-bg: #e4ebf3;
  --error: #b00020;
  --notice-bg: #ffffcc;
  --notice-border: #c8c800;
  --input-line: #7d7d70;
  --submit: #e4ebf3;
  color-scheme: light;
}

html.dark,
html:has(#theme-toggle:checked) {
  --bg: #171716;
  --fg: #e8e3d5;
  --link: #e7bc4f;
  --visited: #ccae70;
  --row: #22221f;
  --card: #2a2923;
  --card-border: #494538;
  --control-border: #8b8065;
  --muted: #b7b09d;
  --selected-bg: #393325;
  --error: #ff8a8a;
  --notice-bg: #302a1b;
  --notice-border: #8b8065;
  --input-line: #8b8065;
  --submit: #393325;
  color-scheme: dark;
}

[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--fg);
  font: 14.4px/1.4 Verdana, Geneva, sans-serif;
  max-width: 950px;
  margin: 8px auto;
  padding: 0 8px;
}

a { color: var(--link); }
a:visited { color: var(--visited); }
a:hover { text-decoration-thickness: 2px; }
input, select, button, textarea { accent-color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, .table-wrap:focus-visible, #listings:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.theme-line { margin: 0 0 4px; }
.theme-line input, .wide-line input { vertical-align: middle; }

.demo-banner {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  padding: 6px 8px;
}
.demo-tag { font-weight: bold; }

h1.region-title { font-size: 21.6px; font-weight: bold; margin: 17.9px 0; }
h2 { font-size: 16.8px; font-weight: bold; margin: 28px 0 14px; }

.notice { background: var(--notice-bg); border: 1px solid var(--notice-border); padding: 4px 8px; }
.result-count, .cal-line, .section-note, .updated, .hint { font-size: 12.6px; color: var(--muted); }
.empty-state { font-style: italic; }
.no-match { font-weight: bold; }

.skip-link { position: absolute; top: -100px; }
.skip-link:focus { top: 4px; z-index: 2; padding: 10px; background: var(--bg); }
.region-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; }
.region-header h1 { margin: 0; line-height: 1.2; }
.add-action { font-weight: bold; white-space: nowrap; padding: 12px 0 12px 8px; }
.search-line { display: flex; gap: 8px; margin: 0 0 10px; }
.region input:not([type="checkbox"]), .region select, .region button {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--control-border);
  border-radius: 3px; min-height: 44px; padding: 8px; box-sizing: border-box;
}
.region button { cursor: pointer; background: var(--card); }
.search-line input[type="search"] { flex: 1; width: 0; min-width: 0; font-size: 16px; }
.search-line button { padding-inline: 14px; }
.primary-filters { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 10px; }
.primary-filters label, .range-fields label { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12.6px; color: var(--muted); }
.primary-filters select, .range-fields select, .range-fields input { width: 100%; min-width: 0; font-size: 14px; }
.date-line { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 2px; }
.date-link { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 10px; border-radius: 3px; }
.date-link[aria-current="true"] { background: var(--selected-bg); color: var(--fg); font-weight: bold; text-decoration: none; box-shadow: inset 0 -2px var(--link); }
.more-filters { margin: 0; }
summary { cursor: pointer; color: var(--link); padding: 10px 0; width: fit-content; }
.range-fields { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: 10px; margin: 8px 0; }
.more-filters .hint { margin: 8px 0; }
.utilities { display: flex; flex-wrap: wrap; align-items: start; gap: 0 20px; border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); margin: 4px 0 0; }
.utility { min-width: 0; }
.utility[open] { flex-basis: 100%; }
.utility nav, .utility-content { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding-bottom: 8px; }
.utility a, .preference { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; }
.preference { cursor: pointer; }
.preference input { width: 18px; height: 18px; margin: 0; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.6px; margin: 10px 0; }
#active-filter-list { display: contents; }
#active-filter-list span { background: var(--card); padding: 4px 6px; overflow-wrap: anywhere; }
#reset-link { display: inline-flex; align-items: center; min-height: 40px; }
.result-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 12px 0 8px; }
.result-count strong { color: var(--fg); font-weight: normal; }
.timezone-note { margin-left: auto; }
.recurring-count { white-space: nowrap; }
.region footer { border-top: 1px solid var(--card-border); margin-top: 28px; }
.region .footer-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 8px 0; }
.region .footer-links a { display: inline-flex; min-height: 44px; align-items: center; }
.contact-line { font-size: 12.6px; overflow-wrap: anywhere; }
.venue-line { display: block; margin-top: 3px; }
.mobile-label { display: none; }

.wide-line { display: none; }

/* Listing tables */
.table-wrap { overflow-x: auto; }
table.listing { width: 100%; border-collapse: collapse; font-size: 14.4px; }
table.listing th {
  background: var(--bg);
  text-align: left;
  padding: 10px 8px;
  vertical-align: bottom;
}
table.listing td { padding: 10px 8px; vertical-align: top; overflow-wrap: anywhere; }
table.listing td.c-when { min-width: 90px; }
table.listing td.c-title { min-width: 200px; }
table.listing .c-when { width: 13%; }
table.listing .c-title { width: 32%; }
table.listing .c-tags { width: 16%; }
table.listing .c-cost { width: 18%; }
table.listing .c-org { width: 13%; }
table.listing .c-links { width: 8%; min-width: 66px; }
table.listing .c-links a { overflow-wrap: normal; }
table.listing tbody tr:nth-child(odd) { background: var(--row); }
table.listing tbody tr:nth-child(odd of :not([hidden])) { background: var(--row); }
table.listing tbody tr:nth-child(even of :not([hidden])) { background: transparent; }
.status { font-weight: bold; }
.ics-link, .fix-link { font-size: 12.6px; display: inline-flex; align-items: center; min-height: 28px; }
.context { display: block; margin-top: 3px; font-size: 12.6px; color: var(--muted); }
.date-line { margin-top: 0; }
.date-link[aria-current="true"] { font-weight: bold; }
#copy-link { font-size: 13px; }

.directory { line-height: 1.25; }
.footer-links { margin-top: 28px; }

/* Plain documentation pages */
.doc code { font-size: 13px; }
table.plain { border-collapse: collapse; }
table.plain th, table.plain td { text-align: left; padding: 4px 10px 4px 0; vertical-align: top; }

/* Home page keeps the reference's serif link index */
body.home { font-family: "Times New Roman", Times, serif; }
body.home .theme-line { font: 13px Verdana, Geneva, sans-serif; }
.home-title { font-size: 25px; font-weight: normal; margin: 26px 0; }
.region-link { font-size: 28px; margin: 0 0 30px; }
.rule { font-size: 21px; margin: 0 0 20px; overflow: hidden; }
.small-link { font: 14.4px Verdana, Geneva, sans-serif; margin: 0 0 18px; }
.home-contact { font-size: 22px; }

/* Submission form: narrow, left-aligned, underline inputs, pale submit button */
body.form-page {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  margin: 8px;
  max-width: 500px;
}
.submit-form { max-width: 500px; }
.form-intro { font-weight: bold; font-size: 18px; margin: 4px 4px 14px; }
.form-title { font-size: 20px; }
.form-note, .form-alt { margin: 0 4px 10px; }
.required-note { color: var(--error); font-size: 12px; margin: 0 4px 12px; }
.req { color: var(--error); font-size: 12px; }
.field { margin: 0 4px 14px; border: 0; padding: 0; }
.field > label, .field > legend { display: block; margin-bottom: 2px; }
fieldset.field legend { padding: 0; }
label.small { display: block; font-size: 13px; margin-top: 4px; }
label.check { display: block; font-size: 13px; margin-top: 6px; }
.field .hint { display: block; font-size: 12px; color: var(--muted); }
.field-error { display: block; color: var(--error); font-size: 13px; font-weight: bold; margin: 2px 0; }
.field input[type="text"], .field input[type="url"], .field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 2px solid var(--input-line);
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 8px 4px 4px;
}
.field textarea { border: 2px solid var(--input-line); }
.field input[type="date"], .field input[type="time"], .field select { font-size: 14px; margin-top: 2px; max-width: 100%; }
.field [aria-invalid="true"] { border-color: var(--error); }
.error-summary { border: 2px solid var(--error); padding: 4px 10px; margin: 0 4px 14px; }
.error-summary ul { margin: 4px 0; padding-left: 20px; }
.submit-btn {
  width: 100%;
  background: var(--submit);
  color: var(--fg);
  border: 0;
  padding: 10px;
  font: inherit;
  cursor: pointer;
}
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Narrow screens: compact multi-line rows by default; "Wide table on mobile" restores the wide table
   inside its own horizontal scroller. */
@media (max-width: 760px) {
  .wide-line { display: block; }
  .region-header { margin: 12px 0; gap: 12px; }
  .region-header h1 { font-size: 21px; }
  .primary-filters { grid-template-columns: 1fr 1fr; gap: 8px; }
  .primary-filters .entry-filter { grid-column: 1 / -1; }
  .region select, .region input:not([type="checkbox"]) { font-size: 16px; }
  .date-line { gap: 2px; justify-content: space-between; }
  .date-link { padding-inline: 7px; font-size: 13px; min-height: 44px; }
  .range-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .range-fields label:first-child { grid-column: 1 / -1; }
  .range-fields button { grid-column: 1 / -1; }
  .utilities { gap: 0 16px; font-size: 13px; }
  .utility .preference { display: flex; }
  .timezone-note { flex-basis: 100%; margin-left: 0; font-size: 12px; }

  html.wide table.listing,
  html:has(#wide-toggle:checked) table.listing { min-width: 880px; }

  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing,
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing tbody { display: block; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "when cost"
      "tags tags"
      "org org"
      "links links";
    align-items: start;
    border-top: 1px solid var(--card-border);
    padding: 7px 0;
    margin: 0;
  }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing th,
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing td { display: block; padding: 4px 8px; min-width: 0; width: auto; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-title { grid-area: title; text-align: left; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-when { grid-area: when; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-cost { grid-area: cost; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-org { grid-area: org; font-size: 12.6px; color: var(--muted); }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-tags { grid-area: tags; font-size: 12.6px; color: var(--muted); }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing .c-links { grid-area: links; display: flex; flex-wrap: wrap; gap: 4px 18px; }
  html:not(.wide):not(:has(#wide-toggle:checked)) .c-links br { display: none; }
  html:not(.wide):not(:has(#wide-toggle:checked)) .c-links a { min-height: 32px; display: inline-flex; align-items: center; }
  html:not(.wide):not(:has(#wide-toggle:checked)) .mobile-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  html:not(.wide):not(:has(#wide-toggle:checked)) .c-org .mobile-label { display: inline; }
  html:not(.wide):not(:has(#wide-toggle:checked)) .c-title > a { font-size: 15px; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing th { padding: 4px 7px; background: transparent; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing th.c-org { font-size: 14.4px; }
  html:not(.wide):not(:has(#wide-toggle:checked)) table.listing th.c-tags { font-style: normal; }
}
