/*
 * State portal layout. Colors come ONLY from tokens.css variables
 * (no hex values here; scripts/check_brand.py enforces it).
 */
*, *::before, *::after { box-sizing: border-box; }

body.state-site {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/var(--lh-body) var(--font);
}

/* One container rule for every screen: fluid side margins, capped width.
   The same proportions hold from a 360px phone to a 2560px monitor. */
.state-shell { width: min(1240px, 100% - 2 * clamp(16px, 5vw, 64px)); margin-inline: auto; }
html { font-size: 100%; }
@media (min-width: 1800px) {
  html { font-size: 106.25%; }               /* 17px base on large monitors */
  .state-shell { width: min(1440px, 100% - 2 * 64px); }
}
main.state-shell { padding: clamp(24px, 4vw, 48px) 0 clamp(48px, 6vw, 80px); min-height: 60vh; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--pbs-pure-white); color: var(--pbs-royal-blue); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* header: Royal Blue in both modes */
.pbs-header { height: auto; min-height: var(--header-height); padding: 0; }
.pbs-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.state-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.menu-toggle {
  font: bold var(--fs-body)/1 var(--font); cursor: pointer;
  color: var(--header-fg); background: transparent;
  border: 1px solid var(--header-fg); border-radius: var(--radius);
  padding: 10px 14px; min-height: 44px;
}
@media (max-width: 960px) {
  .has-js-nav .state-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 8px 0 16px; }
  .has-js-nav .state-nav.is-open { display: flex; }
  .has-js-nav .state-nav a, .has-js-nav .theme-toggle { padding: 12px; margin: 0; text-align: left; }
}
@media (min-width: 961px) { .menu-toggle { display: none; } }
.state-nav a {
  color: var(--header-fg);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.state-nav a:hover { border-color: var(--header-fg); }
.state-nav a[aria-current="page"] { border-color: var(--header-fg); font-weight: bold; }
.theme-toggle {
  font: inherit; cursor: pointer;
  color: var(--header-fg); background: transparent;
  border: 1px solid var(--header-fg); border-radius: var(--radius);
  padding: 8px 12px; margin-left: 4px;
}

/* type */
h1 { font: bold var(--fs-display)/var(--lh-display) var(--font); margin: 0 0 16px; }
h2 { font: bold var(--fs-h1)/1.3 var(--font); margin: 48px 0 16px; }
.lead { font-size: 1.125rem; max-width: 60ch; color: var(--text-muted); }
.eyebrow { font-size: var(--fs-small); font-weight: bold; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 8px; color: var(--text-muted); }
a { color: var(--link); }
.note { color: var(--text-muted); margin-top: 32px; }

/* hero */
.hero { padding: 24px 0 8px; }
.search { display: flex; gap: 8px; margin-top: 24px; max-width: 640px; }
.search input { flex: 1; }

/* ---- inner-page title band: title and breadcrumb on Royal Blue; the card overlaps it ---- */
.page-band { position: relative; overflow: hidden; background: var(--pbs-royal-blue); color: var(--pbs-pure-white); padding: clamp(24px, 3vw, 40px) 0 clamp(56px, 5vw, 76px); }
.page-band > .state-shell { position: relative; }
/* the Illinois outline as a faint, cropped backdrop (a map shape, kept away from the marks) */
.band-outline { position: absolute; right: 2%; top: -12%; height: 185%; width: auto; color: var(--pbs-pure-white); opacity: 0.1; pointer-events: none; }
@media (max-width: 640px) { .band-outline { right: -10%; height: 150%; } }
/* locator map on chapter and event pages */
.locator { margin: 28px 0 8px; max-width: 220px; color: var(--link); }
.locator figcaption { margin: 0 0 8px; font-size: var(--fs-small); font-weight: bold; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.mini-map { display: block; width: 100%; height: auto; }
.locator-place { margin: 8px 0 0; font-weight: bold; color: var(--text); }
/* one photo style for public photos: grayscale, toned Royal Blue; natural colors on hover or focus */
.photo-tone { position: relative; display: block; overflow: hidden; background: var(--pbs-royal-blue); }
.photo-tone img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); mix-blend-mode: luminosity; transition: filter 0.35s ease; }
.photo-tone:hover img, .photo-tone:focus-within img, .photo-tone:focus-visible img, a:focus-visible > .photo-tone img { filter: none; mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) { .photo-tone img { transition: none; } }
.page-band .breadcrumb { margin: 0 0 10px; color: rgb(255 255 255 / 0.85); }
.page-band .breadcrumb a { color: var(--pbs-pure-white); }
.page-band-title { margin: 0; color: var(--pbs-pure-white); font: bold clamp(1.75rem, 1.2rem + 2vw, 2.75rem)/1.15 var(--font); letter-spacing: -0.01em; }
.page-band + main.state-shell { padding-top: 0; margin-top: -32px; position: relative; }

/* ---- one chrome for every inner page: mirrors the chapter site's panels in the state palette.
   (The landing page renders its own full-bleed sections.) ---- */
.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: 0 4px 12px rgb(31 30 30 / 0.12);
}
.page-card--plain { background: transparent; border: 0; box-shadow: none; padding: 0; }
.page-card h1 {
  display: inline-block;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--link);
  color: var(--link);
  font: bold 2.25rem/1.15 var(--font);
}
.page-card h2 { color: var(--link); }
.page-card .lead { margin-top: 0; }
/* boxed panels: a Cool Gray tint with a 2px border, like the chapter's calendar and sidebar boxes */
.panel, .state-site .cal-box, .state-site .tips, .state-site .directors, .state-site .program-side,
.state-site .review-card, .state-site .kit-item, .state-site .leader, .state-site .auth-card,
.state-site .stat, .state-site .card a, .state-site .event-map, .state-site .notice {
  background: rgb(200 201 199 / 0.18);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.state-site .notice { border-left-width: 4px; border-left-color: var(--link); }
/* tables: Royal Blue header row, bordered cells */
.page-card table { width: 100%; border-collapse: collapse; }
.page-card th { font-weight: bold; padding: 8px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
/* column headers only; row headers (tbody th) stay on the page background */
.page-card table thead th { background: var(--pbs-royal-blue); color: var(--pbs-pure-white); padding: 10px 8px; vertical-align: bottom; }
.page-card td { padding: 8px; border: 1px solid var(--border); vertical-align: top; }

/* forms */
input[type="search"], select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--link);
  border-radius: 4px;
  padding: 10px 12px;
  min-height: 44px;
}
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0; }
.filters label { font-weight: bold; }

/* flash messages (django.contrib.messages); status color on the edge, text stays readable in both modes */
.flash-list { margin-top: 16px; }
.flash { margin: 0 0 8px; padding: 12px 16px; border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); }
.flash-success { border-left-color: var(--ui-success); }
.flash-error { border-left-color: var(--ui-error); }
.flash-warning { border-left-color: var(--ui-warning); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  font: bold var(--fs-body)/1 var(--font);
  border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 1px solid var(--btn-primary-border); }
.btn-secondary { background: transparent; color: var(--btn-secondary-fg); border: 1px solid var(--btn-secondary-border); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 32px; }
.stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 24px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); background: var(--surface);
}
.stat:hover { border-color: var(--link); }
.stat-value { font: bold 2.5rem/1 var(--font); color: var(--link); }
.stat-label { color: var(--text-muted); }

/* cards */
.card-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card a {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); background: var(--surface);
}
.card a:hover { border-color: var(--link); }
.card-title { font-weight: bold; color: var(--link); }
.card-meta { font-size: var(--fs-small); color: var(--text-muted); }

/* table */
.result-count { color: var(--text-muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table thead th { font-size: var(--fs-small); color: var(--text-muted); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table .row-inactive th, .data-table .row-inactive td { color: var(--text-muted); }
.status-check { width: 22px; height: 22px; accent-color: var(--pbs-royal-blue); vertical-align: middle; }

/* detail */
.breadcrumb { font-size: var(--fs-small); color: var(--text-muted); margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 24px 0 32px; }
.facts dt { font-weight: bold; }
.facts dd { margin: 0; }

pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }

/* footer */
.state-footer { background: var(--header-bg); color: var(--header-fg); font-size: var(--fs-small); }
.state-footer a { color: var(--header-fg); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
  gap: 32px clamp(24px, 4vw, 56px);
  padding: clamp(32px, 5vw, 56px) 0;
}
.footer-title { font: bold var(--fs-body)/1.3 var(--font); margin: 0 0 12px; }
.footer-col p { margin: 0 0 8px; line-height: 1.6; }
.footer-motto { font-style: italic; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-url { display: block; opacity: 0.8; font-size: 0.8125rem; overflow-wrap: anywhere; }
.footer-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 16px 0 24px;
  border-top: 1px solid var(--header-fg);
}
.footer-bar p { margin: 0; }
.footer-social { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.75rem; line-height: 2.25rem; }
  .search { flex-direction: column; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters .btn { width: 100%; }
}

/* Illinois state badge */
.pbs-badge { display: block; border-radius: 50%; }
.footer-badge { display: block; margin-bottom: 16px; border-radius: 50%; }

/* highlighted quote (director message) */
.pull-quote { margin: 24px 0; padding: 4px 0 4px 24px; border-left: 6px solid var(--pbs-royal-blue); max-width: 60ch; }
.pull-quote p { margin: 0; font-size: var(--fs-h1); line-height: 1.4; font-weight: bold; }
.near-status { flex-basis: 100%; margin: 0; }
.near-status:empty { display: none; }

/* State Director with a full-length portrait: the figure stands on a Royal Blue card,
   in the manner of the state's welcome-address graphic (brand palette only). */
/* .state-site .leader (state.css) paints the panel: out-rank it here */
.state-site .leader.leader-portrait, .state-site .leader-hero.leader-portrait, .leader-portrait {
  position: relative; display: grid; grid-template-columns: minmax(240px, 36%) 1fr; gap: 32px; align-items: end;
  border-radius: var(--radius); margin: 0;
  padding: 0 32px 0 0; overflow: hidden; border: 0; box-shadow: none; color: var(--pbs-pure-white);
  background: radial-gradient(circle at 14% 42%, color-mix(in srgb, var(--pbs-royal-blue) 72%, var(--pbs-pure-white)), transparent 58%), var(--pbs-royal-blue); }
.leader-portrait .leader-portrait-img { display: block; width: 100%; height: auto; max-height: 760px; object-fit: contain; object-position: bottom center; margin-top: 28px; }
.leader-portrait .leader-badge { position: absolute; top: 16px; right: 16px; }
.leader-portrait .leader-badge img { display: block; }
.leader-portrait .leader-body, .leader-portrait > div { padding: 32px 0; align-self: center; }
.leader-portrait .leader-title { margin: 0 0 4px; font-size: var(--fs-small); font-weight: bold; color: var(--pbs-sigma-gray); }
.leader-portrait .leader-chapter { font-size: var(--fs-small); }
.leader-portrait p { margin: 0 0 8px; }
.leader-portrait .leader-name, .leader-portrait .leader-chapter, .leader-portrait p, .leader-portrait a { color: var(--pbs-pure-white); }
.leader-portrait .leader-name { margin: 0 0 10px; font: bold var(--fs-h1)/1.2 var(--font); }
.leader-portrait .card-quote { display: inline-block; margin: 8px 0 16px; padding: 10px 18px; border: 2px solid var(--pbs-pure-white); border-radius: var(--radius);
  font: bold var(--fs-h2)/1.3 var(--font); letter-spacing: 0.04em; text-transform: uppercase; }
.leader-portrait .card-message { max-width: 64ch; margin: 0 0 12px; }
.leader-portrait .card-message p { margin: 0 0 12px; line-height: 1.55; }
.leader-portrait .btn-light { display: inline-block; background: var(--pbs-pure-white); color: var(--pbs-royal-blue); border-color: var(--pbs-pure-white); text-decoration: none; }
.leader-portrait .btn-light:hover, .leader-portrait .btn-light:focus-visible { background: var(--pbs-sigma-gray); color: var(--pbs-black); border-color: var(--pbs-sigma-gray); }
.leader-portrait a:focus-visible { outline: 3px solid var(--pbs-pure-white); outline-offset: 2px; }
@media (max-width: 1100px) {
  .state-site .leader.leader-portrait, .state-site .leader-hero.leader-portrait, .leader-portrait { grid-template-columns: 1fr; padding: 0 20px; gap: 0; }
  .leader-portrait .leader-portrait-img { width: auto; max-width: 100%; max-height: 420px; margin: 56px auto 0; }
  .leader-portrait .leader-body, .leader-portrait > div { padding: 20px 0 24px; }
  .leader-portrait .leader-badge { top: 12px; right: 12px; }
}
