@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ground: #101117;
  --surface: #181a22;
  --raised: #20232d;
  --ink: #ede9f5;
  --muted: #b3aac5;
  --hair: #32323d;
  --line: #575363;
  --green: #1ef398;
  --cyan: #a5f5fb;
  --edge: clamp(1.25rem, 3.4vw, 3.5rem);
  --safe-left: max(var(--edge), env(safe-area-inset-left));
  --safe-right: max(var(--edge), env(safe-area-inset-right));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--ground); }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1rem/1.45 "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul, fieldset { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 0.1875rem; }
h1:focus { outline: none; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--green);
  color: var(--ground);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  transition: background-color 0.2s, color 0.2s;
}
.primary:hover { background: var(--cyan); }
.primary:disabled { background: var(--raised); color: var(--muted); }

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.text-link:hover { color: var(--ink); }

/* Every screen: logo pinned top-left, content below. */
.screen {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(1.5rem, 4vh, 3rem);
  min-height: 100svh;
  padding: max(1.5rem, env(safe-area-inset-top)) var(--safe-right)
    max(2rem, env(safe-area-inset-bottom)) var(--safe-left);
}
.logo { display: block; width: auto; height: 2.75rem; }
.logo-link { justify-self: start; border-radius: 0.25rem; }

h1 {
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.06em;
}
h1 span { color: var(--green); }
/* Keeps "thank-you" from breaking at its hyphen on narrow screens. */
.nowrap { font-weight: inherit; white-space: nowrap; }

.frame {
  width: min(100%, 94rem);
  margin-inline: auto;
}

.welcome { grid-template-rows: 1fr; }

.welcome-frame {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(2.5rem, 5vh, 4rem);
  width: min(100%, 108rem);
}

.welcome-body {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 5.5rem);
  padding-bottom: clamp(2rem, 5vh, 5rem);
}

.welcome h1 {
  margin-bottom: 2.25rem;
  font-size: clamp(3rem, 6.4vw, 7.5rem);
  line-height: 0.9;
  text-wrap: balance;
}

.welcome .primary {
  min-height: 3.625rem;
  padding-inline: 1.75rem;
}

.picture {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #27282d; /* matches the renders' charcoal backdrop while loading */
}

/* The box is a cut-out that sits straight on the page: no frame, no backdrop. */
.hero {
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: transparent;
}

.with-picks {
  --bar-clearance: calc(var(--pick-bar-height, 8rem) + 1.5rem);
  padding-bottom: var(--bar-clearance);
}

.page-title {
  font-size: clamp(2.5rem, 6.05vw, 6.5rem);
  line-height: 0.98;
  text-wrap: balance;
}

.catalogue .page-title { margin-block: clamp(1.75rem, 4vh, 3.25rem) 1.5rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.5rem);
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid var(--hair);
  border-radius: 0.9rem;
  background: var(--surface);
  transition: border-color 0.2s;
}

.card:has([aria-pressed="true"]),
.card:has([data-picked="true"]) { border-color: var(--green); }

.card-photo {
  display: block;
  border-radius: 0.85rem 0.85rem 0 0;
}

.card-photo .picture {
  height: auto;
  aspect-ratio: 1;
  border-radius: inherit;
}

.card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-items: start;
  padding: clamp(0.875rem, 1.45vw, 1.375rem);
}

.card h2 {
  font-size: clamp(1.1rem, 1.8vw, 1.625rem);
  line-height: 1.15;
}

.card h2 a:hover { text-decoration: underline; text-underline-offset: 0.16em; }
.card p { grid-column: 1; color: var(--muted); }

.item-button {
  display: inline-flex;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  min-height: 2.75rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--raised);
  font-weight: 700;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.item-button:hover { border-color: var(--green); }
.item-button[aria-pressed="true"],
.item-button[data-picked="true"],
#product-get[aria-pressed="true"]:not(:disabled) {
  border-color: var(--green);
  background: var(--ground);
  color: var(--green);
}

.product-grid {
  display: grid;
  grid-template:
    "back back" auto
    "gallery title" auto
    "gallery copy" 1fr / minmax(0, min(56vh, 34rem)) minmax(0, 1fr);
  column-gap: clamp(2rem, 5vw, 5.5rem);
  margin-top: clamp(1rem, 3vh, 2.5rem);
}

.product-grid .page-title {
  grid-area: title;
  margin-block: clamp(0.625rem, 2vh, 1.5rem) 0.875rem;
}

.all-merch { grid-area: back; justify-self: start; margin-bottom: 0.75rem; }
.gallery { grid-area: gallery; min-width: 0; }

/* Product renders are square; keep the frame square but short enough to sit on a laptop screen. */
.gallery-view {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: 1rem;
  background: var(--surface);
}

.gallery-view .picture { min-height: 0; }
.gallery-view .picture.art { object-fit: contain; background: transparent; }

.gallery-thumbs[hidden] { display: none; }

.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.75rem;
}

.gallery-thumbs button,
.pick-thumb {
  display: block;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--ground);
  transition: border-color 0.2s;
}

/* Renders are square, so thumbnails are too: nothing gets cropped. */
.gallery-thumbs button {
  width: 4.25rem;
  height: 4.25rem;
}

.gallery-thumbs button:hover,
.gallery-thumbs button[aria-pressed="true"],
.pick-thumb:hover { border-color: var(--green); }

.gallery-thumbs button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--green); }
.gallery-thumbs .picture,
.pick-thumb .picture { border-radius: 0.4rem; }

.product-copy { grid-area: copy; }
#product-summary { font-size: clamp(1.15rem, 1.8vw, 1.5rem); }
#product-description { display: grid; gap: 0.45rem; margin-top: 1rem; color: var(--muted); }
#product-contents {
  margin-top: 0.625rem;
  padding-inline-start: 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  list-style: disc;
}
.product-note { margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }
#size-picker { margin-top: 1.5rem; }
.size-chart[hidden] { display: none; }
/* Tee measurements: compact and quiet, numbers aligned for scanning. */
.size-chart { width: 100%; max-width: 30rem; margin-top: 1.75rem; border-collapse: collapse; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.size-chart th, .size-chart td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; }
.size-chart thead th { color: var(--muted); font-size: 0.75rem; vertical-align: bottom; }
.size-chart th:first-child { padding-left: 0; text-align: left; }
.size-chart tbody th { color: var(--ink); font-weight: 600; }

.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sizes label { position: relative; cursor: pointer; }

.sizes span {
  display: grid;
  min-width: 3rem;
  min-height: 2.75rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  font-weight: 700;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.sizes label:hover span { border-color: var(--green); }
.sizes input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 0.1875rem; }
.sizes input:checked + span { background: var(--green); border-color: var(--green); color: var(--ground); }

#product-get {
  min-width: 11rem;
  margin-top: 1.5rem;
  border: 1px solid transparent;
}

.pick-bar {
  position: fixed;
  z-index: 2;
  inset: auto 0 0;
  padding: 0.75rem var(--safe-right) calc(0.75rem + env(safe-area-inset-bottom)) var(--safe-left);
  border-top: 1px solid var(--hair);
  background: var(--surface);
}

.pick-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1.125rem;
}

.pick-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pick-thumb { position: relative; width: 3.375rem; height: 3.25rem; }

.pick-thumb span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding-inline: 0.25rem;
  border-radius: 0.25rem;
  background: var(--ground);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
}

#pick-count { color: var(--muted); font-weight: 700; }
#continue { min-width: 12rem; margin-left: auto; }

/* Delivery */
.delivery-body { width: min(100%, 66rem); margin-inline: auto; }
.delivery h1 { font-size: clamp(2.25rem, min(5vw, 8vh), 4.5rem); }
.delivery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.85fr);
  align-items: start;
  gap: 0.875rem;
  margin-top: 1.5rem;
}
.panel {
  min-width: 0;
  padding: clamp(1rem, 2.1vw, 1.625rem);
  border-radius: 0.9rem;
  background: var(--surface);
}
.panel h2, legend { font-size: 1.15rem; font-weight: 700; }
.delivery-picks h2 { margin-bottom: 0.25rem; }
.summary-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--hair);
  font-weight: 600;
}
.summary-item .picture { width: 3rem; height: 3rem; border-radius: 0.5rem; }

fieldset { min-width: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 0.65rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.field label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.field label span { color: var(--muted); font-weight: 400; }
.full-width { grid-column: 1 / -1; }
.field input, .field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background-color: var(--ground);
}
.country-field { position: relative; }
.country-field select { appearance: none; padding-right: 2.5rem; }
.country-field::after {
  position: absolute;
  right: 1rem;
  bottom: 1.2rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}
#send-error { margin-top: 0.75rem; color: #ffada9; }
#send-error:empty { margin-top: 0; }
#send-request { margin-top: 1.25rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Received */
.confirmation > div { align-self: center; }
.confirmation h1 { max-width: 12ch; font-size: clamp(3.5rem, min(10vw, 17vh), 12rem); }
.confirmation p { margin: 1.5rem 0; font-size: clamp(1.1rem, 1.6vw, 1.5rem); }


.summary-item small {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

html:has(#pick-bar:not([hidden])) { scroll-padding-bottom: calc(var(--pick-bar-height, 8rem) + 1rem); }

/* Quiet fade when a screen appears. */
.screen:not([hidden]) { transition: opacity 0.24s ease; }
@starting-style {
  .screen:not([hidden]) { opacity: 0; }
}

@media (max-width: 980px) {
  .card-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .item-button { grid-column: 1; grid-row: auto; margin-top: 0.45rem; }
}

@media (max-width: 760px) {
  .welcome-body {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 2.25rem;
    padding-bottom: 1rem;
  }
  .welcome h1 { margin-bottom: 1.75rem; font-size: clamp(2.75rem, 13vw, 5.5rem); }

  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card p { line-height: 1.3; }

  .product-grid {
    grid-template:
      "back" auto
      "title" auto
      "gallery" auto
      "copy" auto / minmax(0, 1fr);
  }

  .all-merch { margin-bottom: 0; }
  .product-grid .page-title { margin-bottom: 1rem; }
  .product-copy { margin-top: 1.25rem; }

  .pick-bar-inner { column-gap: 0.75rem; }
  .pick-thumbs { flex-basis: 100%; }
  .pick-thumb { width: 2.75rem; height: 2.75rem; }

  .delivery-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 375px) and (max-width: 760px) {
  .pick-thumbs:not(:has(li:nth-child(3))) { flex-basis: auto; }
}

@media (max-width: 560px) {
  .catalogue .page-title { margin-bottom: 1rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  #product-get, #send-request { width: 100%; }
  #continue { min-width: 0; min-height: 3rem; padding-inline: 0.75rem; }
  .card-body { padding: 0.75rem; }
  .card p { font-size: 0.875rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
