/* PRUDENT — palette sampled from the garment */

:root {
  /* Taken straight from the product photography */
  --navy:       #121724;  /* the knit            */
  --navy-deep:  #0B0F1A;  /* shadowed ribbing    */
  --ecru:       #D8CABE;  /* the circle          */
  --paper:      #F7F5F0;  /* the photo ground    */
  --paper-deep: #EFEBE2;

  --line:  rgba(18, 23, 36, 0.14);
  --muted: rgba(18, 23, 36, 0.55);

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad:  clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--navy);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; height: auto; }

::selection { background: var(--ecru); color: var(--navy); }

:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.wordmark {
  font-weight: 400;
  font-size: clamp(1.75rem, 6vw, 3rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em; /* balance the tracking */
}

/* Shared underline input */
.line-input {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.6rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  color: inherit;
}
.line-input::placeholder { color: currentColor; opacity: 0.45; letter-spacing: 0.15em; }
.line-input:focus { outline: none; }
.line-input:focus-visible { outline: none; border-bottom-width: 2px; }

/* ---------- Gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: var(--navy);
  color: var(--paper);
  transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
}
.gate--hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.gate__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.25rem;
}
.gate__form .line-input { width: 220px; }

/* The circle, lifted off the chest of the knit — and the countdown inside it */
.gate__mark {
  display: grid;
  place-items: center;
  width: clamp(168px, 44vw, 232px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ecru);
  transform: scale(0.82);
  opacity: 0;
  animation: mark-in 1.2s var(--ease) 0.15s forwards;
  will-change: transform;
}
.gate__timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--navy);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.gate__timer-d {
  font-size: clamp(0.58rem, 1.5vw, 0.72rem);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  opacity: 0.6;
}
.gate__timer-d:empty { display: none; }
.gate__timer-t {
  font-size: clamp(1rem, 3vw, 1.45rem);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}
@keyframes mark-in { to { transform: scale(1); opacity: 1; } }

/* Unlock: the circle swells until it is the page (driven from script.js) */
.gate--opening .gate__timer,
.gate--opening .wordmark,
.gate--opening .line-input,
.gate--opening .gate__error {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gate__error {
  min-height: 1em;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s;
}
.gate__error.is-visible { opacity: 0.6; }

/* ---------- Site ---------- */
.site { opacity: 0; transition: opacity 0.8s var(--ease) 0.1s; }
.site.is-revealed { opacity: 1; }

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem var(--pad);
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.head__mark { letter-spacing: 0.4em; }
.head__drop { color: var(--muted); }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  height: 62vh;
  min-height: 320px;
  text-align: center;
  padding-inline: var(--pad);
}
.hero__mark {
  font-weight: 400;
  font-size: clamp(2.25rem, 12vw, 9rem);
  letter-spacing: 0.4em;
  text-indent: 0.4em; /* balances the trailing tracking */
}
.hero__sub {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--navy);
  opacity: 0.5;
}

/* ---------- The piece ---------- */
.piece {
  padding: clamp(1rem, 3vw, 2.5rem) var(--pad) clamp(4rem, 10vw, 8rem);
  margin-inline: auto;
  max-width: 1280px;
}
.piece__row {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: start;
  gap: clamp(2rem, 6vw, 5rem);
}
.piece__gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vw, 2rem);
  max-width: 620px;
}

/* The details follow the gallery, so Buy is never scrolled off. */
.spec { position: sticky; top: clamp(1.5rem, 5vh, 3.5rem); }

.spec__name {
  font-weight: 400;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.spec__list {
  margin-top: 2.25rem;
  border-top: 1px solid var(--line);
}
.spec__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.spec__row dt { color: var(--muted); }
.spec__at { color: var(--muted); }
.spec__row dd { text-align: right; }
/* ---------- Buy ---------- */
.buy { margin-top: clamp(2rem, 5vw, 3rem); }

.buy__count {
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  font-variant-numeric: tabular-nums;
}
.buy__when {
  margin-top: 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.sizes { border: 0; }
.sizes__legend {
  padding: 0;
  margin-bottom: 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.sizes__row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Real radios, visually replaced by the chips — keyboard and screen readers
   get proper group semantics for free. */
.sizes__input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.sizes__chip {
  display: grid;
  place-items: center;
  min-width: 48px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.sizes__chip:hover { border-color: var(--navy); }
.sizes__input:checked + .sizes__chip {
  background: var(--navy);
  color: var(--paper);
  border-color: var(--navy);
}
.sizes__input:focus-visible + .sizes__chip { outline: 1px solid currentColor; outline-offset: 3px; }
.sizes__chip.is-out {
  color: var(--muted);
  border-style: dashed;
  text-decoration: line-through;
  cursor: not-allowed;
}
.sizes__chip.is-out:hover { border-color: var(--line); }

.buy__btn {
  width: 100%;
  max-width: 280px;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--navy);
  border: none;
  cursor: pointer;
  transition: opacity 0.25s var(--ease);
}
.buy__btn:hover:not([disabled]) { opacity: 0.85; }
.buy__btn[disabled] { opacity: 0.3; cursor: default; }

.buy__msg {
  margin-top: 0.75rem;
  min-height: 1em;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Campaign collage ---------- */
.campaign {
  padding: 0 var(--pad) clamp(4rem, 10vw, 8rem);
  border-top: 1px solid var(--line);
  padding-top: clamp(3.5rem, 9vw, 7rem);
}
.campaign__title {
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}

/* Two staggered columns. Capped at 900px so no shot is scaled past the
   resolution it was shot at — the narrowest is 422px wide. */
.collage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1rem, 3.5vw, 2.5rem);
  max-width: 900px;
  margin-inline: auto;
}
.collage__col {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3.5vw, 2.5rem);
}
.collage__col--offset { margin-top: clamp(2rem, 9vw, 7rem); }

.collage__fig { overflow: hidden; }
.collage__fig img {
  width: 100%;
  transition: transform 0.9s var(--ease);
}
@media (hover: hover) {
  .collage__fig:hover img { transform: scale(1.02); }
}

/* ---------- Join ---------- */
.join {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(4.5rem, 12vw, 8rem) var(--pad);
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
}
.join__label {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.join__form { display: flex; align-items: flex-end; gap: 0.75rem; }
.join__form .line-input { width: min(240px, 60vw); }
.join__btn {
  font-family: var(--sans);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.4rem 0.2rem;
  background: none;
  border: none;
  color: var(--navy);
  cursor: pointer;
  transition: transform 0.25s var(--ease), opacity 0.25s;
}
.join__btn:hover { transform: translateX(4px); }
.join__btn[disabled] { opacity: 0.35; cursor: default; transform: none; }
.join__msg {
  min-height: 1em;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s;
}
.join__msg.is-visible { opacity: 0.55; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem var(--pad);
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-top: 1px solid var(--line);
}
.foot a { border-bottom: 1px solid transparent; transition: border-color 0.25s; }
.foot a:hover { border-bottom-color: currentColor; }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .piece__row { grid-template-columns: 1fr; justify-items: center; }
  .piece__gallery { max-width: 440px; }
  .spec { position: static; }
  .collage { grid-template-columns: 1fr; max-width: 440px; }
  .collage__col--offset { margin-top: 0; }
  .spec { width: min(440px, 100%); }
}

@media (max-width: 560px) {
  .hero { height: 54vh; }
  /* tighter tracking so the wordmark never outgrows the viewport */
  .hero__mark { letter-spacing: 0.22em; text-indent: 0.22em; }
  .head__drop { display: none; }
  .foot { flex-direction: column; gap: 0.75rem; }
}

@media (max-height: 660px) {
  .gate__form { gap: 1.6rem; }
  .gate__mark { width: clamp(118px, 24vh, 160px); }
  .gate__timer-t { font-size: 0.82rem; }
  .gate__timer-d { font-size: 0.58rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  html { scroll-behavior: auto; }
  .gate__mark { opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; }
}
