/* ============================================================================
   Modal — one shell, two bodies (claim an open spot / view a sponsor)
   ========================================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal__card {
  position: relative;
  width: min(430px, 100%);
  max-height: min(94vh, 820px);
  max-height: min(94dvh, 820px); /* dvh accounts for mobile browser chrome; vh above is the fallback */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform var(--t-base) var(--ease-out-back), opacity var(--t-base) var(--ease);

  /* A thin, themed scrollbar reads as designed-in, not as overflow that
     leaked through — the content is often taller than the card on short
     phone screens (see the mobile padding/spacing overrides below). */
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.modal__card::-webkit-scrollbar {
  width: 6px;
}

.modal__card::-webkit-scrollbar-track {
  background: transparent;
}

.modal__card::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
}

.modal.is-open .modal__card {
  transform: none;
  opacity: 1;
}

.modal__close {
  position: absolute;
  top: var(--sp-4);
  inset-inline-end: var(--sp-4);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.modal__close:hover {
  color: var(--ink);
  background: var(--surface);
}

.modal__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.modal__title {
  margin-top: var(--sp-2);
  font-size: var(--step-2);
}

.modal__sub {
  margin-top: var(--sp-2);
  font-size: var(--step--1);
  color: var(--ink-2);
}

.bid-note {
  padding: var(--sp-2);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--step--2);
}

/* --------------------------------------------------------- Price display */

.price {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-block: var(--sp-3);
  padding-block: var(--sp-2);
  border-block: 1px solid var(--line);
}

.price__value {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.price__term {
  font-size: var(--step--1);
  color: var(--ink-3);
}

/* --------------------------------------------------------------- Spec row */

.specs {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.specs div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--step--1);
}

.specs dt,
.specs span:first-child {
  color: var(--ink-3);
}

.specs b {
  font-weight: 550;
  text-align: end;
}

/* ------------------------------------------------------------------ Form */

.field {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.field label {
  font-size: var(--step--2);
  font-weight: 500;
  color: var(--ink-2);
}

.field input {
  width: 100%;
  padding: 0.55em 0.8em;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--step--1);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.field input::placeholder {
  color: var(--ink-3);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

/* Honeypot — off-screen, never announced, never tabbable. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form__note {
  margin-top: var(--sp-3);
  font-size: var(--step--2);
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
}

.form__note a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form__note a:hover {
  color: var(--accent-text);
}

.form__error {
  margin-top: var(--sp-3);
  font-size: var(--step--2);
  color: var(--accent-text);
  text-align: center;
}

.form__error:empty {
  display: none;
}

/* --------------------------------------------------------------- Success */

.done {
  text-align: center;
  padding-block: var(--sp-4);
}

.done__mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  animation: pop var(--t-base) var(--ease-out-back);
}

@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

.done h3 {
  font-size: var(--step-2);
}

.done p {
  margin-top: var(--sp-3);
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* --------------------------------------------------------- Sponsor card */

.sponsor {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.sponsor__logo {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: none;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.sponsor__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Both are <span>, so they need an explicit block or the category runs on
   from the end of the name. */
.sponsor__name {
  display: block;
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.sponsor__cat {
  display: block;
  margin-top: 4px;
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Small screens have the least room to spare, so they get the tightest outer
   margin around the card. The card's own padding/spacing above is already
   compact enough (see the bid form: title, note, price, three specs, up to
   four fields, button, note) to fit every breakpoint's viewport without a
   scrollbar in the common case — this is just the last few pixels back. */
@media (max-width: 480px) {
  .modal {
    padding: var(--sp-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal__card {
    transition-duration: 1ms;
  }
  .done__mark {
    animation: none;
  }
}
