@font-face {
  font-family: "Brains Courage";
  src: url("/assets/font/brains-courage.woff2") format("woff2");
  font-display: swap;
}

:root {
  --wall: #ffffff;
  --ink: #141414;
  --muted: #6b6b6b;
  --hair: #ececec;
  --type: "Brains Courage", "Times New Roman", serif;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 80px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--type);
  font-size: 18px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
img, picture { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  background: var(--wall);
}
.mark {
  grid-column: 2;
  margin: 0;
  font-size: clamp(36px, 4.8vw, 60px);
  font-weight: 400;
  letter-spacing: .02em;
  margin-right: -.02em;
  line-height: 1;
}
.bag-open {
  justify-self: end;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 0 10px 12px;
  border: 0;
  background: none;
  font-size: 19px;
  cursor: pointer;
}
.bag-open .count { font-size: 15px; color: var(--muted); transition: transform .4s var(--ease); }
.bag-open.bump .count { transform: translateY(-4px); color: var(--ink); }

/* ---------- the wall ---------- */
.wall { padding: clamp(28px, 6vw, 72px) var(--gutter) clamp(80px, 12vw, 160px); }
.model + .model { margin-top: clamp(72px, 11vw, 150px); }
.label {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 clamp(8px, 2vw, 24px);
  font-weight: 400;
  font-size: clamp(24px, 2.6vw, 32px);
}
.label .price { font-size: .62em; color: var(--muted); }

.pegs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(4px, 2vw, 40px) clamp(8px, 3vw, 56px);
  max-width: 1180px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.pegs li { width: calc((100% - 2 * clamp(8px, 3vw, 56px)) / 3); max-width: 360px; }
.piece {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
}
.piece img {
  width: 100%;
  height: auto;
  /* the shadow is baked into the image files; no CSS filter, so nothing extra to paint */
  transition: transform .6s var(--ease);
}
.piece .tag {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  letter-spacing: .02em;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
@media (hover: hover) {
  .piece:hover img { transform: translateY(-8px); }
  .piece:hover .tag { opacity: 1; transform: none; }
}
.piece:focus-visible .tag { opacity: 1; transform: none; }

.foot {
  padding: 0 var(--gutter) max(28px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}
.foot p { margin: 10px 0 0; }
.policies { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; font-size: 16px; }
.policies a, .final a, .doc a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.policies a { display: inline-block; padding: 6px 0; }
.policies a[aria-current="page"] { text-decoration-thickness: 2px; }

/* the "all sales final" notice next to Add to bag and above the payment buttons */
.final { margin: 12px 0 0; font-family: var(--text); font-size: 14px; line-height: 1.45; color: var(--muted); text-align: center; }
.bag-foot .final { margin: 0 0 14px; }

/* ---------- policy pages ---------- */
.top a.mark { color: inherit; text-decoration: none; }
.doc {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) clamp(64px, 10vw, 120px);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.6;
}
.doc h1 { margin: 0; font-family: var(--type); font-size: clamp(38px, 5vw, 54px); font-weight: 400; line-height: 1; }
.doc h2 { margin: 40px 0 6px; font-family: var(--type); font-size: 26px; font-weight: 400; line-height: 1.1; }
.doc .updated { margin: 10px 0 30px; font-size: 15px; color: var(--muted); }
.doc p, .doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 8px; }

/* ---------- dialogs ---------- */
dialog {
  margin: 0;
  padding: 0;
  border: 0;
  max-width: none;
  max-height: none;
  background: var(--wall);
  color: var(--ink);
}
.close {
  padding: 10px 0 10px 12px;
  border: 0;
  background: none;
  font-size: 18px;
  cursor: pointer;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 21px;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition: background .3s;
}
.btn:hover { background: #000; }

/* product view */
#piece { width: 100vw; height: 100dvh; }
#piece[open] { animation: rise .5s var(--ease); }
#piece .close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: var(--gutter); z-index: 1; }
.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 400px);
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 96px);
  min-height: 100%;
  padding: 72px var(--gutter) 48px;
}
.sheet figure { margin: 0; }
.sheet figure img {
  width: 100%;
  max-width: 760px;
  max-height: 76dvh;
  margin: 0 auto;
  object-fit: contain;
  transition: opacity .25s;
}
.sheet figure img.swap { opacity: 0; }
.info h2 { margin: 0; font-size: clamp(34px, 4vw, 48px); font-weight: 400; line-height: 1; }
.info .details { margin: 14px 0 0; font-size: 18px; letter-spacing: .02em; color: var(--muted); }
.info .price { margin: 22px 0 0; font-size: 26px; }
.pick { margin: 30px 0 34px; }
.pick .now { display: block; margin-bottom: 10px; font-size: 18px; letter-spacing: .02em; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 0 -5px; }
.swatch {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.swatch::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--c);
  /* a ring dark enough to see on the light swatches (WCAG 1.4.11) */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.size { margin: 14px 0 0; font-size: 17px; letter-spacing: .02em; color: var(--muted); text-align: center; }

/* bag drawer */
#bag {
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  height: 100dvh;
  box-shadow: -24px 0 70px rgba(0, 0, 0, .08);
}
#bag[open] { display: flex; flex-direction: column; animation: slide .45s var(--ease); }
#bag::backdrop { background: rgba(255, 255, 255, .6); }
.bag-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) 28px 18px;
  border-bottom: 1px solid var(--hair);
}
.bag-head h2 { margin: 0; font-size: 28px; font-weight: 400; }
.lines { flex: 1; overflow: auto; margin: 0; padding: 8px 28px; list-style: none; }
.line {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hair);
}
.line img { width: 84px; height: auto; }
.line .what { font-size: 20px; }
.line .what small { display: block; font-size: 17px; letter-spacing: .02em; color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 16px; }
.qty button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #8a8a8a;
  border-radius: 50%;
  background: none;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.qty span { min-width: 22px; text-align: center; }
.line .sum { font-size: 18px; }
.empty { padding: 48px 0; color: var(--muted); text-align: center; }
.empty small { display: block; margin-top: 10px; font-size: 15px; letter-spacing: .02em; }
.bag-foot {
  max-height: 78dvh;
  overflow: auto;
  padding: 20px 28px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair);
}
.pay { min-height: 50px; }
.pay-note { margin: 12px 0 0; font-size: 17px; letter-spacing: .02em; color: var(--muted); text-align: center; }
.total { display: flex; justify-content: space-between; margin-bottom: 16px; font-size: 22px; }
.bag-foot[hidden] { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .pegs { gap: 6px 10px; }
  .pegs li { width: calc((100% - 10px) / 2); }
  .piece .tag { display: none; }
  .sheet {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    padding: 58px var(--gutter) 22px;
  }
  .sheet figure img { max-height: 46dvh; }
  .pick { margin: 24px 0 26px; }
  .bag-head, .lines, .bag-foot { padding-left: 20px; padding-right: 20px; }
  .line { grid-template-columns: 72px 1fr auto; gap: 12px; }
  .line img { width: 72px; }
}

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