/* The stay review form with the score that fills up: a warm white card on a white page, a real photo of the lake on
   top, ten segments that fill on a spring, three chips and a button that thanks you. One accent: the lake green. */
:root {
  --page: #ffffff;            /* the page */
  --card: #fffdfa;            /* the card */
  --edge: rgba(40, 30, 20, 0.09); /* the 1px edge of the card and the fields */
  --ink: #1d1b18;             /* the words and the button */
  --muted: #8b847a;           /* the small words */
  --track: #eee9e1;           /* the empty segments */
  --accent: #1f6b5e;          /* the lake green: the score, the chips, the thanks */
  --accent-soft: #e6f0ec;     /* the chips when they are on */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vh, 24px) 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the card */
.review {
  position: relative;
  width: min(392px, 92vw);
  padding: clamp(5px, 1.2vh, 7px);
  border-radius: 24px;
  background: var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(40, 30, 20, 0.05),
    0 6px 14px -6px rgba(40, 30, 20, 0.08),
    0 28px 60px -24px rgba(40, 30, 20, 0.22);
  opacity: 0;
}

.review__photo {
  position: relative;
  margin: 0;
  height: clamp(54px, 15vh, 132px);
  border-radius: 18px;
  overflow: hidden;
  background: #c9d3cf;
  isolation: isolate;
}

.review__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
  transform-origin: 50% 60%;
}

/* a soft shade at the bottom so the name reads, and a hair of light along the top edge like glass */
.review__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 18%),
    linear-gradient(0deg, rgba(10, 16, 14, 0.62), rgba(10, 16, 14, 0.12) 55%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: inherit;
  pointer-events: none;
}

.review__hotel {
  position: absolute;
  left: clamp(10px, 3.6vw, 14px);
  right: 12px;
  bottom: clamp(6px, 1.6vh, 11px);
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.review__hotel-name {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(14px, 3.6vh, 17px);
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
  font-weight: 520;
  letter-spacing: -0.01em;
}

.review__hotel-place {
  font-size: 11.5px;
  font-weight: 500;
  font-stretch: 105%;
  opacity: 0.82;
  letter-spacing: 0.01em;
}

.review__body {
  padding: clamp(7px, 1.9vh, 16px) clamp(10px, 3.4vw, 14px) clamp(4px, 1vh, 8px);
  display: grid;
  gap: clamp(6px, 1.8vh, 14px);
}

.review__title {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(17px, 4.8vh, 24px);
  font-variation-settings: 'opsz' 48, 'SOFT' 30;
  font-weight: 480;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.review__dates {
  margin: clamp(2px, 0.7vh, 5px) 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  font-stretch: 102%;
}

.review__cal {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
}

.review__sep {
  opacity: 0.6;
}

/* ---------------------------------------------------------------- the score */
.score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score__num {
  position: relative;
  height: clamp(32px, 8.6vh, 50px);
  width: 1.16em;
  font-size: clamp(32px, 8.6vh, 50px);
  overflow: hidden;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-variation-settings: 'opsz' 96, 'SOFT' 0;
  font-weight: 440;
  letter-spacing: -0.04em;
  line-height: 1;
  /* soft edges so the numbers roll in from nothing */
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}

.score__drum {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
}

.score__digit {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: left;
  font-feature-settings: 'lnum' 1;
}

.score__digit--zero {
  color: #cfc8bd;
}

.score__label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.score__word {
  display: block;
  font-size: clamp(14px, 3.6vh, 17px);
  font-weight: 600;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.score__word.is-empty {
  color: var(--muted);
  font-weight: 500;
}

.score__out {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- the ten segments */
.bar {
  --p: 0;
  position: relative;
  height: clamp(22px, 5.4vh, 30px);
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline: none;
  border-radius: 10px;
}

.bar:focus-visible {
  box-shadow: 0 0 0 3px var(--card), 0 0 0 4.5px var(--accent);
}

.bar__segs {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.seg {
  position: relative;
  height: 8px;
  border-radius: 3px;
  background: var(--track);
  box-shadow: inset 0 1px 1px rgba(40, 30, 20, 0.06);
  overflow: hidden;
  transform-origin: 50% 50%;
}

/* the hover preview: a pale fill up to the segment under the pointer */
.seg__ghost {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--accent) 22%, var(--track));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.seg.is-ghost .seg__ghost {
  opacity: 1;
}

.seg__fill {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.bar__knob {
  position: absolute;
  top: 50%;
  left: calc(var(--p) * 100%);
  width: 0;
  height: 0;
  pointer-events: none;
}

.bar__knob-face {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #f5f2ec);
  box-shadow:
    0 0 0 1px rgba(40, 30, 20, 0.12),
    0 1px 1px rgba(40, 30, 20, 0.08),
    0 4px 10px -2px rgba(40, 30, 20, 0.22),
    inset 0 -1px 0 rgba(40, 30, 20, 0.06);
}

/* a short groove in the knob, like a real handle */
.bar__knob-face::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: 1.5px;
  height: 8px;
  margin-left: -0.75px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.55;
}

.bar__ends {
  display: none;
}

/* ---------------------------------------------------------------- the chips */
.chips {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.chip {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.chip__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: clamp(28px, 7.4vh, 34px);
  padding: 0 clamp(9px, 2.8vw, 12px) 0 clamp(8px, 2.4vw, 10px);
  border-radius: inherit;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--edge), 0 1px 2px rgba(40, 30, 20, 0.05);
  font-size: 12.5px;
  font-weight: 520;
  font-stretch: 100%;
  white-space: nowrap;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, font-stretch 0.3s ease;
}

.chip__icon,
.chip__tick {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.chip__tick {
  position: absolute;
  left: clamp(8px, 2.4vw, 10px);
  stroke-width: 1.7;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.chip[aria-pressed='true'] .chip__face {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent), 0 1px 2px rgba(31, 107, 94, 0.08);
  font-stretch: 106%;
}

.chip:focus-visible {
  outline: none;
}

.chip:focus-visible .chip__face {
  box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 2px var(--card), 0 0 0 3.5px var(--accent);
}

/* ---------------------------------------------------------------- the words */
.note {
  position: relative;
  display: block;
}

.note__field {
  display: block;
  width: 100%;
  height: clamp(54px, 13.4vh, 64px);
  resize: none;
  margin: 0;
  padding: 8px 12px 16px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 2px rgba(40, 30, 20, 0.04);
  font: inherit;
  font-size: 13px;
  line-height: 1.38;
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.25s ease;
}

.note__field::placeholder {
  color: #b2aa9f;
}

.note__field:focus,
.note.is-typing .note__field {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.note__count {
  position: absolute;
  right: 11px;
  bottom: 4px;
  font-size: 10px;
  color: #b2aa9f;
  font-feature-settings: 'lnum' 1;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the button */
.send {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}

.send__face {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(38px, 10vh, 48px);
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, #34312c, var(--ink) 55%);
  color: #fffdf8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(20, 15, 10, 0.2),
    0 8px 18px -8px rgba(20, 15, 10, 0.45);
  font-size: 14px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.005em;
}

/* the accent that sweeps in while it sends, and stays for the thanks */
.send__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent) 60%);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.send__state {
  grid-area: 1 / 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.send__state--done {
  opacity: 0;
}

.send__arrow,
.send__check {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send__check path {
  stroke-width: 1.9;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.send:focus-visible {
  outline: none;
}

.send:focus-visible .send__face {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--accent);
}

.review__foot {
  margin: calc(clamp(6px, 1.8vh, 14px) * -0.5) 0 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
}

@media (hover: hover) {
  .chip:hover .chip__face {
    box-shadow: inset 0 0 0 1px rgba(40, 30, 20, 0.18), 0 2px 6px -2px rgba(40, 30, 20, 0.12);
  }

  .chip[aria-pressed='true']:hover .chip__face {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 6px -2px rgba(31, 107, 94, 0.2);
  }

  .send:hover .send__face {
    background: linear-gradient(180deg, #3f3b35, #26231f 55%);
  }

  .send:hover .send__arrow {
    transform: translateX(2px);
  }

  .note__field:hover:not(:focus) {
    box-shadow: inset 0 0 0 1px rgba(40, 30, 20, 0.16), inset 0 1px 2px rgba(40, 30, 20, 0.04);
  }
}

.send__arrow {
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* on short screens (the phone box) the foot line goes, everything else stays */
@media (max-height: 470px) {
  .review__foot {
    display: none;
  }
}
