/* The print grid that becomes the print page, with the mat that widens
   The shop window of a made-up print studio, Halden Editions, on a warm gallery white. Six framed prints of ours sit in
   a grid; the chosen one leaves it and becomes the page of the print. Every size is measured on the width and on the
   height (min of vw and vh), so the grid and the page fit a wide desktop and the small square box of a phone alike. */
:root {
  --paper: #f4f0e9;          /* the gallery wall */
  --paper-light: #fbf8f3;    /* the light from the top of the wall */
  --ink: #1d1b18;            /* the words and the button */
  --muted: #827a6f;          /* the small words */
  --line: rgba(29, 27, 24, 0.14); /* the hairlines */
  --accent: #b5532c;         /* terracotta: the price tag, the bag count, the measuring rule */
  --mat: #fbf9f4;            /* the passe-partout */
  --mat-edge: #e6dfd3;       /* the bevel of the mat around the print */
  --oak-light: #dcc39d;      /* the oak frame where the light hits it */
  --oak: #b8915f;            /* the oak frame */
  --oak-dark: #8a6640;       /* the oak frame in shadow */
  --button-ink: #fbf8f3;     /* the words on the button */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.shop {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--paper-light) 0%, rgba(251, 248, 243, 0) 60%),
    radial-gradient(90% 60% at 50% 120%, rgba(29, 27, 24, 0.05), rgba(29, 27, 24, 0) 70%),
    var(--paper);
}

/* a very fine paper grain over the wall */
.shop::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the header */
.top {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(34px, min(7vw, 7.5vh), 64px);
  padding: 0 clamp(12px, min(3.4vw, 4.4vh), 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: clamp(10px, min(1.25vw, 1.6vh), 14px);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
}

.brand__mark {
  align-self: center;
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
}

.brand__name {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: 1.35em;
  font-variation-settings: 'opsz' 60, 'SOFT' 50;
  font-weight: 460;
  letter-spacing: -0.01em;
}

.brand__sub {
  color: var(--muted);
  font-variation-settings: 'wdth' 112;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78em;
}

.nav {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 2.2vw, 28px);
}

.nav__item {
  color: var(--muted);
}

.nav__item--on {
  color: var(--ink);
}

.bag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.bag__icon {
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.bag__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  border-radius: 1em;
  background: var(--accent);
  color: var(--button-ink);
  font-size: 0.8em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the grid */
.grid {
  --w: min(24vw, 24.5vh);
  position: absolute;
  inset: clamp(34px, min(7vw, 7.5vh), 64px) 0 0 0;
  display: grid;
  grid-template-columns: repeat(3, var(--w));
  grid-auto-rows: auto;
  justify-content: center;
  align-content: center;
  column-gap: min(4.4vw, 5vh);
  row-gap: min(3vw, 3.4vh);
}

.tile {
  position: relative;
  display: block;
  width: var(--w);
  text-align: left;
  outline: none;
}

/* GSAP moves the tile (steps back, fades) and the lift (hover, press); the frame keeps its CSS */
.tile__lift {
  position: relative;
  display: block;
  transform-origin: 50% 60%;
}

.tile__shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -2%;
  height: 22%;
  border-radius: 50%;
  background: rgba(40, 30, 18, 0.32);
  filter: blur(10px);
  opacity: 0.55;
  pointer-events: none;
}

.frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 0.78;
  padding: max(3px, calc(var(--w) * 0.032));
  background:
    repeating-linear-gradient(90deg, rgba(90, 60, 30, 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 5px),
    linear-gradient(135deg, var(--oak-light) 0%, var(--oak) 45%, var(--oak-dark) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 215, 0.35),
    inset 0 -1px 0 rgba(60, 40, 20, 0.35),
    0 1px 1px rgba(40, 28, 16, 0.18),
    0 6px 14px -6px rgba(40, 28, 16, 0.35);
}

.mat {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: calc(var(--w) * var(--matk, 0.075));
  background: var(--mat);
  box-shadow: inset 0 1px 2px rgba(40, 28, 16, 0.18);
}

/* the signature in pencil on the mat: shown only on the page of the print */
.sign {
  position: absolute;
  right: calc(var(--w) * var(--matk, 0.075));
  bottom: calc(var(--w) * var(--matk, 0.075) * 0.3);
  width: calc(var(--w) * 0.16);
  height: calc(var(--w) * 0.04);
  opacity: 0;
  fill: none;
  stroke: #8d867b;
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 90;
}

/* the bevelled cut of the mat around the print */
.art-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--mat-edge),
    0 0 0 2px #fffdf8;
}

.art-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .35 0 0 0 0 .3 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

.art {
  display: block;
  width: 100%;
  height: 100%;
}

/* the glass: a still reflection, and the band of gallery light that slides across it on hover */
.glass {
  position: absolute;
  inset: max(3px, calc(var(--w) * 0.032));
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.08) 100%);
}

.glass__band {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 70%;
  transform: translateX(-160%) skewX(-16deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 240, 0.16) 30%, rgba(255, 252, 240, 0.55) 50%, rgba(255, 252, 240, 0.16) 70%, rgba(255, 255, 255, 0) 100%);
  mix-blend-mode: screen;
}

.tile__cap {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  margin-top: min(1.4vw, 1.6vh);
  font-size: clamp(8.5px, min(1.15vw, 1.45vh), 13px);
  line-height: 1.25;
}

.tile__title {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-variation-settings: 'opsz' 30;
  font-size: 1.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile__price {
  color: var(--muted);
  font-size: 0.92em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tile:focus-visible .frame {
  outline: 1.5px solid var(--ink);
  outline-offset: 4px;
}

/* ---------------------------------------------------------------- the page of the print */
.detail {
  --gap: clamp(28px, min(5vw, 6vh), 80px);
  position: absolute;
  inset: clamp(34px, min(7vw, 7.5vh), 64px) 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  padding: 0 clamp(14px, 4vw, 56px);
  visibility: hidden;
}

.detail__stage {
  position: relative;
  flex: none;
}

/* the empty place the print flies to: the flight measures it */
.slot {
  position: relative;
  height: min(68vh, 50vw);
  aspect-ratio: 0.78;
}

/* the measuring rules beside and under the print */
.rule {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: var(--accent);
  font-size: clamp(8px, min(1vw, 1.3vh), 12px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.rule--w {
  left: 0;
  right: 0;
  bottom: calc(-1 * clamp(12px, 2.6vh, 26px));
  justify-content: center;
}

.rule--h {
  top: 0;
  bottom: 0;
  right: calc(-1 * clamp(12px, 2.6vh, 26px));
  width: 1px;
  justify-content: center;
}

.rule__line {
  position: absolute;
  background: currentColor;
  opacity: 0.7;
}

.rule--w .rule__line {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform-origin: 50% 50%;
}

.rule--h .rule__line {
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  transform-origin: 50% 50%;
}

/* the little end ticks of the rules */
.rule--w .rule__line::before,
.rule--w .rule__line::after,
.rule--h .rule__line::before,
.rule--h .rule__line::after {
  content: '';
  position: absolute;
  background: currentColor;
}

.rule--w .rule__line::before,
.rule--w .rule__line::after {
  top: -3px;
  width: 1px;
  height: 7px;
}

.rule--w .rule__line::before { left: 0; }
.rule--w .rule__line::after { right: 0; }

.rule--h .rule__line::before,
.rule--h .rule__line::after {
  left: -3px;
  width: 7px;
  height: 1px;
}

.rule--h .rule__line::before { top: 0; }
.rule--h .rule__line::after { bottom: 0; }

.rule__label {
  position: relative;
  padding: 0 0.5em;
  background: var(--paper);
}

.rule--h .rule__label {
  writing-mode: vertical-rl;
  padding: 0.5em 0;
}

.panel {
  flex: none;
  width: clamp(142px, 30vw, 380px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: clamp(9px, min(1.2vw, 1.55vh), 14px);
  line-height: 1.45;
}

.back {
  order: -1;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-bottom: clamp(10px, 4vh, 44px);
  padding: 0.35em 0.8em 0.35em 0.5em;
  border-radius: 2em;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92em;
  transition: background-color 0.25s, border-color 0.25s;
}

.back svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .back:hover {
    background: rgba(29, 27, 24, 0.05);
    border-color: rgba(29, 27, 24, 0.26);
  }
}

.eyebrow {
  margin: 0;
  display: flex;
  gap: 0.7em;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.eyebrow__year {
  color: var(--accent);
}

.title {
  margin: 0.2em 0 0.4em;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-weight: 380;
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  font-size: clamp(17px, min(4.4vw, 6vh), 58px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.title__line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.title__in {
  display: block;
}

.desc {
  margin: 0 0 1.4em;
  color: var(--muted);
  max-width: 30em;
}

.sizes {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 2em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  margin-bottom: 1.3em;
}

.sizes__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 2em;
  background: #fffdf9;
  box-shadow:
    0 0 0 1px rgba(29, 27, 24, 0.12),
    0 1px 2px rgba(29, 27, 24, 0.1),
    0 4px 10px -4px rgba(29, 27, 24, 0.22);
}

.size {
  position: relative;
  padding: 0.45em clamp(0.5em, 1vw, 0.9em);
  border-radius: 2em;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.size[aria-checked='true'] {
  color: var(--ink);
}

.buy {
  display: flex;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
}

.price {
  display: inline-flex;
  align-items: flex-start;
  font-size: 1.7em;
  font-weight: 520;
  font-variation-settings: 'wdth' 96;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
}

.price__cur {
  font-size: 0.7em;
  margin-top: 0.06em;
  margin-right: 0.06em;
}

.price__digits {
  display: inline-flex;
  height: 1em;
  overflow: hidden;
}

.digit {
  display: block;
  width: 0.6em;
}

.digit__col {
  display: block;
}

.digit__col span {
  display: block;
  height: 1em;
  text-align: center;
}

.add {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  height: 2.7em;
  padding: 0 1.3em;
  border-radius: 2em;
  color: var(--button-ink);
  overflow: hidden;
  isolation: isolate;
}

.add__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  background: linear-gradient(180deg, #34312c, var(--ink));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(29, 27, 24, 0.25),
    0 8px 18px -8px rgba(29, 27, 24, 0.55);
}

.add__sheen {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  transform: translateX(-180%) skewX(-18deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

.add__text {
  font-variation-settings: 'wdth' 100;
  font-weight: 540;
  white-space: nowrap;
}

.add__tick {
  width: 1.2em;
  height: 1.2em;
  margin-right: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
}

.ship {
  margin: 1.2em 0 0;
  padding-top: 0.9em;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9em;
  align-self: stretch;
}

/* ---------------------------------------------------------------- the print in flight */
.flyer {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  pointer-events: none;
}

.flyer .frame {
  height: 100%;
  aspect-ratio: auto;
}

.flyer__shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -3%;
  height: 24%;
  border-radius: 50%;
  background: rgba(40, 30, 18, 0.34);
  filter: blur(18px);
  opacity: 0.5;
}

/* tall phones: the print above, the page under it */
@media (max-aspect-ratio: 3/4) {
  .grid {
    --w: min(27vw, 21vh);
  }

  .detail {
    flex-direction: column;
    gap: clamp(26px, 4vh, 40px);
  }

  .slot {
    height: min(44vh, 84vw);
  }

  .panel {
    width: min(86vw, 380px);
    font-size: clamp(11px, 3.2vw, 14px);
  }

  .back {
    margin-bottom: 1em;
  }

  .title {
    font-size: clamp(22px, 7.5vw, 40px);
  }
}
