/* PJPJ — the whole site is a pair of pyjamas:
   poplin white, blue pinstripe, navy piping, pearl buttons. */

:root {
  --poplin: #F6F8FC;
  --stripe: #E0E8F4;
  --chambray: #8EA7D1;
  --piping: #1C2B5A;
  --ink: #26314F;
  --muted: #5A6482;
  --nightlight: #F4C24D;
  --flannel: #B4302F;

  --display: "Young Serif", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, sans-serif;

  --pipe: 4px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 1240px;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--poplin);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--piping);
  margin: 0;
  line-height: 1.05;
}

h2 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -0.01em; }
h3 { font-size: 1.3125rem; line-height: 1.2; }

p { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--nightlight);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--piping); color: var(--poplin);
  padding: .5rem 1rem; z-index: 100;
}
.skip:focus { top: 1rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  font: 500 1rem/1 var(--body);
  color: var(--poplin);
  background: var(--piping);
  border: 0;
  border-radius: 999px;
  padding: .95rem 1.5rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease;
}
.btn:hover { background: #2B3D78; }
.btn-light { background: var(--poplin); color: var(--piping); }
.btn-light:hover { background: #FFFFFF; }
.btn-wide { width: 100%; }

.text-link {
  font-weight: 500;
  color: var(--piping);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* A sewn-on pyjama button: pearl disc, four holes. Used for ratings and the bag count. */
.pj-button {
  --size: 1.25rem;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, var(--piping) 0 9%, transparent 10%),
    radial-gradient(circle at 65% 35%, var(--piping) 0 9%, transparent 10%),
    radial-gradient(circle at 35% 65%, var(--piping) 0 9%, transparent 10%),
    radial-gradient(circle at 65% 65%, var(--piping) 0 9%, transparent 10%),
    #FFFFFF;
  box-shadow: inset 0 0 0 2px var(--piping);
  display: inline-block;
}

/* ---------- Header ---------- */

.announce {
  background: var(--piping);
  color: var(--poplin);
  text-align: center;
  font-size: .875rem;
  padding: .55rem var(--gutter);
}

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem var(--gutter);
  background: var(--poplin);
  border-bottom: var(--pipe) solid var(--piping);
}

.logo {
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  color: var(--piping);
  text-decoration: none;
  line-height: 1;
}

.nav { display: none; gap: 1.75rem; margin-left: auto; }
.nav a { text-decoration: none; font-weight: 500; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.bag-button {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: .55rem;
  font: 500 1rem/1 var(--body);
  color: var(--piping);
  background: transparent;
  border: 2px solid var(--piping);
  border-radius: 999px;
  padding: .5rem .55rem .5rem 1rem;
  cursor: pointer;
}
.bag-count {
  min-width: 1.6rem; height: 1.6rem;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--nightlight);
  color: var(--piping);
  font-size: .875rem; font-weight: 700;
}

@media (min-width: 760px) {
  .nav { display: flex; }
  .bag-button { margin-left: 1rem; }
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: 2rem;
  padding: clamp(2.5rem, 7vw, 5rem) var(--gutter) 0;
  background: repeating-linear-gradient(90deg, var(--stripe) 0 3px, transparent 3px 22px), var(--poplin);
  border-bottom: var(--pipe) solid var(--piping);
  overflow: hidden;
}

.hero-copy { max-width: 34rem; align-self: center; }

.hero h1 {
  font-size: clamp(4rem, 15vw, 9.5rem);
  letter-spacing: -0.035em;
  line-height: .9;
}

.lede {
  margin-top: 1.25rem;
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  max-width: 30ch;
  color: var(--ink);
  background: var(--poplin);
  box-shadow: 0 0 0 .4rem var(--poplin);
}

.hero-actions {
  margin-top: 2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 1.75rem;
}
.hero-actions .text-link { background: var(--poplin); box-shadow: 0 0 0 .3rem var(--poplin); }

.hero-art {
  margin: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-self: center;
  width: min(100%, 30rem);
}
.hero-art img { width: 100%; height: auto; }
.hero-art figcaption {
  font-size: .875rem; color: var(--muted);
  background: var(--poplin);
  padding: .35rem .75rem;
  margin: .75rem 0 1.5rem;
  text-align: center;
}

.hanging { width: 100%; transform-origin: 50% 0; }

@media (prefers-reduced-motion: no-preference) {
  .hanging { animation: hang 2.6s cubic-bezier(.3, .7, .3, 1) .2s both; }
}

@keyframes hang {
  0%   { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  20%  { transform: translateY(0) rotate(5deg); opacity: 1; }
  40%  { transform: rotate(-3.5deg); }
  58%  { transform: rotate(2deg); }
  75%  { transform: rotate(-1deg); }
  88%  { transform: rotate(.4deg); }
  100% { transform: rotate(0deg); }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.1fr 1fr;
    align-items: end;
    min-height: min(82vh, 760px);
    padding-left: max(var(--gutter), calc((100vw - var(--max)) / 2));
    padding-right: max(var(--gutter), calc((100vw - var(--max)) / 2));
  }
  .hero-copy { padding-bottom: 5rem; }
}

/* ---------- Sections ---------- */

.shop, .sizes, .reviews, .model {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter);
}

.section-head {
  display: grid; gap: .6rem;
  margin-bottom: 2.25rem;
}
.section-head p { color: var(--muted); max-width: 46ch; }

@media (min-width: 900px) {
  .section-head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .section-head p { text-align: right; }
}

/* ---------- Products ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.25rem 1rem;
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3rem 1.5rem; }
}

.product { display: flex; flex-direction: column; }

.product-art {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--tint, #E9EEF7);
  border-bottom: var(--pipe) solid var(--piping);
  display: grid; place-items: center;
  padding: 8% 6% 5%;
}
.product-art svg, .product-art img { width: 100%; height: 100%; object-fit: contain; }
.product-art img.photo { position: absolute; inset: 0; object-fit: cover; padding: 0; }

.badge {
  position: absolute; top: .6rem; left: .6rem;
  background: var(--flannel); color: #FFF;
  font-size: .75rem; font-weight: 700;
  padding: .3rem .55rem; border-radius: 999px;
}

.product h3 { margin-top: 1rem; }
.product .price { margin-top: .2rem; font-weight: 700; color: var(--piping); }
.product .blurb { margin-top: .4rem; font-size: .9375rem; color: var(--muted); flex: 1; }

.add {
  margin-top: 1rem;
  align-self: flex-start;
  font: 500 .9375rem/1 var(--body);
  color: var(--piping);
  background: transparent;
  border: 2px solid var(--piping);
  border-radius: 999px;
  padding: .7rem 1.1rem;
  cursor: pointer;
}
.add:hover { background: var(--piping); color: var(--poplin); }

/* ---------- Model ---------- */

.model {
  display: grid; gap: 2.5rem;
  align-items: center;
}
.model-art { margin: 0; }
.model-art svg, .model-art img { width: 100%; height: auto; border-bottom: var(--pipe) solid var(--piping); }
.model-art figcaption { margin-top: .75rem; font-size: .875rem; color: var(--muted); }

.model-copy > p { margin-top: 1.25rem; max-width: 52ch; }

.facts {
  margin: 2rem 0 0;
  border-top: 2px solid var(--piping);
}
.facts div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--stripe);
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; color: var(--piping); text-align: right; }

@media (min-width: 900px) {
  .model { grid-template-columns: 5fr 6fr; gap: 5rem; }
}

/* ---------- Sizes ---------- */

.sizes { padding-top: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 1rem .75rem 1rem 0; border-bottom: 1px solid var(--stripe); }
thead th { font-weight: 500; color: var(--muted); border-bottom: 2px solid var(--piping); }
tbody th { font-family: var(--display); font-weight: 400; font-size: 1.3125rem; color: var(--piping); width: 5rem; }
.pj-row th, .pj-row td { color: var(--piping); font-weight: 700; }
.pj-row { background: linear-gradient(90deg, rgba(244, 194, 77, .28), rgba(244, 194, 77, 0)); }
.pj-row th { padding-left: .5rem; }

/* ---------- Reviews ---------- */

.reviews { padding-top: 0; }
.review-list { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .review-list { grid-template-columns: repeat(3, 1fr); gap: 3rem; } }

.review { margin: 0; border-top: var(--pipe) solid var(--piping); padding-top: 1.25rem; }
.rating { display: flex; gap: .3rem; }
.review p {
  margin-top: 1rem;
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--piping);
}
.review footer { margin-top: 1rem; color: var(--muted); font-size: .9375rem; }

/* ---------- Sleep Club ---------- */

.club {
  background: var(--piping);
  color: var(--poplin);
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter);
}
.club-inner { max-width: 40rem; margin: 0 auto; text-align: center; }
.club h2 { color: var(--poplin); }
.club p { margin-top: .75rem; color: #C9D3EA; }

.club-form {
  margin-top: 1.75rem;
  display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center;
}
.club-form input {
  flex: 1 1 16rem;
  font: 400 1rem var(--body);
  padding: .9rem 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--poplin);
  background: transparent;
  color: var(--poplin);
}
.club-form input::placeholder { color: #9AA6C6; }
.club .club-done { color: var(--nightlight); font-weight: 500; margin-top: 1.5rem; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 3rem var(--gutter) 2.5rem;
  max-width: var(--max);
  margin: 0 auto;
}
.footer-mark {
  font-family: var(--display);
  font-size: clamp(5rem, 26vw, 20rem);
  line-height: .8;
  letter-spacing: -0.04em;
  color: transparent;
  background: repeating-linear-gradient(90deg, var(--piping) 0 6px, var(--chambray) 6px 12px);
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: 2rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; }
.footer-nav a { font-weight: 500; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.fine { margin-top: 1.5rem; font-size: .875rem; color: var(--muted); max-width: 60ch; }

/* ---------- Bag drawer ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(28, 43, 90, .45);
}

.bag {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(100%, 26rem);
  background: var(--poplin);
  border-left: var(--pipe) solid var(--piping);
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: no-preference) {
  .bag:not([hidden]) { animation: slide-in .25s ease-out; }
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }

.bag-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--piping);
}
.bag-head h2 { font-size: 1.75rem; }
.close {
  width: 2.5rem; height: 2.5rem;
  font-size: 1.75rem; line-height: 1;
  color: var(--piping);
  background: transparent;
  border: 2px solid var(--piping);
  border-radius: 50%;
  cursor: pointer;
}

.bag-body { flex: 1; overflow-y: auto; padding: .5rem 1.5rem; }
.bag-empty { padding: 2rem 0; color: var(--muted); }
.bag-empty a { color: var(--piping); font-weight: 500; }

.line {
  display: grid; grid-template-columns: 4rem 1fr auto;
  gap: 1rem; align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--stripe);
}
.line-art { aspect-ratio: 4 / 5; background: var(--tint, #E9EEF7); padding: 8%; }
.line-art svg, .line-art img { width: 100%; height: 100%; object-fit: contain; }
.line-name { font-weight: 500; color: var(--piping); }
.line-meta { font-size: .875rem; color: var(--muted); }
.line-remove {
  font: 500 .875rem var(--body);
  color: var(--muted);
  background: none; border: 0; padding: 0;
  text-decoration: underline; cursor: pointer;
}

.bag-foot { padding: 1.25rem 1.5rem 1.5rem; border-top: 2px solid var(--piping); }
.bag-total {
  display: flex; justify-content: space-between;
  font-weight: 700; color: var(--piping);
  margin-bottom: 1rem;
}
.checkout-note { margin-top: .9rem; font-size: .9375rem; color: var(--flannel); font-weight: 500; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 60;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem;
  background: var(--piping); color: var(--poplin);
  padding: .8rem .8rem .8rem 1.2rem;
  border-radius: 999px;
  font-size: .9375rem;
  width: max-content; max-width: calc(100% - 2rem);
}
.toast button {
  font: 700 .875rem var(--body);
  color: var(--piping); background: var(--nightlight);
  border: 0; border-radius: 999px;
  padding: .5rem .9rem; cursor: pointer;
}
