/* Capital Choice Award - public voting page */
:root {
  --black: #070707;
  --ink: #0d0d0f;
  --surface: #131316;
  --surface-2: #1a1a1f;
  --line: rgba(212, 175, 55, .22);
  --line-soft: rgba(255, 255, 255, .08);
  --gold: #d4af37;
  --gold-light: #f1d98f;
  --gold-deep: #a5801c;
  --gold-grad: linear-gradient(135deg, #f3dc95 0%, #d4af37 48%, #a5801c 100%);
  --ivory: #f6f1e6;
  --muted: #a19d90;
  --danger: #ef6b6b;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--black);
  color: var(--ivory);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { position: absolute; inset: 0 0 auto 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.wordmark {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--display); font-size: 1.1rem; font-weight: 500;
  color: var(--ivory); text-decoration: none; letter-spacing: .01em;
}
.wordmark-mark {
  width: 12px; height: 12px; transform: rotate(45deg);
  background: var(--gold-grad); border-radius: 2px;
}
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 600; color: var(--gold-light);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  background: rgba(255, 255, 255, .02);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(212, 175, 55, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(212, 175, 55, 0); } 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 150px 0 84px;
  text-align: center;
  background:
    radial-gradient(60% 90% at 50% -10%, rgba(212, 175, 55, .20), transparent 70%),
    var(--black);
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .55;
}
.hero h1 {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(2.7rem, 7.5vw, 5.2rem); line-height: 1.02; letter-spacing: -.02em;
  max-width: 14ch; margin: 0 auto;
}
.hero-sub { color: var(--muted); font-size: 1.08rem; max-width: 52ch; margin: 22px auto 0; }
.hero-stats {
  display: inline-flex; margin-top: 44px;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255, 255, 255, .02);
}
.hero-stats div { padding: 16px 34px; text-align: center; }
.hero-stats div + div { border-left: 1px solid var(--line); }
.hero-stats dt { font-size: .76rem; color: var(--muted); font-weight: 600; }
.hero-stats dd { font-family: var(--display); font-size: 1.7rem; font-weight: 500; color: var(--gold-light); font-variant-numeric: tabular-nums; }

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7, 7, 7, .86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.toolbar-inner { display: flex; align-items: center; gap: 20px; padding: 14px 0; }
.search {
  display: flex; align-items: center; gap: 10px; flex: 0 1 340px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 0 14px; color: var(--muted); transition: border-color .15s;
}
.search:focus-within { border-color: var(--gold); color: var(--gold); }
.search input {
  width: 100%; background: none; border: 0; outline: 0; color: var(--ivory);
  font: inherit; font-size: .95rem; padding: 12px 0;
}
.search input::placeholder { color: #75726a; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--ivory);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 9px 16px; font-size: .86rem; font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}
.chip span { font-size: .74rem; color: var(--muted); font-weight: 600; }
.chip:hover { border-color: var(--line); }
.chip.is-active { background: var(--gold-grad); border-color: transparent; color: #140f00; }
.chip.is-active span { color: rgba(20, 15, 0, .7); }

/* ---------- Grid ---------- */
.main { padding-top: 34px; padding-bottom: 90px; min-height: 60vh; }
.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: .88rem; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--gold); font-weight: 700; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; }

.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--line); box-shadow: 0 22px 44px rgba(0, 0, 0, .5); }
.card[hidden] { display: none; }
.card-media {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0;
  background: linear-gradient(160deg, #1f1d16, #0e0e10);
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(to top, rgba(19, 19, 22, .95), transparent); pointer-events: none; }
.initials {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-size: 3rem; color: var(--gold); opacity: .8;
}
.code {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  background: rgba(0, 0, 0, .65); border: 1px solid var(--line); color: var(--gold-light);
  font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card-cat { font-size: .76rem; color: var(--gold); font-weight: 600; margin-bottom: 2px; }
.card h3 { font-family: var(--display); font-weight: 500; font-size: 1.22rem; line-height: 1.25; }
.card-votes { margin: 8px 0 16px; color: var(--muted); font-size: .85rem; }
.vote-count { font-family: var(--display); font-weight: 500; font-size: 1.55rem; color: var(--gold-light); margin-right: 4px; font-variant-numeric: tabular-nums; }
.vote-count.bump { animation: bump .9s ease; }
@keyframes bump { 0% { color: #fff; transform: scale(1.15); } 100% { color: var(--gold-light); transform: scale(1); } }

/* ---------- Buttons ---------- */
.btn-gold {
  margin-top: auto; width: 100%;
  background: var(--gold-grad); color: #140f00; border: 0; border-radius: 12px;
  padding: 13px 18px; font-weight: 800; font-size: .95rem; letter-spacing: .01em;
  transition: filter .15s, transform .1s;
}
.btn-gold:hover { filter: brightness(1.08); }
.btn-gold:active { transform: scale(.985); }
.btn-gold:disabled { filter: grayscale(.6) brightness(.7); cursor: wait; }
.btn-lg { padding: 16px 20px; font-size: 1rem; }
.btn-outline {
  background: transparent; color: var(--gold-light); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 22px; font-weight: 700; margin-top: 18px;
}
.btn-outline:hover { border-color: var(--gold); }

.empty { text-align: center; padding: 90px 20px; color: var(--muted); }
.empty h2 { font-family: var(--display); font-weight: 500; font-size: 1.6rem; color: var(--ivory); margin-bottom: 8px; }
.empty[hidden] { display: none; }

.site-footer { border-top: 1px solid var(--line-soft); padding: 28px 0; color: #77746b; font-size: .82rem; text-align: center; }

/* ---------- Dialog ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0, 0, 0, .74); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.dialog {
  position: relative; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 28px 26px 24px; transform: translateY(14px); transition: transform .25s ease;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
}
.overlay.is-open .dialog { transform: none; }
.dlg-close { position: absolute; top: 14px; right: 14px; background: none; border: 0; color: var(--muted); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.dlg-close:hover { color: var(--ivory); background: var(--surface-2); }
.dlg-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; padding-right: 30px; }
.dlg-thumb {
  flex: 0 0 58px; width: 58px; height: 58px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(160deg, #26231a, #0e0e10); border: 1px solid var(--line);
  display: grid; place-items: center; font-family: var(--display); color: var(--gold);
}
.dlg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dlg-head h2 { font-family: var(--display); font-weight: 500; font-size: 1.35rem; line-height: 1.2; }
.dlg-head p { font-size: .84rem; }

#voteForm label, #voteForm .label { display: block; font-size: .8rem; font-weight: 700; color: var(--ivory); margin: 16px 0 8px; }
#voteForm label:first-child { margin-top: 0; }
#voteForm input {
  width: 100%; background: var(--ink); border: 1px solid var(--line-soft); border-radius: 12px;
  color: var(--ivory); font: inherit; font-size: .98rem; padding: 13px 14px;
}
#voteForm input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .16); }
#voteForm input::placeholder { color: #6f6c64; }
.quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 10px; }
.quick button {
  background: var(--ink); color: var(--ivory); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 11px 0; font-weight: 700; font-size: .9rem;
}
.quick button:hover { border-color: var(--line); }
.quick button.is-active { border-color: var(--gold); background: rgba(212, 175, 55, .12); color: var(--gold-light); }
.total {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 0 6px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .92rem;
}
.total strong { font-family: var(--display); font-weight: 500; font-size: 1.7rem; color: var(--gold-light); }
.form-error { background: rgba(239, 107, 107, .1); border: 1px solid rgba(239, 107, 107, .3); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: .85rem; margin: 12px 0 0; }
.form-error[hidden] { display: none; }
#voteForm .btn-gold { margin-top: 16px; }
.secure { text-align: center; color: #77746b; font-size: .76rem; margin-top: 12px; }

#doneView { text-align: center; padding: 10px 0 0; }
#doneView[hidden], #voteView[hidden] { display: none; }
#doneView h2 { font-family: var(--display); font-weight: 500; font-size: 1.8rem; margin: 14px 0 6px; }
#doneView .btn-gold { margin-top: 24px; }
.check { width: 84px; height: 84px; color: var(--gold); }
.check circle, .check path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#doneView:not([hidden]) .check circle { animation: draw .6s ease forwards; }
#doneView:not([hidden]) .check path { animation: draw .45s .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .toolbar-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .search { flex: none; }
}
@media (max-width: 768px) {
  .wrap { width: min(1200px, 100% - 28px); }
  .hero { padding: 120px 0 60px; }
  .hero-stats div { padding: 14px 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card { border-radius: 14px; }
  .card-body { padding: 12px 12px 14px; }
  .card h3 { font-size: 1rem; }
  .vote-count { font-size: 1.25rem; }
  .btn-gold { padding: 11px; font-size: .88rem; }
  .live-pill { display: none; }
}
@media (max-width: 560px) {
  .overlay { align-items: flex-end; padding: 0; }
  .dialog { max-width: none; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(40px); }
  .quick { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .check circle, .check path { stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}
