/* GG Legistar — stylesheet
   Follows GlassGovernment design conventions: custom properties, no !important.
   WCAG 2.1 AA: sufficient contrast, keyboard focus rings, heading structure.
*/

/* -------------------------------------------------------------------------
   Shared utilities
------------------------------------------------------------------------- */
.ggl-error,
.ggl-empty {
  color: #555;
  font-style: italic;
  padding: 1rem 0;
}

.ggl-error {
  color: #b00;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.ggl-provenance {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #666;
  border-top: 1px solid #e0e0e0;
  padding-top: 0.75rem;
}

.ggl-provenance a {
  color: inherit;
  text-decoration: underline;
}

/* -------------------------------------------------------------------------
   Index page
------------------------------------------------------------------------- */
.ggl-index {
  max-width: 900px;
}

.ggl-index-header {
  margin-bottom: 1.5rem;
}

.ggl-lead {
  color: #444;
  font-size: 1rem;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.ggl-index-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ggl-search,
.ggl-state-filter,
.ggl-beat-filter {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
}

.ggl-search {
  flex: 1 1 220px;
}

.ggl-state-filter,
.ggl-beat-filter {
  flex: 0 1 170px;
}

.ggl-search:focus,
.ggl-state-filter:focus,
.ggl-beat-filter:focus {
  outline: 3px solid #005fcc;
  outline-offset: 1px;
  border-color: #005fcc;
}

.ggl-index-count {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
}

.ggl-index .ggl-jurisdiction-list {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-inline-start: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.ggl-index .ggl-jurisdiction-card {
  margin: 0;
}

.ggl-jurisdiction-card[hidden] {
  display: none;
}

.ggl-jurisdiction-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #222;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.ggl-jurisdiction-link:hover {
  border-color: #005fcc;
  background: #f0f6ff;
}

.ggl-jurisdiction-link--external {
  background: #fff;
}

.ggl-jurisdiction-link--external:hover {
  background: #f7fbf8;
  border-color: #2a7a48;
}

.ggl-jurisdiction-link:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.ggl-jurisdiction-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ggl-card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ggl-jurisdiction-state {
  font-size: 0.8rem;
  color: #666;
}

.ggl-beat {
  background: #eef3f7;
  border: 1px solid #d8e1e8;
  border-radius: 3px;
  color: #3f5565;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.18em 0.45em;
  text-transform: uppercase;
}

.ggl-jurisdiction-events {
  color: #666;
  font-size: 0.78rem;
  line-height: 1.35;
}

.ggl-source-badge {
  border-radius: 3px;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.2em 0.45em;
  text-transform: uppercase;
}

.ggl-source-badge--ok {
  background: #e6f4ea;
  color: #1a6630;
}

.ggl-source-badge--issue {
  background: #fff1d6;
  color: #735000;
}

.ggl-source-badge--pending {
  background: #e9eef6;
  color: #334;
}

.ggl-source-badge--calendar {
  background: #e7f3ec;
  color: #235b36;
}

.ggl-calendar-directory {
  border-top: 1px solid #e0e0e0;
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.ggl-directory-heading {
  margin-bottom: 1rem;
}

.ggl-directory-heading h3 {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.ggl-directory-heading p {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
}

.ggl-calendar-directory-list {
  display: grid;
  gap: 1.25rem;
}

.ggl-state-group[hidden] {
  display: none;
}

.ggl-state-heading {
  align-items: baseline;
  border-bottom: 1px solid #e7e7e7;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.95rem;
  gap: 0.5rem;
  justify-content: space-between;
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
}

.ggl-state-heading-count {
  color: #666;
  font-size: 0.78rem;
  font-weight: 500;
}

.ggl-filter-empty {
  margin-top: 0.75rem;
}

/* -------------------------------------------------------------------------
   Calendar page
------------------------------------------------------------------------- */
.ggl-calendar {
  max-width: 960px;
}

.ggl-cal-header {
  margin-bottom: 1.5rem;
}

.ggl-breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: #555;
}

.ggl-breadcrumb a {
  color: #005fcc;
  text-decoration: none;
}

.ggl-breadcrumb a:hover {
  text-decoration: underline;
}

.ggl-breadcrumb span[aria-hidden] {
  margin: 0 0.3em;
}

.ggl-cal-state {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.25rem;
}

.ggl-section-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ggl-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e9eef6;
  color: #334;
  font-size: 0.75rem;
  font-weight: normal;
  border-radius: 10px;
  padding: 0 0.5em;
  min-width: 1.6em;
  height: 1.6em;
}

/* -------------------------------------------------------------------------
   Event table
------------------------------------------------------------------------- */
.ggl-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ggl-events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ggl-events-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #ccc;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  white-space: nowrap;
}

.ggl-events-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #ebebeb;
  vertical-align: top;
}

.ggl-event-row:hover td {
  background: #f6f8fc;
}

.ggl-date {
  white-space: nowrap;
  color: #333;
  font-weight: 500;
}

.ggl-time {
  white-space: nowrap;
  color: #555;
}

.ggl-title {
  line-height: 1.5;
}

.ggl-location {
  color: #555;
  font-size: 0.85rem;
}

.ggl-agenda-link {
  color: #005fcc;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
}

.ggl-agenda-link:hover {
  text-decoration: underline;
}

.ggl-minutes-link {
  color: #2a7a48;
}

/* Status badge */
.ggl-status {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.3em;
  background: #e9eef6;
  color: #334;
}

.ggl-status--final,
.ggl-status--approved,
.ggl-status--published {
  background: #e6f4ea;
  color: #1a6630;
}

.ggl-status--draft {
  background: #fff7e0;
  color: #7a5800;
}

/* -------------------------------------------------------------------------
   Agenda items inline panel
------------------------------------------------------------------------- */
.ggl-items-toggle {
  font-size: 0.78rem;
  padding: 0.15em 0.5em;
  margin-left: 0.4em;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.6;
}

.ggl-items-toggle:hover {
  background: #e8eef8;
  border-color: #005fcc;
}

.ggl-items-toggle:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 1px;
}

.ggl-items-panel {
  margin-top: 0.5rem;
}

.ggl-items-loading,
.ggl-items-error,
.ggl-items-empty {
  font-size: 0.82rem;
  color: #666;
  font-style: italic;
  margin: 0.25rem 0;
}

.ggl-items-error {
  color: #b00;
}

@keyframes ggl-spin {
  to { transform: rotate(360deg); }
}

.ggl-items-loading::before {
  content: '';
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  border: 2px solid #ccc;
  border-top-color: #005fcc;
  border-radius: 50%;
  animation: ggl-spin 0.6s linear infinite;
  margin-right: 0.4em;
  vertical-align: middle;
}

.ggl-items-list {
  margin: 0.4rem 0 0.4rem 1.2rem;
  padding: 0;
  font-size: 0.85rem;
}

.ggl-items-list li {
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.ggl-item-file {
  font-size: 0.78rem;
  color: #555;
  font-family: monospace;
  background: #f0f0f0;
  padding: 0 0.3em;
  border-radius: 2px;
}

.ggl-item-type {
  font-size: 0.78rem;
  color: #666;
}

.ggl-item-action {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  background: #e9eef6;
  color: #334;
}

.ggl-item-action--approved {
  background: #e6f4ea;
  color: #1a6630;
}

.ggl-item-action--referred,
.ggl-item-action--tabled {
  background: #fff7e0;
  color: #7a5800;
}

/* -------------------------------------------------------------------------
   Upcoming multi-jurisdiction table
------------------------------------------------------------------------- */
.ggl-events-table--multi .ggl-jurisdiction {
  font-size: 0.85rem;
}

.ggl-events-table--multi .ggl-state {
  display: block;
  font-size: 0.75rem;
  color: #888;
}

/* -------------------------------------------------------------------------
   Not-found state
------------------------------------------------------------------------- */
.ggl-not-found {
  padding: 2rem 0;
}

.ggl-not-found a {
  color: #005fcc;
}

/* -------------------------------------------------------------------------
   FullCalendar embed in index + upcoming views
------------------------------------------------------------------------- */
.ggl-index-calendar {
  margin-bottom: 2rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

/* -------------------------------------------------------------------------
   Disclosure panels — issues + calendar directory
------------------------------------------------------------------------- */
.ggl-issues-disclosure,
.ggl-directory-disclosure {
  margin-top: 1.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.ggl-issues-summary,
.ggl-directory-summary {
  align-items: baseline;
  background: #f8f8f8;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 0.65rem;
  list-style: none;
  padding: 0.75rem 1rem;
  transition: background 0.15s;
}

/* Remove default marker in all browsers */
.ggl-issues-summary::-webkit-details-marker,
.ggl-directory-summary::-webkit-details-marker {
  display: none;
}

.ggl-issues-summary:hover,
.ggl-directory-summary:hover {
  background: #efefef;
}

.ggl-issues-disclosure[open] .ggl-issues-summary,
.ggl-directory-disclosure[open] .ggl-directory-summary {
  border-bottom: 1px solid #e0e0e0;
}

.ggl-issues-summary:focus-visible,
.ggl-directory-summary:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: -2px;
}

.ggl-disclosure-label {
  align-items: center;
  color: #222;
  display: inline-flex;
  font-weight: 600;
  gap: 0.4rem;
}

/* Animated chevron */
.ggl-disclosure-label::before {
  content: '▶';
  display: inline-block;
  font-size: 0.55rem;
  transition: transform 0.2s;
}

details[open] > summary .ggl-disclosure-label::before {
  transform: rotate(90deg);
}

.ggl-disclosure-note {
  color: #666;
  font-size: 0.82rem;
  font-weight: 400;
}

.ggl-disclosure-count {
  align-items: center;
  background: #e0e0e0;
  border-radius: 10px;
  color: #444;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 700;
  height: 1.55em;
  justify-content: center;
  line-height: 1;
  min-width: 1.55em;
  padding: 0 0.45em;
}

/* Issues list padding inside disclosure */
.ggl-issues-list {
  padding: 0.75rem;
}

/* Directory inner content */
.ggl-directory-inner {
  padding: 0.75rem 1rem 1rem;
}

.ggl-directory-explainer {
  background: #f5f7fa;
  border-left: 3px solid #c5d0e0;
  border-radius: 0 4px 4px 0;
  color: #555;
  font-size: 0.87rem;
  line-height: 1.55;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
}

/* -------------------------------------------------------------------------
   Issue card styling (muted, links to source Legistar portal)
------------------------------------------------------------------------- */
.ggl-jurisdiction-link--issue {
  background: #fdfaf5;
  border-color: #e8dfc8;
  opacity: 0.8;
}

.ggl-jurisdiction-link--issue:hover {
  background: #fffbef;
  border-color: #b8943a;
  opacity: 1;
}

/* -------------------------------------------------------------------------
   State filter form (render_upcoming)
------------------------------------------------------------------------- */
.ggl-upcoming-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.ggl-upcoming-title-row {
  flex: 1 1 auto;
}

.ggl-state-prompt {
  align-items: center;
  background: #f5f7fa;
  border: 1px solid #dde3ec;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.ggl-state-prompt-label {
  color: #555;
  font-size: 0.87rem;
  font-weight: 600;
}

.ggl-state-select {
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
}

.ggl-state-select:focus {
  border-color: #005fcc;
  outline: 3px solid #005fcc;
  outline-offset: 1px;
}

.ggl-state-submit {
  background: #005fcc;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  transition: background 0.15s;
}

.ggl-state-submit:hover {
  background: #004aab;
}

.ggl-state-submit:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.ggl-state-clear {
  color: #555;
  font-size: 0.85rem;
  text-decoration: underline;
}

.ggl-state-clear:hover {
  color: #005fcc;
}

/* -------------------------------------------------------------------------
   Responsive
------------------------------------------------------------------------- */

@media (max-width: 600px) {
  /* Switch event table to stacked card layout */
  .ggl-table-wrap {
    overflow-x: visible;
  }

  .ggl-events-table,
  .ggl-events-table tbody,
  .ggl-events-table tr,
  .ggl-events-table td {
    display: block;
  }

  .ggl-events-table thead {
    display: none;
  }

  .ggl-events-table tr.ggl-event-row {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
  }

  .ggl-events-table td {
    padding: 0.15rem 0;
    border: none;
  }

  /* Inline date · time on one row */
  .ggl-date { display: inline; font-weight: 600; }
  .ggl-time { display: inline; }
  .ggl-time::before { content: ' \00B7 '; color: #999; }

  /* Location de-emphasized */
  .ggl-location {
    font-size: 0.8rem;
    color: #888;
  }
  .ggl-location:empty { display: none; }

  .ggl-jurisdiction-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .ggl-jurisdiction-list {
    grid-template-columns: 1fr;
  }
}
