/* Winchesters — inner pages: products, checkout, support, not found. */

.page {
  padding-top: calc(var(--nav-h) + clamp(44px, 9vh, 120px));
}

.page__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px 32px;
  padding-inline: var(--gutter);
  margin-bottom: clamp(28px, 6vh, 72px);
}

.page__title {
  font-size: var(--t-h1);
  line-height: 0.88;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
}

.page__meta {
  text-align: right;
  padding-bottom: 0.5em;
}

.page__foot {
  height: clamp(70px, 13vh, 170px);
}

@media (max-width: 620px) {
  .page__head {
    grid-template-columns: 1fr;
  }

  .page__meta {
    text-align: left;
    padding-bottom: 0;
  }
}

/* ---------------------------------------------------------------- products */

.catalogue {
  padding-inline: var(--gutter);
}

/* the one placeholder: a drapery study, drawn live in characters */
.shelf {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: min(68vh, 760px);
  margin: 0;
  background: var(--navy);
  overflow: hidden;
  overflow: clip;
}

.shelf__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.shelf__caption {
  width: -moz-fit-content;
  width: fit-content;
  max-width: 100%;
  padding: clamp(22px, 3.6vw, 52px);
}

.shelf__title {
  margin: 0 0 0.16em -0.04em;
  font-size: clamp(3rem, 1rem + 8vw, 8.5rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.shelf__text {
  max-width: 22em;
  font-size: var(--t-lead);
  line-height: 1.3;
  letter-spacing: -0.012em;
}

.catalogue__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 18px;
}

.catalogue__foot .btn--bracket {
  margin-right: -10px;
}

@media (max-width: 620px) {
  .shelf {
    min-height: 66vh;
    min-height: 66svh;
  }
}

/* ---------------------------------------------------------------- studies: pictures set in characters
   Two plates on a twelve-column grid, staggered: the first hangs left with its label to the
   right, the second hangs right with its label to the left. */

.studies {
  display: grid;
  row-gap: clamp(40px, 8vh, 104px);
  padding: clamp(96px, 17vh, 210px) var(--gutter) 0;
}

.studies__head,
.study {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: end;
  margin: 0;
}

.studies__title {
  grid-column: 1 / span 8;
  font-size: var(--t-h2);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.studies__copy {
  grid-column: 9 / -1;
  max-width: 22em;
  padding-bottom: 0.5em;
  color: var(--ink-2);
}

.study__plate {
  position: relative;
  grid-row: 1;
  /* the width is fixed by the grid; the height follows 5:4 until it would outgrow the screen,
     after which the plate simply gets wider than the picture and the picture stays centred */
  width: 100%;
  aspect-ratio: 5 / 4;
  min-height: 240px;
  max-height: 84vh;
  max-height: 84svh;
  background: var(--navy);
  overflow: hidden;
  overflow: clip;
  container-type: inline-size;
}

.study__label {
  grid-row: 1;
  display: grid;
  gap: 2px;
  padding-bottom: 2px;
}

.study--a .study__plate {
  grid-column: 1 / span 8;
}

.study--a .study__label {
  grid-column: 9 / -1;
}

.study--b .study__plate {
  grid-column: 5 / -1;
}

.study--b .study__label {
  grid-column: 1 / span 4;
}

.study__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* the photograph lies beneath the characters, in exact register with them (same crop, same fit).
   A lens under the cursor looks through to it; the switch in the label shows it whole. */
.study__lens {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
  -webkit-mask-image: radial-gradient(circle var(--lr, 150px) at var(--lx, 50%) var(--ly, 50%), #000 62%, transparent 100%);
  mask-image: radial-gradient(circle var(--lr, 150px) at var(--lx, 50%) var(--ly, 50%), #000 62%, transparent 100%);
}

.study.is-lens .study__lens {
  opacity: 1;
}

.study.is-photo .study__lens {
  opacity: 1;
  -webkit-mask-image: none;
  mask-image: none;
}

.study__photo {
  position: absolute;
  inset: 3.5%;
  width: 93%;
  height: 93%;
  max-width: none;
  object-fit: contain;
}

@container (max-width: 519px) {
  .study__photo {
    inset: 1.2%;
    width: 97.6%;
    height: 97.6%;
  }
}

.study__toggle {
  justify-self: start;
  margin: 10px 0 0 -2px;
  padding: 8px 2px;
  border: 0;
  background: none;
  font: 500 var(--t-note) / 1.4 var(--mono);
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.no-js .study__toggle {
  display: none;
}

/* ---- the product that the plates belong to */
.product {
  padding-top: 0;
}

.product__title {
  grid-column: 1 / span 7;
  font-size: clamp(2.75rem, 1rem + 7vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
  margin-left: -0.04em;
}

.product__buy {
  grid-column: 8 / -1;
  display: grid;
  gap: 18px;
}

.product__price {
  font-size: var(--t-h3);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--gold);
}

.product__rows {
  margin: 0;
}

.product__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 6px;
}

.product__hint {
  margin-bottom: calc(clamp(40px, 8vh, 104px) * -0.6);
}

.product__hint-coarse {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .product__hint-fine {
    display: none;
  }

  .product__hint-coarse {
    display: inline;
  }
}

.catalogue--after {
  padding-top: clamp(96px, 17vh, 210px);
}

/* plain-text version of each study: shown without JavaScript or WebGL */
.study__fallback {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  font: 700 0.86vw / 1.02 var(--mono);
  font-size: 1.43cqw;
  white-space: pre;
  color: var(--gold);
  -webkit-user-select: none;
  user-select: none;
}

.no-js .study__fallback,
.study.is-fallback .study__fallback {
  display: block;
}

.no-js .study__canvas,
.study.is-fallback .study__canvas {
  display: none;
}

@media (max-width: 900px) {
  .studies__head,
  .study {
    display: block;
  }

  .studies__copy {
    margin-top: 18px;
    padding-bottom: 0;
  }

  .product__buy {
    margin-top: 28px;
  }

  .study__label {
    flex-wrap: wrap;
  }

  .study__toggle {
    flex-basis: 100%;
    margin-top: 2px;
    text-align: left;
  }

  /* on small screens the plates run edge to edge, so the characters can be as large as possible */
  .study__plate {
    width: calc(100% + var(--gutter) * 2);
    margin-inline: calc(var(--gutter) * -1);
  }

  .study__fallback {
    font-size: 1.4vw;
    font-size: 1.43cqw;
  }

  .study__label {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
  }
}

/* ---------------------------------------------------------------- checkout */

.checkout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(36px, 6vh, 64px) clamp(28px, 6vw, 112px);
  align-items: start;
  padding-inline: var(--gutter);
}

.notice {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 28px;
  align-items: baseline;
  padding: 22px 24px;
  box-shadow: inset 0 0 0 1px var(--gold-line);
}

.notice__title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--gold);
}

.notice__text {
  max-width: 44em;
  color: var(--ink-2);
}

.form {
  display: grid;
  gap: 36px;
}

.form__group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form__legend {
  padding: 0;
  margin-bottom: 20px;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 24px;
}

.field {
  display: grid;
  gap: 4px;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  font: 400 var(--t-note) / 1.4 var(--mono);
  color: var(--ink-2);
}

.field__control {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.field__prefix {
  font: 400 1rem / 1 var(--mono);
  color: var(--ink-3);
}

.field__input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.field__input:disabled {
  color: var(--ink-3);
  -webkit-text-fill-color: var(--ink-3);
  opacity: 1;
  cursor: not-allowed;
}

.field__input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

.summary {
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  min-width: 0;
  padding: 26px 26px 24px;
  background: var(--navy);
}

.summary__title {
  margin-bottom: 18px;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.summary__empty {
  padding: 34px 0 38px;
  border-block: 1px solid var(--line);
  color: var(--ink-2);
}

.summary__rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 20px 0 0;
}

/* receipt rows: label, a leader of dots, value */
.summary__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font: 400 var(--t-small) / 1.4 var(--mono);
}

.summary__row dt {
  color: var(--ink-2);
}

.summary__row dd {
  margin: 0;
}

.summary__row::before {
  content: "........................................................................................................................";
  order: 1;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-3);
  letter-spacing: 0.2em;
  white-space: nowrap;
}

.summary__row dd {
  order: 2;
}

.summary__row--total {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.summary__row--total dt,
.summary__row--total dd {
  color: var(--ink);
  font-weight: 500;
}

@media (max-width: 900px) {
  .checkout {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary {
    position: static;
  }

  .notice {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .fields {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- support */

.support {
  display: grid;
  gap: clamp(36px, 8vh, 96px);
  padding-inline: var(--gutter);
}

.support__lead {
  max-width: 19em;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.support__address {
  display: block;
  width: -moz-fit-content;
  width: fit-content;
  max-width: 100%;
  padding-bottom: 0.12em;
  font: 500 clamp(1.3rem, 6.35vw, 6.25rem) / 1 var(--mono);
  letter-spacing: -0.04em;
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(var(--gold), var(--gold)) 0 100% / 0 2px no-repeat;
  transition: background-size 0.7s var(--ease), color 0.3s linear;
}

.support__address:hover,
.support__address:focus-visible {
  background-size: 100% 2px;
  color: var(--gold);
}

.support__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
}

.support__copy {
  max-width: 30em;
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- not found */

.lost {
  display: grid;
  gap: 28px;
  justify-items: start;
  padding-inline: var(--gutter);
}

.lost__code {
  margin: 0;
  font: 700 clamp(0.36rem, 1.05vw, 0.95rem) / 1.02 var(--mono);
  white-space: pre;
  color: var(--gold);
  -webkit-user-select: none;
  user-select: none;
}

.lost__text {
  max-width: 26em;
  font-size: var(--t-lead);
  color: var(--ink-2);
}
