/* GloveDash buy flow + suggestion box
   Extends assets/styles.css. Uses the existing token set. */

/* ---------- open / sold out state swap ----------
   Default document state is OPEN, so there is no flash of the wrong
   content while run-status is still in flight. buy.js adds
   .is-soldout to <html> only when the run is actually gone. */
[data-when="soldout"] { display: none; }
.is-soldout [data-when="soldout"] { display: block; }
.is-soldout [data-when="open"] { display: none; }
/* inline swaps inside nav, eyebrow and dock */
.nav [data-when], .eyebrow [data-when], .dock [data-when] { display: inline; }
.is-soldout .nav [data-when="open"],
.is-soldout .eyebrow [data-when="open"],
.is-soldout .dock [data-when="open"] { display: none; }
.nav [data-when="soldout"],
.eyebrow [data-when="soldout"],
.dock [data-when="soldout"] { display: none; }
.is-soldout .nav [data-when="soldout"],
.is-soldout .eyebrow [data-when="soldout"],
.is-soldout .dock [data-when="soldout"] { display: inline; }

.anchor-alias { display: block; position: relative; top: -90px; height: 0; }

/* ---------- buy box ---------- */
.buybox { margin-top: clamp(22px, 3.2vw, 34px); }
.buybox button[data-buy] { min-width: min(100%, 20rem); }
.buybox button[data-buy][disabled] { opacity: .62; cursor: progress; }

.buybox__fine {
  margin: .85rem 0 0;
  color: var(--fog);
  font-family: var(--body);
  font-size: .92rem;
  line-height: 1.55;
  max-width: 46ch;
}
.buybox--big .buybox__fine { max-width: 52ch; }

.buybox__err {
  margin: 0;
  max-height: 0;
  overflow: hidden;
  color: #FF7A68;
  font-family: var(--body);
  font-size: .92rem;
  line-height: 1.5;
  max-width: 48ch;
  transition: max-height .3s var(--ease), margin .3s var(--ease);
}
.buybox__err.is-on { max-height: 8rem; margin-top: .7rem; }

/* ---------- units remaining ---------- */
.runleft {
  margin: .9rem 0 0;
  opacity: 0;
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: .84rem;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: .55rem;
  transition: opacity .4s var(--ease);
}
.runleft.is-on { opacity: 1; }
.runleft::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(146, 224, 62, .55);
  animation: gd-pulse 2.4s var(--ease) infinite;
}
.is-soldout .runleft { color: var(--fog-2); }
.is-soldout .runleft::before { background: var(--fog); animation: none; box-shadow: none; }

@keyframes gd-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(146, 224, 62, .5); }
  70%  { box-shadow: 0 0 0 9px rgba(146, 224, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(146, 224, 62, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .runleft::before { animation: none; }
}

/* ---------- suggestion box ---------- */
.sbox {
  padding: var(--sec) 0;
  background: var(--ink-3);
  border-top: 1px solid var(--line);
}
.sbox__inner { display: grid; gap: clamp(30px, 4.5vw, 56px); align-items: start; }
@media (min-width: 900px) {
  .sbox__inner { grid-template-columns: 1.05fr .95fr; gap: clamp(44px, 6vw, 90px); }
}
.sbox__copy .lede { margin-top: 1.1rem; max-width: 46ch; }

.sbox__form { display: grid; gap: .85rem; }
.sbox__form textarea,
.sbox__form input {
  width: 100%;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--white);
  background: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: .95rem 1.05rem;
  transition: border-color .25s var(--ease);
}
.sbox__form textarea { resize: vertical; min-height: 7.5rem; line-height: 1.55; }
.sbox__form textarea:focus-visible,
.sbox__form input:focus-visible {
  outline: none;
  border-color: var(--green);
}
.sbox__form textarea::placeholder,
.sbox__form input::placeholder { color: #6C7473; }
.sbox__form button { justify-self: start; }
.sbox__form button[disabled] { opacity: .62; cursor: progress; }

.sbox__msg {
  margin: 0;
  max-height: 0;
  overflow: hidden;
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .84rem;
  color: var(--green);
  transition: max-height .3s var(--ease);
}
.sbox__msg.is-on { max-height: 6rem; }
.sbox__msg.is-err { color: #FF7A68; }

/* Military and first responder discount link, sits under each buy button.
   Deliberately quiet. It should be findable by the guys it is for without
   pulling everyone else off the $39 button. */
.svclink {
  margin: .7rem 0 0;
  font-family: var(--cond);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
}
.svclink a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid rgba(146, 224, 62, .35);
  padding-bottom: 2px;
}
.svclink a:hover { border-bottom-color: var(--green); }
