/* Guess Who? Career Politician Edition — Texans for Terms styling */

.gwcp {
  --gwcp-navy: #002868;
  --gwcp-navy-dk: #001B47;
  --gwcp-red: #BF0A30;
  --gwcp-cream: #FFFFFF;
  --gwcp-section: transparent;
  --gwcp-sand: #F6F4EF;
  --gwcp-ink: #14181F;
  --gwcp-text: #333A45;
  --gwcp-muted: #6B7280;
  --gwcp-line: #E6E1D6;
  --gwcp-party-r: #BF0A30;
  --gwcp-party-d: #1F4E9C;
  --gwcp-party-i: #6B5B95;
  --gwcp-radius: 6px;
  --gwcp-gap: 20px;
  --gwcp-cols: 4;
  --gwcp-min: 230px;
  --gwcp-display: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  max-width: var(--gwcp-max, 1240px);
  margin-left: auto; margin-right: auto;
  background: var(--gwcp-section);
  color: var(--gwcp-text);
  font-size: 16px;
  line-height: 1.5;
}
.gwcp *, .gwcp *::before, .gwcp *::after { box-sizing: border-box; }
@media (max-width: 1024px) { .gwcp { --gwcp-cols: 3; --gwcp-min: 220px; } }
@media (max-width: 767px)  { .gwcp { --gwcp-cols: 2; --gwcp-gap: 12px; --gwcp-min: 150px; } }

/* ---------------- Heading ---------------- */

.gwcp-head { text-align: center; max-width: 760px; margin: 0 auto 28px; }
.gwcp .gwcp-eyebrow {
  margin: 0 0 8px; font-family: var(--gwcp-display); font-weight: 600; font-size: .82rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--gwcp-red);
}
.gwcp .gwcp-title { margin: 0 0 14px; font-family: var(--gwcp-display); font-weight: 700; text-transform: uppercase; line-height: 1; letter-spacing: .01em; }
.gwcp .gwcp-title-main { display: block; font-size: clamp(2.6rem, 1.6rem + 4vw, 4.75rem); color: var(--gwcp-navy); }
.gwcp .gwcp-title-sub { display: block; margin-top: 6px; font-size: clamp(1.4rem, 1rem + 1.8vw, 2.4rem); color: var(--gwcp-red); letter-spacing: .04em; }
.gwcp .gwcp-intro { margin: 0 auto; max-width: 640px; color: var(--gwcp-text); font-size: 1.02rem; }

/* ---------------- Toolbar ---------------- */

.gwcp-toolbar {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "text actions" "bar bar";
  gap: 10px 16px; align-items: center; margin: 0 0 22px; padding: 14px 18px;
  background: var(--gwcp-sand); border-radius: var(--gwcp-radius);
}
.gwcp .gwcp-progress { grid-area: text; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-size: .95rem; }
.gwcp-progress b { font-family: var(--gwcp-display); font-weight: 700; color: var(--gwcp-navy); font-size: 1.15rem; }
.gwcp-score { font-family: var(--gwcp-display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; color: var(--gwcp-red); }
.gwcp-progress-bar { grid-area: bar; height: 6px; border-radius: 99px; background: rgba(0, 40, 104, .12); overflow: hidden; }
.gwcp-progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gwcp-navy), var(--gwcp-red)); transition: width .4s ease; }
.gwcp-actions { grid-area: actions; display: flex; gap: 8px; }
.gwcp .gwcp-btn {
  appearance: none; margin: 0; padding: 8px 14px; min-height: 0; border: 1.5px solid rgba(0, 40, 104, .35); border-radius: var(--gwcp-radius);
  background: #fff; color: var(--gwcp-navy); font-family: var(--gwcp-display); font-weight: 600; font-size: .82rem; letter-spacing: .1em;
  text-transform: uppercase; line-height: 1.2; cursor: pointer; box-shadow: none; transition: background .15s, color .15s, border-color .15s;
}
.gwcp .gwcp-btn:hover { background: var(--gwcp-navy); border-color: var(--gwcp-navy); color: #fff; }
.gwcp .gwcp-btn:focus-visible { outline: 3px solid rgba(0, 40, 104, .35); outline-offset: 2px; }
.gwcp.is-complete .gwcp-progress-text::after { content: " \2014  all done"; color: var(--gwcp-red); font-weight: 600; }

/* ---------------- Grid + flip mechanics ---------------- */

.gwcp .gwcp-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--gwcp-gap);
  /* Up to --gwcp-cols columns, but never narrower than --gwcp-min (drops columns in narrow containers). */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--gwcp-min), calc((100% - (var(--gwcp-cols) - 1) * var(--gwcp-gap)) / var(--gwcp-cols)))), 1fr));
}
.gwcp .gwcp-cell { margin: 0; padding: 0; list-style: none; display: flex; }
.gwcp .gwcp-cell::before, .gwcp .gwcp-cell::marker { content: none; }

.gwcp-card { position: relative; flex: 1; perspective: 1400px; border-radius: var(--gwcp-radius); }
.gwcp-inner {
  display: grid; height: 100%; transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.3, .7, .2, 1);
}
.gwcp-card.is-flipped .gwcp-inner { transform: rotateY(180deg); }
.gwcp-face {
  grid-area: 1 / 1; position: relative; display: flex; flex-direction: column; min-width: 0;
  border-radius: var(--gwcp-radius); overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 10px 24px -14px rgba(0, 27, 71, .35);
  transition: box-shadow .2s ease, transform .2s ease;
}
.gwcp-front { transform: rotateY(0deg); }
.gwcp-back { transform: rotateY(180deg); }
/* Some mobile browsers (notably iOS Safari) ignore backface-visibility on layered content,
   so the hidden face is also switched off halfway through the flip, when it is edge-on. */
.gwcp-front, .gwcp-back { transition: box-shadow .2s ease, transform .2s ease, visibility 0s linear .3s; }
.gwcp-back { visibility: hidden; }
.gwcp-card.is-flipped .gwcp-back { visibility: visible; }
.gwcp-card.is-flipped .gwcp-front { visibility: hidden; }
.gwcp-face * { -webkit-backface-visibility: hidden; backface-visibility: hidden; }

.gwcp .gwcp-flip {
  position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: var(--gwcp-radius);
  background: transparent; cursor: pointer; box-shadow: none; min-height: 0;
}
.gwcp .gwcp-flip:hover, .gwcp .gwcp-flip:focus { background: transparent; }
.gwcp .gwcp-flip:focus-visible { outline: 3px solid var(--gwcp-red); outline-offset: 3px; }
@media (hover: hover) { .gwcp-card:not(.is-flipped):hover .gwcp-front { box-shadow: 0 2px 4px rgba(20, 24, 31, .06), 0 18px 30px -14px rgba(0, 27, 71, .45); transform: translateY(-3px); } }
.gwcp-card.is-guessing .gwcp-flip { display: none; }

/* ---------------- Card backgrounds (washed-out flag / Capitol) ---------------- */

.gwcp { --gwcp-bg-opacity: .14; --gwcp-bg-back-opacity: .14; }
.gwcp-front > *, .gwcp-back-body > * { position: relative; z-index: 1; }
.gwcp-back-body { position: relative; overflow: hidden; }
.gwcp--bg-flag .gwcp-front::before, .gwcp--bg-capitol .gwcp-front::before,
.gwcp--bg-capitol .gwcp-back-body::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-repeat: no-repeat; opacity: var(--gwcp-bg-opacity);
}
.gwcp--bg-flag .gwcp-front::before {
  background-image: url("../img/texas-flag-star.svg"), url("../img/texas-flag-card.svg");
  background-size: 40% auto, 100% 100%; background-position: 13.9% 50%, 0 0;
}
.gwcp--bg-capitol .gwcp-front::before, .gwcp--bg-capitol .gwcp-back-body::before {
  background-image: url("../img/texas-capitol-bg.jpg"); background-size: cover; background-position: center 30%;
}
.gwcp--bg-capitol .gwcp-back-body::before { opacity: var(--gwcp-bg-back-opacity); mix-blend-mode: screen; }
.gwcp--bg-capitol .gwcp-back-body::before { background-position: center 25%; filter: grayscale(1); }
.gwcp--bg-flag .gwcp-hint, .gwcp--bg-capitol .gwcp-hint { background: color-mix(in srgb, var(--gwcp-sand) 82%, transparent); }
.gwcp .gwcp-bg-credit { margin: 10px auto 0; text-align: center; font-size: .72rem; color: var(--gwcp-muted); }

/* ---------------- Front ---------------- */

.gwcp-front { background: var(--gwcp-cream); border-top: 5px solid var(--gwcp-red); }
.gwcp-front-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 20px; background: var(--gwcp-navy); color: #fff;
}
.gwcp-q { font-family: var(--gwcp-display); font-weight: 700; font-size: 1.45rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; }
.gwcp-num { font-family: var(--gwcp-display); font-weight: 500; font-size: .9rem; letter-spacing: .14em; text-transform: uppercase; opacity: .75; white-space: nowrap; }

.gwcp .gwcp-stats { margin: 0; padding: 8px 20px 6px; flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.gwcp-stat { padding: 10px 0; border-bottom: 1px solid var(--gwcp-line); }
.gwcp-stat:last-child { border-bottom: 0; }
.gwcp .gwcp-stats dt {
  margin: 0 0 3px; font-family: var(--gwcp-display); font-weight: 600; font-size: .86rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gwcp-muted);
}
.gwcp .gwcp-stats dd { margin: 0; font-weight: 600; color: var(--gwcp-ink); font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
.gwcp-big { font-family: var(--gwcp-display); font-weight: 700; font-size: 2.4rem; line-height: 1.05; color: var(--gwcp-navy); letter-spacing: .01em; }
.gwcp-stat-years .gwcp-big { color: var(--gwcp-red); }
.gwcp-sub { display: block; margin-top: 3px; font-weight: 500; font-size: .95rem; color: var(--gwcp-muted); }

.gwcp-party { display: inline-flex; align-items: center; gap: 7px; }
.gwcp-party::before { content: ""; width: 13px; height: 13px; border-radius: 50%; background: var(--gwcp-party-i); flex: none; }
.gwcp-party.is-r::before { background: var(--gwcp-party-r); }
.gwcp-party.is-d::before { background: var(--gwcp-party-d); }

.gwcp-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px 12px; margin-top: auto;
  font-family: var(--gwcp-display); font-weight: 600; font-size: .9rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gwcp-navy);
  background: var(--gwcp-sand);
}
.gwcp-hint svg { flex: none; transition: transform .4s ease; }
@media (hover: hover) { .gwcp-card:hover .gwcp-hint svg { transform: rotate(-180deg); } }

/* ---------------- Multiple-choice overlay ---------------- */

.gwcp-guess {
  position: absolute; inset: 0; top: 0; z-index: 4; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 18px 14px; background: var(--gwcp-cream); text-align: center;
  animation: gwcp-fade .2s ease;
}
.gwcp-guess[hidden] { display: none; }
.gwcp .gwcp-guess-q { margin: 0 0 4px; font-family: var(--gwcp-display); font-weight: 700; font-size: 1.5rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gwcp-navy); }
.gwcp-guess-opts { display: flex; flex-direction: column; gap: 8px; }
.gwcp .gwcp-opt {
  appearance: none; margin: 0; padding: 12px 14px; min-height: 0; border: 1.5px solid rgba(0, 40, 104, .25); border-radius: var(--gwcp-radius);
  background: #fff; color: var(--gwcp-ink); font: inherit; font-weight: 600; font-size: 1.1rem; line-height: 1.25; cursor: pointer; box-shadow: none;
  transition: background .15s, border-color .15s, color .15s;
}
.gwcp .gwcp-opt:hover, .gwcp .gwcp-opt:focus-visible { background: var(--gwcp-navy); border-color: var(--gwcp-navy); color: #fff; outline: none; }
.gwcp .gwcp-skip {
  appearance: none; margin: 4px auto 0; padding: 4px 8px; min-height: 0; border: 0; background: none; box-shadow: none; cursor: pointer;
  color: var(--gwcp-muted); font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px;
}
.gwcp .gwcp-skip:hover { color: var(--gwcp-red); background: none; }

/* ---------------- Back ---------------- */

.gwcp-back { background: var(--gwcp-navy-dk); color: #fff; border-top: 5px solid var(--gwcp-red); }
.gwcp-photo { position: relative; aspect-ratio: 4 / 5; background: linear-gradient(160deg, var(--gwcp-navy), var(--gwcp-navy-dk)); overflow: hidden; flex: none; }
.gwcp .gwcp-photo img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 20%; margin: 0; border-radius: 0; }
.gwcp-initials {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--gwcp-display); font-weight: 700; font-size: 3.4rem; letter-spacing: .04em; color: rgba(255, 255, 255, .9);
}
.gwcp-result {
  position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 99px;
  font-family: var(--gwcp-display); font-weight: 600; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
}
.gwcp-result[hidden] { display: none; }
.gwcp-result.is-right { background: #1E7A46; }
.gwcp-result.is-wrong { background: var(--gwcp-red); }
.gwcp-back-body { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.gwcp .gwcp-name { margin: 0; font-family: var(--gwcp-display); font-weight: 700; font-size: 1.95rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; color: #fff; }
.gwcp .gwcp-aka { margin: 0; font-size: .95rem; font-style: italic; color: rgba(255, 255, 255, .7); }
.gwcp .gwcp-role { margin: 0; font-size: 1.15rem; line-height: 1.35; color: rgba(255, 255, 255, .85); }
.gwcp .gwcp-credit { margin: auto 0 0; padding-top: 12px; font-size: .72rem; line-height: 1.35; color: rgba(255, 255, 255, .55); }

/* ---------------- Combined years callout ---------------- */

.gwcp .gwcp-total {
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
  margin: 22px auto 0; padding: 16px 26px; max-width: 760px;
  background: var(--gwcp-navy); color: #fff; border-radius: var(--gwcp-radius); border-bottom: 5px solid var(--gwcp-red);
  font-size: 1.2rem; font-weight: 600; line-height: 1.35; text-align: center;
  box-shadow: 0 14px 28px -16px rgba(0, 27, 71, .6);
}
.gwcp-total b {
  display: inline-block; padding: 2px 14px; border-radius: var(--gwcp-radius); background: var(--gwcp-red); color: #fff;
  font-family: var(--gwcp-display); font-weight: 700; font-size: 2.3rem; line-height: 1.1; letter-spacing: .02em;
}

/* ---------------- Small screens ---------------- */

@media (max-width: 767px) {
  .gwcp .gwcp-total { font-size: 1rem; padding: 14px 16px; }
  .gwcp-total b { font-size: 1.8rem; }
  .gwcp-toolbar { grid-template-columns: 1fr; grid-template-areas: "text" "bar" "actions"; }
  .gwcp-actions .gwcp-btn { flex: 1; }
  .gwcp-front-top { padding: 10px 12px; }
  .gwcp-q { font-size: 1.05rem; }
  .gwcp-num { font-size: .68rem; letter-spacing: .08em; }
  .gwcp .gwcp-stats { padding: 2px 12px; }
  .gwcp-stat { padding: 8px 0; }
  .gwcp .gwcp-stats dt { font-size: .7rem; letter-spacing: .1em; }
  .gwcp .gwcp-stats dd { font-size: .98rem; }
  .gwcp-big { font-size: 1.7rem; }
  .gwcp-sub { font-size: .78rem; }
  .gwcp-hint { font-size: .72rem; letter-spacing: .08em; }
  .gwcp-back-body { padding: 10px 12px 12px; }
  .gwcp .gwcp-name { font-size: 1.25rem; }
  .gwcp .gwcp-role { font-size: .9rem; }
  .gwcp .gwcp-opt { font-size: .92rem; padding: 9px 8px; }
  .gwcp .gwcp-aka { font-size: .8rem; }
  .gwcp .gwcp-guess-q { font-size: 1.15rem; }
  .gwcp-guess { padding: 12px 10px; }
}

/* ---------------- Motion / print ---------------- */

@keyframes gwcp-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .gwcp-inner { transition: none; transform: none !important; }
  .gwcp-face { transition: opacity .2s ease, visibility 0s linear .2s; transform: none !important; }
  .gwcp-back { opacity: 0; }
  .gwcp-card.is-flipped .gwcp-back { opacity: 1; }
  .gwcp-card.is-flipped .gwcp-front { opacity: 0; }
  .gwcp-cell { transition: none !important; transform: none !important; }
}

@media print {
  .gwcp-toolbar, .gwcp-hint, .gwcp-flip { display: none !important; }
  .gwcp-inner { transform: none !important; }
  .gwcp-back { transform: none; }
  .gwcp-face { box-shadow: none; border: 1px solid #ccc; }
  .gwcp-card .gwcp-back { display: none; }
}
