/*
 * Nouvella storefront.
 *
 * The page ground is the same navy the product photography was shot on, so a
 * cut-out sits on the page rather than on a card floating above it. Brand navy
 * (#2C3C58) and the studio ground (#0C2045) stay separate tokens: the first is
 * chrome, the second is the stage.
 *
 * Written throughout with logical properties. Arabic is the default direction
 * and one stylesheet has to serve both without a mirrored copy.
 */

:root {
  --ground: #0c2045;
  --ground-raised: #14284e;
  --ground-sunk: #081837;
  --navy: #2c3c58;

  --champagne: #f0d7b9;
  --ivory: #f4ead9;
  --muted: #9fb0cd;
  --gold: #c6a15b;
  --alert: #e0876b;

  --line: rgba(240, 215, 185, 0.16);
  --line-strong: rgba(240, 215, 185, 0.34);

  --display: "Prata", "Amiri", serif;
  --arabic-display: "Amiri", "Prata", serif;
  --ui: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 68rem;
  --radius: 2px;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ivory);
  font-family: var(--ui);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

.shell {
  width: min(100% - 2.5rem, var(--measure));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
}

.skip-link:focus {
  inset-inline-start: 1rem;
  top: 1rem;
  z-index: 20;
  background: var(--champagne);
  color: var(--ground);
  padding: 0.5rem 1rem;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-block-end: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 32, 69, 0.94);
  backdrop-filter: blur(8px);
}

.masthead__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.9rem;
}

.masthead__mark img {
  height: 44px;
  width: auto;
}

@media (max-width: 600px) {
  .masthead__mark img {
    height: 32px;
  }
}

.masthead__nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.9rem);
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

[dir="rtl"] .masthead__nav {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.9rem;
}

.masthead__nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.18s ease;
  white-space: nowrap;
}

.masthead__nav a:hover,
.masthead__nav a[aria-current] {
  color: var(--champagne);
}

.bag-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-inline-start: 0.4rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--champagne);
  color: var(--ground);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
}

/* -------------------------------------------------------------- typography */

.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--champagne);
  margin: 0;
}

[dir="rtl"] .display {
  font-family: var(--arabic-display);
  line-height: 1.35;
  letter-spacing: 0;
}

.display--xl {
  font-size: clamp(2.3rem, 6vw, 3.9rem);
}

.display--l {
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
}

.display--m {
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.9rem;
}

[dir="rtl"] .display--m {
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
}

.eyebrow {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.84rem;
}

.lede {
  color: var(--muted);
  max-width: 34rem;
  margin: 1rem 0 0;
}

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

/* ------------------------------------------------------------------ button */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.9rem;
  border: 1px solid var(--champagne);
  border-radius: var(--radius);
  background: var(--champagne);
  color: var(--ground);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

[dir="rtl"] .button {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.92rem;
}

.button:hover:not([disabled]) {
  background: transparent;
  color: var(--champagne);
}

.button[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
}

.button--quiet {
  background: transparent;
  color: var(--champagne);
  border-color: var(--line-strong);
}

.button--quiet:hover:not([disabled]) {
  border-color: var(--champagne);
  background: transparent;
}

.button--wide {
  width: 100%;
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.linkish:hover {
  color: var(--champagne);
}

/* ------------------------------------------------------------------ notice */

.notice {
  border: 1px solid var(--line-strong);
  border-inline-start: 2px solid var(--gold);
  background: var(--ground-raised);
  padding: 0.8rem 1.1rem;
  margin-block: 1.5rem;
  font-size: 0.9rem;
}

.notice--bad {
  border-inline-start-color: var(--alert);
}

/* ------------------------------------------------------------- the builder */

.builder {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
}

.builder__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

@media (min-width: 62rem) {
  .builder__grid {
    grid-template-columns: 1.15fr 1fr;
  }
}

/*
 * The stage. The cord photograph sets the box and the charm is positioned
 * against that box, so the charm lands on the lower strand at any width.
 * Both numbers were measured off the source photographs, not eyeballed: the
 * lowest cord strand starts at 93.7% of the cord image's height, and the
 * charm's real size relative to the choker puts it at 20.5% of the cord width.
 */
.stage {
  position: relative;
  padding-block-end: 20%;
}

.stage__cord {
  position: relative;
  width: 100%;
  aspect-ratio: 1100 / 475;
}

.stage__cord img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.stage__cord img.is-shown {
  opacity: 1;
}

.stage__charm {
  position: absolute;
  inset-inline-start: 50%;
  top: 81%;
  width: 20.5%;
  transform: translateX(-50%);
  transform-origin: 50% 4%;
  pointer-events: none;
}

.stage__charm img {
  width: 100%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}

/* The one flourish: a swapped charm settles instead of snapping into place. */
.stage__charm.is-settling {
  animation: settle 900ms cubic-bezier(0.32, 0.7, 0.36, 1);
}

@keyframes settle {
  0% {
    transform: translateX(-50%) rotate(-7deg);
  }
  35% {
    transform: translateX(-50%) rotate(4.2deg);
  }
  62% {
    transform: translateX(-50%) rotate(-2deg);
  }
  84% {
    transform: translateX(-50%) rotate(0.8deg);
  }
  100% {
    transform: translateX(-50%) rotate(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage__charm.is-settling {
    animation: none;
  }

  .stage__cord img {
    transition: none;
  }
}

/* ------------------------------------------------------------------ picker */

.picker + .picker {
  margin-block-start: 2.2rem;
}

.picker__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-block-end: 1px solid var(--line);
  padding-block-end: 0.6rem;
  margin-block-end: 1.1rem;
}

.picker__label h2 {
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
  margin: 0;
}

[dir="rtl"] .picker__label h2 {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.92rem;
}

.picker__chosen {
  font-size: 0.86rem;
  color: var(--ivory);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.swatch {
  position: relative;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--swatch, var(--muted));
}

.swatch:hover:not([disabled]) {
  transform: translateY(-2px);
}

.swatch[aria-pressed="true"] {
  border-color: var(--champagne);
  box-shadow: 0 0 0 1px var(--champagne);
}

.swatch[disabled] {
  cursor: not-allowed;
  opacity: 0.32;
}

/*
 * A sold-out colour is struck through rather than removed. Knowing that
 * turquoise exists and is gone is more useful than turquoise silently
 * vanishing from the row.
 */
.swatch[disabled]::before {
  content: "";
  position: absolute;
  inset-inline: 2px;
  top: 50%;
  height: 1px;
  background: var(--ivory);
  transform: rotate(-45deg);
  z-index: 1;
}

.charms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
  gap: 0.7rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.charm {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  align-content: center;
  width: 100%;
  min-height: 6rem;
  padding: 0.7rem 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ground-sunk);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.charm:hover:not([disabled]) {
  border-color: var(--line-strong);
}

.charm[aria-pressed="true"] {
  border-color: var(--champagne);
  background: var(--ground-raised);
}

.charm[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.charm img {
  height: 3.1rem;
  width: auto;
  object-fit: contain;
}

.charm__name {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.charm[aria-pressed="true"] .charm__name {
  color: var(--ivory);
}

/* ------------------------------------------------------------------ ticket */

/* The running total, set like the paper slip that goes in the box. */
.ticket {
  margin-block-start: 2.4rem;
  border-block-start: 1px solid var(--line-strong);
  padding-block-start: 1.3rem;
}

.ticket__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.ticket__description {
  font-size: 0.92rem;
  color: var(--muted);
}

.ticket__price {
  font-family: var(--display);
  font-size: 1.55rem;
  color: var(--champagne);
  white-space: nowrap;
}

.ticket__stock {
  font-size: 0.78rem;
  color: var(--alert);
  margin-block-start: 0.4rem;
  min-height: 1.2em;
}

.ticket form {
  margin-block-start: 1.2rem;
}

/* ------------------------------------------------------------------- bands */

.band {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-block-start: 1px solid var(--line);
}

.band__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-block-end: 2rem;
  flex-wrap: wrap;
}

.pieces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.piece {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ground-sunk);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.piece:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.piece__frame {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.piece__frame img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

.piece__body {
  padding: 0.9rem 1.1rem 1.2rem;
  border-block-start: 1px solid var(--line);
}

.piece__name {
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--ivory);
  margin: 0 0 0.35rem;
}

[dir="rtl"] .piece__name {
  font-family: var(--arabic-display);
}

.piece__price {
  font-size: 0.88rem;
  color: var(--champagne);
}

.piece__flag {
  display: inline-block;
  margin-inline-start: 0.5rem;
  font-size: 0.7rem;
  color: var(--alert);
}

/* -------------------------------------------------------------------- pages */

.page {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
}

.page__head {
  margin-block-end: 2.2rem;
}

.split {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 60rem) {
  .split {
    grid-template-columns: 1.4fr 1fr;
  }
}

.detail__frame {
  border: 1px solid var(--line);
  background: var(--ground-sunk);
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  aspect-ratio: 4 / 3;
}

.detail__frame img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

/* --------------------------------------------------------------------- bag */

.bag-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  border-block-start: 1px solid var(--line);
}

.bag-line {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 1.1rem;
  align-items: center;
  padding-block: 1.2rem;
  border-block-end: 1px solid var(--line);
}

.bag-line__frame {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--ground-sunk);
  border: 1px solid var(--line);
  padding: 0.4rem;
}

.bag-line__frame img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

.bag-line__title {
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--ivory);
  margin: 0 0 0.2rem;
}

[dir="rtl"] .bag-line__title {
  font-family: var(--arabic-display);
}

.bag-line__detail {
  font-size: 0.84rem;
  color: var(--muted);
}

.bag-line__controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-block-start: 0.6rem;
  flex-wrap: wrap;
}

.bag-line__amount {
  text-align: end;
  white-space: nowrap;
  color: var(--champagne);
}

.qty {
  width: 3.8rem;
  padding: 0.35rem 0.5rem;
  background: var(--ground-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

@media (max-width: 34rem) {
  .bag-line {
    grid-template-columns: 4.2rem 1fr;
  }

  .bag-line__amount {
    grid-column: 2;
    text-align: start;
  }
}

/* ------------------------------------------------------------------- panel */

.panel {
  border: 1px solid var(--line);
  background: var(--ground-raised);
  padding: clamp(1.2rem, 3vw, 1.8rem);
}

.panel h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--champagne);
  margin: 0 0 1.1rem;
}

[dir="rtl"] .panel h2 {
  font-family: var(--arabic-display);
}

.panel--sticky {
  position: sticky;
  top: 5.5rem;
}

.totals {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.totals__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.totals__row--grand {
  border-block-start: 1px solid var(--line-strong);
  margin-block-start: 0.7rem;
  padding-block-start: 0.8rem;
  color: var(--ivory);
  font-size: 1.05rem;
}

.totals__row--grand span:last-child {
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--champagne);
}

.mini-lines {
  list-style: none;
  margin: 0 0 1.2rem;
  padding: 0;
  display: grid;
  gap: 0.7rem;
  font-size: 0.88rem;
}

.mini-lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.mini-lines span:last-child {
  color: var(--champagne);
  white-space: nowrap;
}

/* -------------------------------------------------------------------- form */

.field {
  display: block;
  margin-block-end: 1.1rem;
}

.field__label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-block-end: 0.4rem;
}

[dir="rtl"] .field__label {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.88rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--ground-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--champagne);
}

.field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.field--bad input,
.field--bad select {
  border-color: var(--alert);
}

.field__error {
  display: block;
  font-size: 0.78rem;
  color: var(--alert);
  margin-block-start: 0.35rem;
}

.field__hint {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-block-start: 0.3rem;
}

.field-row {
  display: grid;
  gap: 0 1rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 2rem;
}

.fieldset > legend {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--champagne);
  padding: 0;
  margin-block-end: 1.1rem;
}

[dir="rtl"] .fieldset > legend {
  font-family: var(--arabic-display);
}

.payment-note {
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  background: var(--ground-sunk);
  font-size: 0.9rem;
  color: var(--muted);
}

.payment-note strong {
  display: block;
  color: var(--champagne);
  font-weight: 400;
  margin-block-end: 0.25rem;
}

/* ------------------------------------------------------------ empty states */

.empty {
  text-align: center;
  padding-block: clamp(3rem, 9vw, 6rem);
}

.empty p {
  color: var(--muted);
  margin-block-end: 1.6rem;
}

/* -------------------------------------------------------- order confirmed */

.receipt {
  border: 1px solid var(--line-strong);
  background: var(--ground-raised);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.receipt__number {
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--champagne);
  margin: 0.4rem 0 0;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1.2rem;
  margin: 0;
  font-size: 0.9rem;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

/* ------------------------------------------------------------------ footer */

.footer {
  border-block-start: 1px solid var(--line);
  padding-block: 2.5rem 3rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

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

.footer a:hover {
  color: var(--champagne);
}

.footer__tagline {
  font-family: var(--display);
  color: var(--champagne);
  font-size: 1rem;
}

[dir="rtl"] .footer__tagline {
  font-family: var(--arabic-display);
}

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