/*
 * ICA member app — base stylesheet.
 *
 * Design tokens are kept in sync BY HAND with the public site's child
 * theme (wp-content/themes/kadence-child/style.css, "ICA design tokens"
 * block). This app is a separate codebase, not a WordPress child theme,
 * so there's no automated way to share the source — if the palette or
 * type stack changes on the main site, update both places.
 */

@import url("../fonts.css");

:root {
  --ica-navy:        #0A2342;
  --ica-navy-deep:   #06182F;
  --ica-ink:         #1B1F27;
  --ica-ink-strong:  #10192B;
  --ica-muted:       #55607A;
  --ica-link:        #12507B;
  --ica-link-hover:  #0B3552;
  --ica-red:         #C8102E;
  --ica-rule:        #DCE1E9;
  --ica-rule-soft:   #E9EDF2;
  --ica-panel:       #F3F5F8;
  --ica-paper:       #FFFFFF;

  --ica-good:        #1B7A43;
  --ica-warn:        #8A5A12;
  --ica-danger:      #A3132B;

  --ica-font-serif:  "Source Serif 4", Georgia, "Times New Roman", serif;
  --ica-font-sans:   "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ica-radius:      6px;
  --ica-shadow:      0 1px 2px rgba(10, 35, 66, 0.08), 0 4px 12px rgba(10, 35, 66, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--ica-font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ica-ink);
  background: var(--ica-panel);
}

h1, h2, h3, h4 {
  font-family: var(--ica-font-serif);
  color: var(--ica-ink-strong);
  line-height: 1.2;
  text-wrap: balance;
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; }
a { color: var(--ica-link); }
a:hover { color: var(--ica-link-hover); }

/* ---------- Shell ---------- */

/* Header — mirrors the main site's Kadence masthead (WP child theme
   style.css "Header" section + the Kadence Customizer values it relies
   on) so moving between il-chess.org and shop./vote. reads as one site:
   two seamless navy-deep rows — masthead (56px logo, 30px serif title,
   tagline under the title) and a nav row (uppercase 14px/600 links,
   #C7D2E4, red underline on hover/current). Values copied by hand from
   the rendered main site, 2026-10-03 — re-sync if the Customizer
   header settings change. Same 1290px container + 1.5rem edge padding
   as Kadence's .site-container. */
.ica-app-header {
  background: var(--ica-navy-deep);
  color: #fff;
}
.ica-app-header__row {
  /* Kadence's header rows: 1290px of content, edges flush at desktop
     (its header padding is 0), so add the 1.5rem gutters outside that. */
  max-width: calc(1290px + 3rem);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.ica-app-header__masthead { padding-top: 18px; padding-bottom: 18px; }
.ica-app-header__navrow { padding-top: 4px; padding-bottom: 4px; }
/* Faint full-width rule between the rows, as on the main site. */
.ica-app-header__navbar { border-top: 1px solid rgba(255, 255, 255, 0.12); }

.ica-app-header__brandwrap { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ica-app-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}
.ica-app-header__brand:hover { color: #fff; }
.ica-app-header__brand img { display: block; width: 56px; height: auto; flex-shrink: 0; }
/* Title centers on the logo; the tagline hangs below it without pushing
   it up — same placement as the main site's negative-margin tagline. */
.ica-app-header__titlewrap { position: relative; display: block; }
.ica-app-header__title {
  display: block;
  font-family: var(--ica-font-serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: .005em;
}
.ica-app-header__tagline {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--ica-font-sans);
  font-size: 12px;
  letter-spacing: .04em;
  color: #AEBEDA;
}
/* "ICA" in red — matches the main site's header (ICA-in-"Illinois Chess
   Association" accented the same way). */
.ica-accent { color: var(--ica-red); }

/* Sub-site label beside the brand ("Shop" / "Elections") — links to this
   subdomain's own home, while the brand itself goes to the main site. */
.ica-app-header__section {
  padding: 2px 0 2px 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #C7D2E4;
  text-decoration: none;
  white-space: nowrap;
}
.ica-app-header__section:hover { color: #fff; }

.ica-app-header__nav { display: flex; flex-wrap: wrap; }
.ica-app-header__nav a {
  position: relative;
  display: block;
  padding: .6em calc(1.9em / 2);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: #C7D2E4;
  text-decoration: none;
}
.ica-app-header__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--ica-red);
  transform: scaleX(0);
  transition: transform .15s ease;
}
.ica-app-header__nav a:hover,
.ica-app-header__nav a[aria-current="page"] { color: #fff; }
.ica-app-header__nav a:hover::after,
.ica-app-header__nav a[aria-current="page"]::after { transform: scaleX(1); }

.ica-app-header__cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px;
  color: #C7D2E4;
}
.ica-app-header__cart:hover { color: #fff; }
.ica-app-header__cart-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ica-red);
  border: 1.5px solid var(--ica-navy-deep);
}

/* Same logo step-downs Kadence uses (50px tablet, 46px phone); the title
   shrinks too so "Illinois Chess Association" stays on one line beside
   the logo at phone width. */
@media (max-width: 1024px) {
  .ica-app-header__brand img { width: 50px; }
}
@media (max-width: 767px) {
  .ica-app-header__brand img { width: 46px; }
  .ica-app-header__title { font-size: 24px; }
  /* Logo is too short here for the tagline to hang beside it — stack it. */
  .ica-app-header__tagline { position: static; display: block; margin-top: 6px; white-space: normal; }
}
@media (max-width: 480px) {
  .ica-app-header__brandwrap,
  .ica-app-header__brand { gap: 12px; }
  .ica-app-header__brand img { width: 40px; }
  .ica-app-header__title { font-size: 20px; }
  .ica-app-header__tagline { font-size: 11px; }
  .ica-app-header__section { padding-left: 12px; font-size: 12px; }
}

.ica-app-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.ica-app-footer {
  border-top: 1px solid var(--ica-rule);
  padding: 24px;
  text-align: center;
  color: var(--ica-muted);
  font-size: 0.85rem;
}

/* ---------- Components ---------- */

.ica-card {
  background: var(--ica-paper);
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  box-shadow: var(--ica-shadow);
  padding: 28px;
}

.ica-btn {
  display: inline-block;
  background: var(--ica-navy);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--ica-radius);
  border: 1px solid var(--ica-navy);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: var(--ica-font-sans);
}
.ica-btn:hover { background: var(--ica-navy-deep); color: #fff; }
.ica-btn--outline {
  background: transparent;
  color: var(--ica-navy);
}
.ica-btn--outline:hover { background: var(--ica-panel); color: var(--ica-navy); }

.ica-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ica-rule-soft);
  color: var(--ica-muted);
}
.ica-badge--good  { background: #E4F3EA; color: var(--ica-good); }
.ica-badge--warn  { background: #F6ECDA; color: var(--ica-warn); }
.ica-badge--danger{ background: #F7E2E6; color: var(--ica-danger); }

table.ica-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.ica-table th, .ica-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ica-rule);
}
.ica-table th {
  font-family: var(--ica-font-sans);
  font-weight: 600;
  color: var(--ica-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ica-field { margin-bottom: 18px; }

/* Two fields sharing one row (e.g. state + postal code) — each .ica-field
   inside keeps its own label/input, just side by side instead of stacked. */
.ica-field-row { display: flex; gap: 14px; }
.ica-field-row .ica-field { flex: 1; margin-bottom: 18px; }
.ica-field-row .ica-field:first-child { flex: 2; }
.ica-field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: var(--ica-ink-strong);
}
.ica-field input,
.ica-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  font-family: var(--ica-font-sans);
  font-size: 0.95rem;
  background: #fff;
}
.ica-field input:focus,
.ica-field select:focus {
  outline: 2px solid var(--ica-link);
  outline-offset: 1px;
}

/* "Find your US Chess record" search (uschess-lookup.js) — a panel above
   the ID field, a dropdown of matches, and a status line under the ID. */
.ica-uschess {
  background: var(--ica-panel);
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  padding: 14px 16px;
}
.ica-uschess-help {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--ica-muted);
}
.ica-combo { position: relative; }
.ica-combo__list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--ica-paper);
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  box-shadow: var(--ica-shadow);
}
.ica-combo__list[hidden] { display: none; }
.ica-combo__opt,
.ica-combo__msg { padding: 8px 12px; }
.ica-combo__opt { cursor: pointer; }
.ica-combo__opt:hover,
.ica-combo__opt[aria-selected="true"] { background: var(--ica-panel); }
.ica-combo__opt strong { display: block; color: var(--ica-ink-strong); }
.ica-combo__meta,
.ica-combo__msg { font-size: 0.85rem; color: var(--ica-muted); }
.ica-uschess-status {
  margin: 6px 0 0;
  font-size: 0.88rem;
}
.ica-uschess-status:empty { display: none; }
.ica-uschess-status--ok   { color: var(--ica-good); }
.ica-uschess-status--warn { color: var(--ica-warn); }
.ica-uschess-status--bad  { color: var(--ica-danger); }

/* Selectable pricing cards — level picker on the join/renew pages. */
.ica-level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.ica-level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 32px 16px 16px;
  border: 1.5px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  background: var(--ica-paper);
  cursor: pointer;
  font-weight: normal;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.ica-level-card:hover { border-color: var(--ica-link); }
.ica-level-card:has(input:focus-visible) { outline: 2px solid var(--ica-link); outline-offset: 2px; }
.ica-level-card:has(input:checked) {
  border-color: var(--ica-navy);
  background: var(--ica-panel);
  box-shadow: 0 0 0 1px var(--ica-navy);
}
.ica-level-card input[type="radio"] {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ica-navy);
}
.ica-level-card__name {
  font-weight: 600;
  color: var(--ica-ink-strong);
  font-size: 0.95rem;
}
.ica-level-card__price {
  font-family: var(--ica-font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ica-navy);
  line-height: 1;
}
.ica-level-card__duration {
  font-size: 0.8rem;
  color: var(--ica-muted);
}

/* Shop landing page (Shop\Home, shop/home.php) — three plain option
   cards (membership / affiliate / donate), not selectable like
   .ica-level-card above, just a description + one or two links. */
.ica-shop-home__intro { text-align: center; max-width: 42rem; margin: 0 auto 32px; }
.ica-shop-home__intro p { color: var(--ica-muted); }
.ica-action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.ica-action-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  background: var(--ica-paper);
  box-shadow: var(--ica-shadow);
}
.ica-action-card h2 { margin: 0; font-size: 1.15rem; }
.ica-action-card p { margin: 0; color: var(--ica-muted); font-size: 0.92rem; flex-grow: 1; }
.ica-action-card .ica-btn { align-self: flex-start; }
.ica-action-card__sub {
  font-size: 0.85rem;
  color: var(--ica-link);
  text-decoration: none;
}
.ica-action-card__sub:hover { color: var(--ica-link-hover); }
.ica-shop-home__back { text-align: center; }

/* ---------- Voting (vote.il-chess.org) ---------- */

.ica-ballot { max-width: 720px; margin: 0 auto; }
.ica-ballot > .ica-card,
.ica-ballot__form > .ica-card { margin-bottom: 20px; }
.ica-ballot__done { max-width: 640px; }

.ica-ballot__kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ica-red);
  margin-bottom: 6px;
}
.ica-ballot__closes { color: var(--ica-muted); }
.ica-ballot__message {
  border-left: 3px solid var(--ica-rule);
  padding: 4px 0 4px 14px;
  margin-bottom: 1em;
}
.ica-ballot__note { font-size: 0.9rem; color: var(--ica-muted); margin-bottom: 0; }

.ica-ballot__alert {
  background: #F7E2E6;
  color: var(--ica-danger);
  border-radius: var(--ica-radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-weight: 600;
}

/* fieldset reset — it's an .ica-card visually */
fieldset.ica-ballot__position { margin: 0 0 20px; min-width: 0; }
.ica-ballot__position.is-invalid { border-color: var(--ica-danger); box-shadow: 0 0 0 1px var(--ica-danger); }
.ica-ballot__title {
  font-family: var(--ica-font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ica-ink-strong);
  padding: 0;
  float: left; /* lets the legend sit inside the card's padding like a heading */
  width: 100%;
  margin-bottom: 4px;
}
.ica-ballot__title + * { clear: both; }
.ica-ballot__rule { color: var(--ica-muted); font-size: 0.92rem; margin-bottom: 12px; }
.ica-ballot__count { margin-left: 8px; font-weight: 600; color: var(--ica-ink); }
.ica-ballot__count.is-over { color: var(--ica-danger); }
.ica-ballot__instructions { font-size: 0.92rem; }
.ica-ballot__error { color: var(--ica-danger); font-weight: 600; }

.ica-ballot__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 1.02rem;
}
.ica-ballot__option:hover { background: var(--ica-panel); }
.ica-ballot__option:has(input:checked) { border-color: var(--ica-navy); background: #EEF2F8; }
.ica-ballot__option input[type=radio],
.ica-ballot__option input[type=checkbox] {
  width: 20px;
  height: 20px;
  flex: none;
  margin: 0;
  accent-color: var(--ica-navy);
}
.ica-ballot__option--write-in > span { flex: none; color: var(--ica-muted); }
.ica-ballot__option input[type=text] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  font-family: var(--ica-font-sans);
  font-size: 0.98rem;
}
.ica-ballot__option input[type=text]:focus { outline: 2px solid var(--ica-link); outline-offset: 1px; }
.ica-ballot__option--skip { color: var(--ica-muted); font-size: 0.95rem; }

.ica-ballot__actions { text-align: right; }
.ica-ballot__actions--split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.ica-ballot__review th { width: 40%; text-transform: none; font-size: 0.95rem; letter-spacing: 0; color: var(--ica-ink-strong); }
.ica-ballot__blank { color: var(--ica-muted); font-style: italic; }
.ica-ballot__subhead { font-size: 1.2rem; margin-top: 1.5em; }
.ica-ballot__results-list { padding-left: 1.2em; }

.ica-results { margin-bottom: 20px; }
.ica-results__title { font-size: 1.3rem; }
.ica-results__seats { font-family: var(--ica-font-sans); font-size: 0.85rem; font-weight: 400; color: var(--ica-muted); margin-left: 6px; }
.ica-results__tie { color: var(--ica-warn); font-weight: 600; font-size: 0.92rem; }
.ica-results__num { text-align: right !important; width: 5em; font-variant-numeric: tabular-nums; }
.ica-results__bar-col { width: 40%; white-space: nowrap; }
.ica-results__bar {
  display: inline-block;
  vertical-align: middle;
  width: calc(100% - 4.5em);
  height: 10px;
  background: var(--ica-rule-soft);
  border-radius: 999px;
  overflow: hidden;
}
.ica-results__bar > span { display: block; height: 100%; background: var(--ica-navy); }
.ica-results__pct { display: inline-block; width: 4em; text-align: right; font-size: 0.85rem; color: var(--ica-muted); font-variant-numeric: tabular-nums; }
.ica-results__blank td { color: var(--ica-muted); font-style: italic; }

@media (max-width: 560px) {
  .ica-card { padding: 20px 16px; }
  .ica-results__bar-col { display: none; }
}
.ica-results__elected { font-weight: 600; color: var(--ica-ink-strong); }
.ica-results td .ica-badge { margin-left: 6px; vertical-align: 1px; }

/* Sticky footer: on short pages (thank-you, ballot status, empty results)
   the footer sits at the bottom of the window rather than right under the
   content. width:100% keeps .ica-app-main full width — in a flex column its
   auto side margins would otherwise shrink it to fit its content. */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > .ica-app-main { flex: 1 0 auto; width: 100%; }
body > .ica-app-header, body > .ica-app-footer { flex-shrink: 0; }

/* Honeypot field on shop forms (App\Libraries\ShopGuard) — off-screen, not display:none, so simple bots still fill it. */
.ica-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* "New member / renewing" choice on the join forms. */
.ica-choice { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.ica-choice label { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; margin: 0; }
.ica-choice input[type="radio"] { width: auto; accent-color: var(--ica-navy); }
.ica-help { margin: 6px 0 0; font-size: 0.85rem; color: var(--ica-muted); }

/* Family membership form (shop/family/index.php): one card per person. */
.ica-person {
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  padding: 16px 16px 2px;
  margin-bottom: 16px;
  background: var(--ica-paper);
}
.ica-person__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ica-person__title { font-weight: 600; color: var(--ica-ink-strong); margin: 0; font-size: 1rem; }
.ica-link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ica-link);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}
.ica-family-total {
  background: var(--ica-panel);
  border: 1px solid var(--ica-rule);
  border-radius: var(--ica-radius);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.ica-family-total p { margin: 0; }
.ica-family-total p + p { margin-top: 6px; font-size: 0.88rem; color: var(--ica-muted); }
.ica-section-title { font-size: 1.1rem; margin: 26px 0 12px; }
