/* Ondrellis | midnight, ivory and gold */

:root {
  /* Palette: five named values */
  --midnight: #0E0E10;             /* hero, header, vault, footer */
  --ivory: #FAF7F2;                /* collection ground */
  --gold: #C9A96E;                 /* the mark, hairlines, focus on dark */
  --vellum: #ECE7DE;               /* image plates on ivory */
  --mist: #6B6558;                 /* secondary text on ivory */

  --ivory-soft: rgba(250, 247, 242, 0.72);
  --ivory-faint: rgba(250, 247, 242, 0.6);
  --gold-rule: rgba(201, 169, 110, 0.4);
  --ink-rule: rgba(14, 14, 16, 0.14);

  /* Type: Bodoni for the mark and display, Instrument Sans for everything else */
  --font-display: 'Bodoni Moda', 'Didot', Georgia, serif;
  --font-text: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
}

/* ---------- Base ---------- */

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--ivory);
  color: var(--midnight);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

a { color: inherit; }

[id] { scroll-margin-top: 6rem; }

:focus-visible {
  outline: 1.5px solid var(--midnight);
  outline-offset: 4px;
}

.site-header :focus-visible,
.hero :focus-visible,
.vault :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--gold);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A text link whose underline draws in on hover and focus */
.text-link {
  padding-bottom: 0.35rem;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease);
}

.text-link:hover,
.text-link:focus-visible {
  background-size: 100% 1px;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.5rem var(--gutter);
  background: var(--midnight);
  color: var(--ivory);
}

.site-nav {
  display: flex;
  gap: 2.25rem;
  font-size: 0.9375rem;
}

.site-nav a,
.bag-button {
  color: var(--ivory-soft);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.4s var(--ease);
}

.site-nav a:hover,
.bag-button:hover {
  color: var(--gold);
}

.bag-button {
  justify-self: end;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  text-decoration: none;
  padding-left: 0.42em; /* balances the trailing letter-space so the name stays centred */
  color: var(--ivory);
}

/* ---------- Hero: the logo lockup ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8rem var(--gutter) 6rem;
  background: var(--midnight);
  color: var(--ivory);
  text-align: center;
  overflow: hidden;
}

.hero-mark {
  position: relative;
}

.hero-o {
  position: relative;
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(8rem, 26vw, 21rem);
  line-height: 1;
  color: var(--gold);
  animation: rise 1.6s var(--ease) 0.5s both;
}

/* The hairline runs the full width of the screen, through the O */
.hero-o::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 1px;
  background: var(--gold);
  transform: translate(-50%, -50%);
  animation: draw 1.8s var(--ease) 0.2s both;
}

.hero-name {
  margin-top: 2.5rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.9375rem, 1.5vw, 1.125rem);
  letter-spacing: 0.5em;
  padding-left: 0.5em; /* balances the trailing letter-space */
  text-transform: uppercase;
  animation: fade 0.9s var(--ease) 1.1s both;
}

.hero-tagline {
  margin-top: 1.5rem;
  max-width: 30ch;
  color: var(--ivory-soft);
  font-size: 1.125rem;
  animation: fade 0.9s var(--ease) 1.5s both;
}

.hero-link {
  margin-top: 2.75rem;
  color: var(--gold);
  font-size: 0.9375rem;
  animation: fade 0.9s var(--ease) 1.8s both;
}

/* ---------- Collection: heading and filters ---------- */

.collection {
  padding: 7.5rem var(--gutter) 4rem;
}

.collection-head {
  max-width: 1400px;
  margin: 0 auto;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--ink-rule);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem 3rem;
}

.collection-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 4.2vw, 3.5rem);
  line-height: 1.05;
}

.collection-intro {
  margin-top: 0.75rem;
  color: var(--mist);
  font-size: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.filter {
  padding: 0.4rem 0;
  font-size: 0.9375rem;
  color: var(--mist);
  background: linear-gradient(var(--gold), var(--gold)) left bottom / 0 1px no-repeat;
  transition: color 0.4s var(--ease), background-size 0.6s var(--ease);
}

.filter:hover {
  color: var(--midnight);
}

.filter[aria-pressed="true"] {
  color: var(--midnight);
  background-size: 100% 1px;
}

/* ---------- The wall: one continuous field, shuffled ---------- */

/* Pieces are placed by script.js into the shortest column,
   so many sit on screen at once and the wall keeps growing down the page. */
.wall {
  position: relative;
  max-width: 1400px;
  margin: 3.5rem auto 0;
}

.piece {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: clamp(2.75rem, 4.5vw, 4rem); /* the gap between pieces in a column */
}

/* Glide into place when the filter or the width changes */
.wall.is-ready .piece {
  transition: transform 0.9s var(--ease);
}

.piece.is-entering {
  animation: fade 0.6s var(--ease) both;
}

.piece-media {
  width: 100%;
  aspect-ratio: var(--ratio, 4 / 5);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--vellum);
}

.piece-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.piece-mark {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 6vw, 5.5rem);
  line-height: 1;
  color: var(--gold);
}

.piece[data-rarity="one"] .piece-mark {
  font-size: clamp(5rem, 10vw, 9rem);
}

.piece-info {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
}

.piece-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.25;
}

/* One of one: the statement pieces, two columns wide */
.piece[data-rarity="one"] .piece-name {
  font-size: clamp(1.75rem, 2.4vw, 2.5rem);
}

.piece-note {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--mist);
}

.piece-buy {
  margin-top: 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.piece-price,
.piece-add {
  white-space: nowrap;
}

.piece-price {
  font-weight: 500;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.piece-add {
  font-size: 0.9375rem;
  color: var(--midnight);
}

/* ---------- The Vault ---------- */

.vault {
  padding: 9rem var(--gutter);
  background: var(--midnight);
  color: var(--ivory);
  text-align: center;
}

.vault-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 1;
}

.vault-line {
  margin: 1.75rem auto 0;
  max-width: 34ch;
  text-wrap: balance;
  color: var(--ivory-soft);
  font-size: 1.125rem;
}

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

.site-footer {
  padding: 4.5rem var(--gutter) 3.5rem;
  background: var(--midnight);
  color: var(--ivory-faint);
  text-align: center;
  font-size: 0.9375rem;
  border-top: 1px solid var(--gold-rule);
}

.site-footer .wordmark {
  display: inline-block;
  font-size: 0.9375rem;
  color: var(--ivory);
  margin-bottom: 1.5rem;
}

.site-footer p + p {
  margin-top: 0.35rem;
}

.site-footer a {
  color: var(--gold);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-footer .fine {
  font-size: 0.8125rem;
}

.site-footer .fine:last-child {
  margin-top: 2.5rem;
}

/* ---------- Motion: one page-load sequence, plus a short fade when filters change ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes draw {
  from { transform: translate(-50%, -50%) scaleX(0); }
  to   { transform: translate(-50%, -50%) scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Phone ---------- */

@media (max-width: 760px) {
  .wall {
    margin-top: 2.5rem;
  }

  .piece-name {
    font-size: 1.125rem;
  }

  /* Two narrow columns: price above the link, neither wraps */
  .piece-buy {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 640px) {
  [id] { scroll-margin-top: 8rem; }

  .site-header {
    grid-template-columns: 1fr auto;
    row-gap: 1rem;
    padding-top: 1.125rem;
    padding-bottom: 1rem;
  }

  .wordmark {
    grid-column: 1 / -1;
    order: -1;
    justify-self: center;
  }

  .site-nav {
    gap: 1.5rem;
    font-size: 0.875rem;
  }

  .site-nav a,
  .bag-button {
    font-size: 0.875rem;
  }

  .collection {
    padding-top: 6rem;
  }

  .filters {
    gap: 0.5rem 1.25rem;
  }

  .filter {
    font-size: 0.875rem;
  }

  .vault {
    padding-top: 6.5rem;
    padding-bottom: 6.5rem;
  }
}