/* ============================================
   SANGS Grading Competition
   (with the South African Coin Collectors Club)
   ============================================ */

/* ── Form card surface (mirrors submit.css; the competition page does
       not load submit.css to avoid pulling in unrelated styles). ──── */
.form-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-glass);
}
.form-card-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  line-height: 1.3;
}
.form-card-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  /* Generous gap below the description so the next form group / coins
     grid never feels crammed. The previous 32px landed too tight. */
  margin-bottom: var(--space-2xl);
}
.form-card-desc:last-child { margin-bottom: 0; }

/* ── Hero co-branding ────────────────────────────────────────────── */
.comp-hero {
  /* Fixed site-header is ~156px tall (logo 120px + 36px padding), so
     the previous 150px tucked the cobrand logos under it. Add room
     for the cobrand row itself plus breathing space. */
  padding-top: 220px;
}
.comp-hero-cobrand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  opacity: 0.95;
}
.comp-hero-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  min-width: 80px;
  padding: 8px 16px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-normal) var(--ease), box-shadow var(--duration-normal) var(--ease);
}
a.comp-hero-logo-wrap:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glass-hover);
}
.comp-hero-logo-wrap img {
  max-height: 40px;
  width: auto;
  display: block;
}
.comp-hero-logo-wrap.comp-hero-logo-fallback {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold-text);
  padding: 0 24px;
}
.comp-hero-x {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

/* ── Prize callouts ──────────────────────────────────────────────── */
.comp-prizes-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}
.comp-prize {
  /* Block-level flex with auto margins so the strip stays centred and
     never floats up next to the sponsor strip on wide viewports. */
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin: 0 auto;
  padding: 20px 28px;
  width: fit-content;
  max-width: min(580px, 100%);
  text-align: left;
  background: linear-gradient(135deg, rgba(202, 138, 4, 0.10) 0%, rgba(161, 98, 7, 0.08) 100%);
  border: 1px solid rgba(202, 138, 4, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-gold-glow);
}
.comp-prize[hidden] { display: none; }
.comp-prize-bonus {
  background: var(--glass-bg-strong);
  border: 1px dashed rgba(202, 138, 4, 0.45);
  box-shadow: var(--shadow-sm);
}
.comp-prize-bonus svg { color: var(--gold-text); }
.comp-prize-label-bonus {
  color: var(--gold-text);
}
.comp-prize-text-bonus {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.55;
}
.comp-prize svg {
  flex-shrink: 0;
  width: 32px; height: 32px;
  color: var(--old-gold);
  margin-top: 2px;
}
.comp-prize-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 4px;
}
.comp-prize-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.4;
  margin: 0;
}

/* ── Sponsor strip ───────────────────────────────────────────────── */
.comp-sponsor-strip {
  /* Block-level flex (not inline-flex) + width: fit-content keeps the
     strip on its own row and centred under the prize callout. */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) auto 0;
  padding: 14px 24px;
  width: fit-content;
  max-width: 100%;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.comp-sponsor-strip[hidden] { display: none; }
.comp-sponsor-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.comp-sponsor-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.comp-sponsor-mark a,
.comp-sponsor-mark .comp-sponsor-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--charcoal);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  transition: opacity var(--duration-fast) var(--ease);
}
.comp-sponsor-mark a:hover { opacity: 0.7; }
.comp-sponsor-mark img {
  height: 44px;
  width: auto;
  max-width: 220px;
  display: block;
}
/* When only text (no logo) is shown, give it a touch of gold */
.comp-sponsor-mark .comp-sponsor-text-only {
  color: var(--gold-text);
}

/* ── Status pills ────────────────────────────────────────────────── */
.comp-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.comp-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 24px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  min-width: 160px;
}
.comp-pill[hidden] { display: none; }
.comp-pill-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.comp-pill-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.comp-pill-countdown .comp-pill-value { color: var(--old-gold); }

/* ── Section ─────────────────────────────────────────────────────── */
.comp-section {
  padding-top: 60px;
  padding-bottom: 100px;
}

/* ── Banner ──────────────────────────────────────────────────────── */
.comp-banner {
  margin-bottom: var(--space-xl);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  text-align: center;
}
.comp-banner.error {
  background: var(--color-error-light);
  color: var(--color-error);
  border: 1px solid var(--color-error-border);
}
.comp-banner.success {
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}
.comp-banner.info {
  background: var(--color-info-light);
  color: var(--color-info);
  border: 1px solid var(--color-info-border);
}

/* ── Coins grid (form + preview share layout) ────────────────────── */
.comp-coins-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}
/* Inside the entry form's "Your Grades" card, push the first coin
   card down a notch so the description above it has breathing room. */
.form-card .comp-coins-grid { margin-top: var(--space-md); }
.comp-coin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal) var(--ease), border-color var(--duration-normal) var(--ease);
}
.comp-coin-card:hover {
  border-color: rgba(202, 138, 4, 0.25);
  box-shadow: var(--shadow-md);
}

.comp-coin-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}
.comp-coin-number {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.comp-coin-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: 4px 0 0;
}
.comp-coin-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.comp-coin-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.comp-coin-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--sand);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color var(--duration-normal) var(--ease);
}
.comp-coin-img-wrap:hover { border-color: var(--gold); }
.comp-coin-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform var(--duration-slow) var(--ease);
}
.comp-coin-img-wrap:hover img { transform: scale(1.04); }
.comp-coin-img-wrap.comp-img-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: var(--space-md);
}
.comp-coin-img-wrap.comp-img-missing img { display: none; }
.comp-coin-img-wrap.comp-img-missing::before {
  content: 'Image coming soon';
}

.comp-coin-img-label {
  position: absolute;
  bottom: 8px; left: 8px;
  padding: 3px 10px;
  background: rgba(28, 25, 23, 0.85);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  pointer-events: none;
}

/* ── Grade input per coin ────────────────────────────────────────── */
.comp-coin-grade {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.comp-coin-grade-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}
.comp-coin-grade input {
  flex: 1;
  min-width: 180px;
  padding: 14px 18px;
  background: var(--white);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--charcoal);
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  transition: all var(--duration-normal) var(--ease);
}
.comp-coin-grade input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0.65;
}
.comp-coin-grade input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(202, 138, 4, 0.15);
}
.comp-coin-grade input.error {
  border-color: var(--color-error);
  background: var(--color-error-light);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}
.comp-coin-grade input.is-valid {
  border-color: var(--color-success);
  background: rgba(22, 163, 74, 0.04);
}
.comp-coin-grade-hint {
  flex-basis: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}
.comp-coin-grade-hint.error {
  color: var(--color-error);
  font-weight: 600;
}
.comp-coin-grade-hint.error::before {
  content: '';
  flex-shrink: 0;
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23DC2626' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.comp-coin-grade-hint.success { color: var(--color-success); font-weight: 600; }
.comp-coin-grade-hint.success::before {
  content: '';
  flex-shrink: 0;
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316A34A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.comp-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 6px;
  background: rgba(202, 138, 4, 0.1);
  border-radius: var(--radius-sm);
  color: var(--gold-text);
}

/* Read-only display when shown after submission */
.comp-coin-grade-readout {
  display: inline-block;
  padding: 6px 18px;
  background: rgba(202, 138, 4, 0.1);
  color: var(--gold-text);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--radius-md);
}

/* ── Gate / pre-open / closed state cards ────────────────────────── */
.comp-gate-card,
.comp-thanks-card,
.comp-loading-card {
  text-align: center;
  max-width: 580px;
  margin: 0 auto var(--space-2xl);
}
.comp-gate-icon,
.comp-thanks-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  background: rgba(202, 138, 4, 0.1);
  color: var(--old-gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.comp-gate-icon svg,
.comp-thanks-icon svg {
  width: 30px; height: 30px;
}
.comp-thanks-icon {
  background: rgba(22, 163, 74, 0.12);
  color: var(--color-success);
}

.comp-gate-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}
.comp-gate-hint {
  margin-top: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.comp-opens-at {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--gold-text);
  margin-top: var(--space-md);
}

.comp-thanks-prize {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--gold-text);
  margin: var(--space-md) 0 var(--space-lg);
}
/* ── Bonus-draw qualification status (entry form + thanks state) ──── */
.comp-voucher-status {
  margin: 0 auto var(--space-lg);
  padding: 16px 22px;
  max-width: 640px;
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.55;
}
.comp-voucher-status[hidden] { display: none; }
.comp-voucher-status .comp-voucher-icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
}
.comp-voucher-status strong { font-weight: 700; }

.comp-voucher-status-eligible {
  background: rgba(22, 163, 74, 0.06);
  border: 1px solid rgba(22, 163, 74, 0.25);
  color: var(--text-primary);
}
.comp-voucher-status-eligible .comp-voucher-icon { color: var(--color-success); }
.comp-voucher-status-eligible .comp-voucher-headline { color: var(--color-success); }

.comp-voucher-status-progress {
  background: rgba(202, 138, 4, 0.06);
  border: 1px solid rgba(202, 138, 4, 0.22);
  color: var(--text-primary);
}
.comp-voucher-status-progress .comp-voucher-icon { color: var(--gold-text); }
.comp-voucher-status-progress .comp-voucher-headline { color: var(--gold-text); }

.comp-voucher-status-readonly {
  margin-top: var(--space-md);
}

.comp-voucher-headline {
  display: block;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.comp-thanks-email-hint {
  margin: var(--space-lg) auto 0;
  padding: 14px 20px;
  max-width: 540px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: rgba(202, 138, 4, 0.06);
  border: 1px solid rgba(202, 138, 4, 0.18);
  border-radius: var(--radius-md);
  text-align: center;
}

/* ── Your-entry summary ──────────────────────────────────────────── */
.comp-your-entry {
  margin-top: var(--space-xl);
  text-align: left;
}
.comp-your-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.comp-your-entry-row:last-child { border-bottom: none; }
.comp-your-entry-coin {
  font-weight: 600;
  color: var(--charcoal);
}
.comp-your-entry-grade {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-text);
}
.comp-your-entry-meta {
  margin-top: var(--space-md);
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Coin preview (logged-out / pre-open / closed) ───────────────── */
.comp-coins-preview .comp-coin-card {
  cursor: default;
}
.comp-coins-preview .comp-coin-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-light);
}
.comp-preview-intro {
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-xl);
  font-style: italic;
}

/* Generous breathing room between the coin previews and the
   login/signup gate that sits below them in the logged-out state. */
.comp-coins-preview + .comp-gate-card {
  margin-top: var(--space-3xl);
}

/* ── Form footer ─────────────────────────────────────────────────── */
.comp-form-footer {
  margin-top: var(--space-lg);
  text-align: center;
}
.comp-rules-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}
.comp-form-footer .btn { max-width: 320px; margin: 0 auto; }
.comp-form-footer .auth-message { margin-bottom: var(--space-md); text-align: center; }

/* ── Loading ─────────────────────────────────────────────────────── */
.spinner-large {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(202, 138, 4, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: comp-spin 0.9s linear infinite;
  margin-bottom: var(--space-md);
}
@keyframes comp-spin { to { transform: rotate(360deg); } }
.comp-loading-card { padding: var(--space-2xl); }

/* Reserve roughly the height of the most common rendered state
   (3 coin previews + login gate) so the loading→content swap doesn't
   cause a big layout shift. The :not([hidden]) selector preserves
   the browser's default `[hidden] → display: none`, otherwise the
   loading state would stay visible forever after JS hides it. */
#compStateLoading:not([hidden]) {
  min-height: 1800px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
@media (max-width: 720px) {
  #compStateLoading:not([hidden]) { min-height: 2300px; }
}

/* ── Lightbox ────────────────────────────────────────────────────── */
.comp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(12, 10, 9, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  cursor: zoom-out;
  animation: comp-fade-in var(--duration-normal) var(--ease);
}
.comp-lightbox[hidden] { display: none; }
.comp-lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.comp-lightbox-caption {
  margin-top: var(--space-md);
  color: var(--cream);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.comp-lightbox-close {
  position: absolute;
  top: 20px; right: 24px;
  width: 44px; height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  font-size: 1.6rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}
.comp-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}
@keyframes comp-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .comp-hero { padding-top: 170px; padding-bottom: 60px; }
  .comp-hero-x { font-size: 1.2rem; }
  .comp-hero-logo-wrap { height: 44px; min-width: 60px; padding: 6px 12px; }
  .comp-hero-logo-wrap img { max-height: 30px; }
  .comp-prize {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 22px;
  }
  .comp-pill { min-width: 130px; padding: 10px 18px; }
  .comp-pill-value { font-size: 1.15rem; }

  .comp-coin-card { padding: var(--space-lg); }
  .comp-coin-images { gap: var(--space-sm); }
  .comp-coin-grade input { font-size: 1.2rem; }

  .comp-gate-actions .btn { width: 100%; }
}
