
/* --- Hub shell (authenticated pages) --- */
.hub-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-7);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.hub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
/* Small text wordmark shared by every authenticated member surface — the hub
   home, the pin flow, and error pages all wear this same topbar (no logo / no
   Tetra Studios sub-line). */
.hub-brand {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: var(--text-lead);
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--ink-soft);
}
.hub-brand:hover { color: var(--brand); text-decoration: none; }
.hub-who {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--ink-soft);
}
.hub-who .name { font-weight: 600; color: var(--ink); }
.hub-content { flex: 1; }
.hub-footer {
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--ink-mute);
  font-size: var(--text-xs);
  text-align: center;
  letter-spacing: 0.04em;
}
.hub-footer a {
  color: var(--ink-mute);
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.hub-footer a:hover { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }

/* --- Hero --- */
.hero { margin: 0 0 var(--space-5); }
.hero h1 { font-size: var(--display-md); }
/* Tight rhythm inside a hero (heading cluster), with more air before the action. */
.hero > * + * { margin-top: var(--space-3); }
.hero .cta-row { margin-top: var(--space-5); }

/* --- Card --- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-1), #161619);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: var(--space-5) 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 8px 22px rgba(0,0,0,.25);
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease);
}
.card:hover { border-color: var(--border-strong); }
/* The pin card is the page's focal point — the reward. A brand-tinted border
   lifts it above the membership/visibility utility cards without a second
   accent or extra shadow (Border-Carries-Depth). */
.card.pin-card { border-color: rgba(236,131,60,.32); }
.card.pin-card:hover { border-color: rgba(236,131,60,.5); }
.card h2 { margin-top: 0; }
/* Consistent vertical rhythm between a card's top-level blocks. */
.card > * + * { margin-top: var(--space-4); }

/* --- Buttons --- */
.btn, button.btn, button:not([data-unstyled]) {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  transition: filter var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  min-height: 44px;
}
.btn:hover, button:not([data-unstyled]):hover {
  filter: brightness(1.06);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 4px rgba(236,131,60,.12);
}
.btn:active, button:not([data-unstyled]):active {
  transform: translateY(1px);
  filter: brightness(0.95);
}
.btn:focus-visible, button:not([data-unstyled]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.btn.secondary, button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.btn.secondary:hover, button.secondary:hover {
  background: var(--surface-2);
  color: var(--ink);
  filter: none;
  box-shadow: none;
}
.btn.danger, button.danger { background: var(--danger); }
.btn:disabled, button:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
  transform: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.btn:disabled:hover, button:disabled:hover {
  filter: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.btn.btn-sm, button.btn-sm {
  padding: var(--space-2) var(--space-4);
  min-height: 0;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
}
.btn.brand-patreon { background: #0a0a0a; border: 1px solid var(--border); }
.btn.brand-patreon:hover { box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 0 0 4px rgba(236,131,60,.18); }
.btn.brand-discord { background: #5865f2; }
.btn.brand-discord:hover { box-shadow: 0 4px 16px rgba(88,101,242,.32), 0 0 0 4px rgba(88,101,242,.18); }

/* Busy state — spinner before the label */
.btn[aria-busy="true"] { cursor: wait; opacity: 0.85; }
/* Hide the button's own icon while busy so it's a clean spinner + text,
   not spinner + brand icon + text. */
.btn[aria-busy="true"] svg, .btn[aria-busy="true"] .icon { display: none; }
.btn[aria-busy="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  animation: hub-spin 800ms linear infinite;
}
@keyframes hub-spin { to { transform: rotate(360deg); } }

/* --- Forms --- */
label {
  display: block;
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-xs);
  color: var(--ink-soft);
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-mute); opacity: 0.85; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(236,131,60,0.2);
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand);
  transform: translateY(1px);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-1);
  color: var(--ink-mute);
  cursor: not-allowed;
}
.field-error { color: var(--danger); font-size: var(--text-xs); margin-top: var(--space-1); }

/* Field labels with a leading icon. Calm (muted) at rest; the icon lights to
   the brand accent when its field is focused — the one accent, tied to intent. */
.lbl { display: inline-flex; align-items: center; gap: var(--space-2); }
.field-ico {
  color: var(--ink-mute);
  transition: color var(--dur-fast) var(--ease);
}
label:focus-within .field-ico { color: var(--brand); }
.lbl .opt { color: var(--ink-mute); font-weight: 400; }
/* Inline helper text under a field (e.g. the expected postal-code format). */
.addr-field-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--ink-soft);
}
.addr-field-hint[hidden] { display: none; }

/* --- Pills --- */
.pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.pill.success { background: rgba(95,191,109,.14); color: #a9dcb1; border-color: rgba(95,191,109,.4); }
.pill.warn    { background: rgba(245,167,106,.14); color: #f3c79a; border-color: rgba(245,167,106,.4); }
.pill.fail    { background: rgba(224,100,100,.14); color: #f0b7b7; border-color: rgba(224,100,100,.4); }
.pill.brand   { background: rgba(236,131,60,.14); color: #f0a577; border-color: rgba(236,131,60,.4); }

/* --- Banners --- */
.banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin: var(--space-2) 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
}
.banner.success { background: rgba(95,191,109,.12); border-color: rgba(95,191,109,.4); color: #c0e7c6; }
.banner.error   { background: rgba(224,100,100,.1);  border-color: rgba(224,100,100,.45); color: #f4c0c0; }

/* --- Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1), var(--surface-2), var(--surface-1));
  background-size: 200% 100%;
  animation: hub-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
  height: 1rem;
}
.skeleton + .skeleton { margin-top: var(--space-2); }
@keyframes hub-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- Member meta dl --- */
dl.member-meta {
  /* 16px top keeps the heading-to-meta gap equal to the card's other blocks;
     a bare margin:0 loses the card's child rhythm (element+class specificity
     beats it) and jams the meta against the heading. */
  margin: var(--space-4) 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
}
dl.member-meta > div { display: contents; }
/* Labels sit one ink-step below their values (which are full white) — soft,
   not muted gray, so "Tier" / "Member for" read clearly. */
dl.member-meta dt { color: var(--ink-soft); font-size: var(--text-xs); align-self: center; }
dl.member-meta dd { margin: 0; color: var(--ink); }

/* --- Code --- */
code {
  background: var(--surface-2);
  color: var(--ink);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  border: 1px solid var(--border);
}

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  color: var(--ink);
}
th {
  color: var(--ink-mute);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--text-xs);
}
tbody tr:hover { background: var(--surface-2); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--space-2) 0; }
.table-scroll > table { min-width: 32rem; }

/* --- Modals (Stripe bootstrap confirm) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: hub-modal-fade var(--dur-fast) var(--ease);
  padding: var(--space-4);
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  max-width: 28rem;
  width: 100%;
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  animation: hub-modal-pop var(--dur-slow) var(--ease);
}
.modal h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lead);
  color: #fff;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@keyframes hub-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hub-modal-pop  { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* --- Pin submission progress overlay (covers the form while submitting) --- */
.pin-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,10,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: var(--space-4);
  animation: hub-modal-fade var(--dur-fast) var(--ease);
  backdrop-filter: blur(3px);
}
.pin-progress {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  max-width: 23rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  animation: hub-modal-pop var(--dur-slow) var(--ease);
}
.pin-progress-spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--brand);
  animation: hub-spin 800ms linear infinite;
}
.pin-progress h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-lead);
  color: #fff;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pin-progress .pin-progress-sub {
  margin: 0 0 var(--space-4);
  color: var(--ink-mute);
  font-size: var(--text-xs);
}
@media (prefers-reduced-motion: reduce) {
  .pin-progress-spinner { animation: none; }
}

/* --- Confetti canvas --- */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* --- Address autocomplete (Geoapify typeahead on line1) --- */
.addr-combo { display: block; position: relative; }
.addr-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.addr-suggest[hidden] { display: none; }
.addr-suggest-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--ink);
  cursor: pointer;
}
.addr-suggest-item:hover,
.addr-suggest-item[aria-selected="true"] {
  background: var(--surface-2);
}

/* The card clips overflow for its rounded corners, which would cut off the
   absolutely-positioned suggestion list now that step 1 is short. Border-radius
   still clips the card's own background, so only the overflowing dropdown is
   freed. */
.addr-form-card { overflow: visible; }

/* Search loading bar — visible from first keystroke through debounce + fetch. */
.addr-loading[hidden] { display: none; }
.addr-loading-track {
  display: block;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.addr-loading-bar {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: var(--brand);
  animation: addr-indeterminate 1.05s var(--ease) infinite;
}
@keyframes addr-indeterminate {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}
.addr-loading-text {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

/* "Enter it manually" affordance. */
.addr-manual-hint { margin: 0; font-size: var(--text-xs); color: var(--ink-soft); }
.addr-manual-hint[hidden] { display: none; }
.linklike {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  width: auto;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linklike:hover { color: var(--brand-soft); }
@media (max-width: 600px) {
  /* Comfortable tap target on mobile. */
  .linklike { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Step 2 reveal — animate the row height open. Default (no JS) is open, so the
   full form is usable without script; JS collapses then reveals on demand. */
.addr-details {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--dur-slow) var(--ease);
}
.addr-details[data-collapsed="true"] { grid-template-rows: 0fr; }
.addr-details-inner { overflow: hidden; min-height: 0; }

@media (prefers-reduced-motion: reduce) {
  .addr-loading-bar { animation: none; width: 100%; opacity: 0.55; }
  .addr-details { transition: none; }
}

/* --- Two-up grid (pin-confirm) --- */
.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  align-items: stretch;
}
.grid-two > .card { margin: 0; }

/* --- Eligibility progress meter (ineligible pin state) --- */
.pin-meter { display: flex; flex-direction: column; gap: var(--space-2); }
.pin-meter-track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pin-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct, 0%);
  min-width: 0.5rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-press), var(--brand));
  box-shadow: 0 0 12px -2px rgba(236,131,60,.5);
  transform-origin: left center;
  animation: pin-meter-grow 700ms var(--ease);
}
.pin-meter-label { font-size: var(--text-xs); color: var(--ink-soft); }
.pin-meter-label .stat { color: var(--brand); }
@keyframes pin-meter-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Unmet-requirement note shown beside the "Upgrade Account" button — red
   because it's a blocking requirement, with the text carrying the meaning
   (never colour alone). */
.pin-requirement { color: var(--danger); font-size: var(--text-xs); }

@media (prefers-reduced-motion: reduce) {
  .pin-meter-fill { animation: none; }
}

/* --- Status mark (large circular hero glyph) --- */
.error-mark {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 50% 32%, rgba(224,100,100,.26), rgba(224,100,100,.06));
  border: 1px solid rgba(224,100,100,.4);
  color: var(--danger);
  margin: 0;
}
.error-mark .icon { width: 26px; height: 26px; stroke-width: 2; }

/* --- Unlock medallion (eligible pin state) --- */
/* The reward beat. Mirrors .error-mark as a hero glyph, but in the brand
   accent, so "your pin is unlocked" reads as earning, not filing. Static and
   calm — the celebratory motion is saved for the claim itself. */
.unlock-head { display: flex; align-items: center; gap: var(--space-4); }
.unlock-mark {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 50% 30%, rgba(236,131,60,.30), rgba(236,131,60,.06));
  border: 1px solid rgba(236,131,60,.45);
  color: var(--brand);
}
.unlock-mark .icon { width: 26px; height: 26px; stroke-width: 2; vertical-align: 0; }
/* The headline reuses the canonical h2.section treatment (Chakra display,
   uppercase, +0.04em); the medallion stands in for its usual leading icon. */

/* --- Fulfillment stepper (active-claim journey) --- */
.fulfillment-steps {
  display: flex;
  gap: 0;
  list-style: none;
  /* 16px top to match the card rhythm; a bare margin:0 (or the <ol> default)
     would otherwise jam the stepper against the heading. */
  margin: var(--space-4) 0 0;
  padding: 0;
}
.fulfillment-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  position: relative;
}
.fulfillment-step::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--border-strong);
  z-index: 0;
}
.fulfillment-step:first-child::before { display: none; }
.fulfillment-step .dot {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-mute);
}
.fulfillment-step .dot .icon { width: 15px; height: 15px; stroke-width: 2.5; display: block; vertical-align: 0; }
.fulfillment-step .label {
  font-size: var(--text-xs);
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.fulfillment-step.is-done .dot {
  border-color: var(--brand);
  /* Opaque tint (was rgba .16) so the connector line is hidden behind the
     dot instead of showing through it. Matches the prior translucent look. */
  background: #3a2922;
  color: var(--brand);
}
.fulfillment-step.is-done .label { color: var(--ink-soft); }
.fulfillment-step.is-done::before { background: var(--brand); }
.fulfillment-step.is-current .dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(236,131,60,.16);
}
.fulfillment-step.is-current .label { color: #fff; font-weight: 600; }
.fulfillment-step.is-current::before { background: var(--brand); }

/* --- Mobile --- */
@media (max-width: 600px) {
  .hub-shell { padding: var(--space-5) var(--space-4) var(--space-6); }
  .hub-topbar { margin-bottom: var(--space-4); padding-bottom: var(--space-3); }
  .hub-brand { font-size: var(--text-base); }
  h1 { font-size: 1.75rem; }
  .hero h1 { font-size: 1.875rem; }
  .hero { margin: 0 0 var(--space-4); }
  /* Keep long section headings + their status pill from overflowing the
     card on narrow screens. */
  h2.section { font-size: var(--text-lead); flex-wrap: wrap; }
  .lead { font-size: var(--text-base); }
  .card { padding: var(--space-4); margin: var(--space-4) 0; }
  .btn, button:not([data-unstyled]) { padding: var(--space-3) var(--space-4); min-height: 44px; }
  .cta-row { gap: var(--space-2); }
  .cta-row > .btn, .cta-row > button, .cta-row > form > button { flex: 1 1 auto; justify-content: center; }
  /* Comfortable tap target for the supporters-list checkbox + its label. */
  .check-row { min-height: 44px; }
  .modal { padding: var(--space-4); }
  input, select, textarea { padding: var(--space-3); font-size: 16px; }
  th, td { font-size: var(--text-xs); padding: var(--space-2); }
  .fulfillment-step .label { font-size: 0.75rem; }
}
