/*
 * THE CUSTOMER'S REVIEW FORM — /products/<handle>/review and /reviews/write.
 *
 * ⛔ IT IS A FILE, NOT AN INLINE <style>, AND THAT IS A GATE, NOT A PREFERENCE.
 * `tests/growth/reviewWritePromise.test.js` scans the whole RENDERED PAGE for
 * promises the code cannot grant, and one of its shapes is "a percentage next to
 * discount/off/code with no cap and no approval". Inline CSS put `width: 100%`
 * into that scan, so a stylesheet declaration was read as a reward promise and
 * the gate went red for a correct page — twice, before the rules moved here.
 *
 * =========================================================================
 * ⛔ IT INHERITS THE SHOP RATHER THAN IMITATING IT
 * =========================================================================
 * The page carries `<body class="ll">` and loads `storefront.css` FIRST, so the
 * ground (`--ll-paper`, white), the body face, the type scale, the line height
 * and the letter-spacing all arrive from the shop's own `body.ll` rule. Nothing
 * here re-declares them. An earlier version painted its own cream background and
 * its own font stack, and drifted from the site the moment either changed —
 * which is the whole failure this file exists downstream of.
 *
 * Every value below is either a storefront token or a layout number that only
 * this page has an opinion about.
 */

/* ---------------------------------------------------------------- the page - */
.rv {
  max-width: 32rem;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4rem;
}

.rv__eyebrow {
  font-size: var(--ll-fs-2xs);
  letter-spacing: var(--ll-track-eyebrow);
  text-transform: uppercase;
  color: var(--ll-muted);
  margin: 0 0 .5rem;
}

.rv__h {
  font-family: var(--ll-font-display);
  font-weight: var(--ll-w-display);
  font-size: var(--ll-fs-3xl);
  line-height: var(--ll-lh-display);
  letter-spacing: var(--ll-track-display-lg);
  color: var(--ll-ink);
  margin: 0 0 1.75rem;
}

/* ------------------------------------------------------- the piece, up top - */
.rv__piece {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid var(--ll-line);
  border-radius: .25rem;
  background: var(--ll-surface);
  margin: 0 0 2rem;
}
.rv__img {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: .15rem;
  background: var(--ll-paper);
}
.rv__piecename {
  font-weight: 600;
  color: var(--ll-ink);
  line-height: var(--ll-lh-snug);
}

/* The chip's class names are pinned by `reviewWritePromise`, so they keep their
   shipped names and are restyled here rather than renamed. */
.badge {
  display: inline-block;
  font-size: var(--ll-fs-2xs);
  letter-spacing: var(--ll-track-caps);
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--ll-paper);
  color: var(--ll-muted);
  border: 1px solid var(--ll-line-2);
  margin-top: .4rem;
}
.badge-ok {
  color: var(--ll-gold-deep);
  border-color: var(--ll-gold-hair);
}

/* ------------------------------------------------------------------ fields - */
.rv__field { margin: 0 0 2rem; }
.rv__label {
  display: block;
  font-size: var(--ll-fs-sm);
  font-weight: 600;
  letter-spacing: var(--ll-track-caps);
  text-transform: uppercase;
  color: var(--ll-ink);
  margin: 0 0 .75rem;
}
.rv__hint {
  font-size: var(--ll-fs-sm);
  color: var(--ll-muted);
  margin: .6rem 0 0;
}

/* ==========================================================================
 * ⛔ THE STARS. THE SIBLING SELECTOR IS THE WHOLE CONTROL, AND IT WAS WRONG.
 * ==========================================================================
 * The first version selected `input:checked ~ .rv__star`. `.rv__star` is a child
 * of the LABEL, not a sibling of the input, so that selector matched NOTHING: the
 * radio really was being checked and the page never showed it. Reported as
 * "I clicked the stars and nothing happened", which is exactly what it looked
 * like. The fix is `~ label .rv__star` — the star is reached THROUGH the sibling
 * label.
 *
 * ⛔ AND `row-reverse` IS WHY THIS WORKS AT ALL. CSS can only select FORWARD, so
 * the markup renders 5 first and flex reverses it: hovering or checking the
 * third star lights it and everything after it in the DOM (2 and 1), which is
 * everything to its LEFT on screen. Rendering 1..5 in order would light the
 * wrong half and no selector could fix it.
 *
 * The radio stays the mechanism: no JavaScript, which is a state an in-app
 * browser genuinely can be in, and it keeps the control keyboard-operable.
 * ======================================================================== */
.rv__stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  margin-left: -.5rem; /* optical: pull the first star back to the text edge */
}
.rv__stars input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.rv__stars label {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px; /* the 44px touch floor, with room */
}
.rv__star {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ll-line-2);
  transition: color .12s ease, transform .12s ease;
}
.rv__stars input:checked ~ label .rv__star,
.rv__stars label:hover .rv__star,
.rv__stars label:hover ~ label .rv__star {
  color: var(--ll-gold);
}
.rv__stars label:active .rv__star { transform: scale(.92); }
.rv__stars input:focus-visible ~ label .rv__star {
  outline: 2px solid var(--ll-gold-deep);
  outline-offset: 3px;
  border-radius: .15rem;
}

/* ------------------------------------------------------------------ inputs - */
.rv__input,
.rv__textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--ll-ink);
  background: var(--ll-paper);
  border: 1px solid var(--ll-line-2);
  border-radius: .25rem;
  padding: .85rem .9rem;
  min-height: 48px;
}
.rv__textarea { min-height: 7.5rem; resize: vertical; }
.rv__input:focus,
.rv__textarea:focus {
  outline: none;
  border-color: var(--ll-ink);
  box-shadow: 0 0 0 1px var(--ll-ink);
}
.rv__input::placeholder,
.rv__textarea::placeholder { color: var(--ll-muted); opacity: 1; }

/* A real control instead of the browser's "Choose files / No file chosen". */
.rv__file { position: absolute; opacity: 0; width: 0; height: 0; }
.rv__filebtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  cursor: pointer;
  border: 1px dashed var(--ll-line-2);
  border-radius: .25rem;
  padding: 1rem;
  min-height: 48px;
  color: var(--ll-ink-2);
  background: var(--ll-paper);
  transition: border-color .12s ease, color .12s ease;
}
.rv__filebtn:hover { border-color: var(--ll-gold-deep); color: var(--ll-ink); }
.rv__file:focus-visible + .rv__filebtn {
  border-color: var(--ll-ink);
  box-shadow: 0 0 0 1px var(--ll-ink);
}
.rv__reward { color: var(--ll-gold-deep); }

/* ------------------------------------------------------------------ submit - */
.rv__submit {
  width: 100%;
  min-height: 54px;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--ll-fs-sm);
  font-weight: 600;
  letter-spacing: var(--ll-track-caps);
  text-transform: uppercase;
  color: var(--ll-paper);
  background: var(--ll-ink);
  border: 0;
  border-radius: .25rem;
  padding: 1rem;
  transition: background .12s ease;
}
.rv__submit:hover { background: var(--ll-ink-deep); }
.rv__submit:focus-visible { outline: 2px solid var(--ll-gold-deep); outline-offset: 3px; }

/* ------------------------------------------------------------- the notices - */
.rv__note {
  border-left: 2px solid var(--ll-gold-hair);
  background: var(--ll-surface);
  padding: .9rem 1rem;
  margin: 0 0 1.75rem;
  color: var(--ll-ink-2);
  font-size: var(--ll-fs-sm);
}
.rv__errors {
  border-left: 2px solid #b4453c;
  background: #fdf1ef;
  color: #7c2d26;
  padding: .9rem 1rem;
  margin: 0 0 1.75rem;
  font-size: var(--ll-fs-sm);
}
.rv__errors ul { margin: 0; padding-left: 1.1rem; }

/* ==========================================================================
 * ⛔ THE FINE PRINT IS COLLAPSED, NOT DELETED.
 * The owner asked for it gone from the page. It cannot simply be removed:
 * `reviewWritePromise` REQUIRES `verifiedClaim.explanation()` to be rendered,
 * because this page once promised a "verified purchase" badge the code does not
 * grant, and that gate is the thing standing between here and a repeat. A
 * closed <details> satisfies both readings honestly — the claim is on the page
 * and checkable by anyone who wants it, and invisible to everyone who does not.
 * ======================================================================== */
.rv__fine {
  border-top: 1px solid var(--ll-hair);
  margin-top: 2.75rem;
  padding-top: 1rem;
  font-size: var(--ll-fs-xs);
  color: var(--ll-muted);
}
.rv__fine summary {
  cursor: pointer;
  list-style: none;
  letter-spacing: var(--ll-track-caps);
  text-transform: uppercase;
  font-size: var(--ll-fs-2xs);
  color: var(--ll-muted);
  padding: .5rem 0;
  min-height: 44px; /* it is a tap target like any other */
  display: flex;
  align-items: center;
}
.rv__fine summary::-webkit-details-marker { display: none; }
.rv__fine summary::after { content: " +"; margin-left: .35rem; }
.rv__fine[open] summary::after { content: " \2212"; }
.rv__fine p { margin: .5rem 0 0; line-height: var(--ll-lh-base); }

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