/* Roof quote slider: the roof estimate of Tilewright, an invented roofing company, alone on white. A white card with a
   layered shadow and a 1px edge; a roof plane drawn in thin lines that fills with tiles row by row as the area slider
   moves; a material switch, a rolling price and a Get a quote button that lights up. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #17140f;           /* the words */
  --muted: #8d877e;         /* the small words */
  --line: #ebe7e1;          /* thin lines, the empty track and the ticks */
  --accent: #c2512a;        /* the brick of the track, the ticks passed and the lit button */
  --clay: #c8643b;          /* the clay tiles */
  --slate: #4b5563;         /* the slate tiles */
  --metal: #9aa4ad;         /* the metal tiles */
  --button: #17140f;        /* the Get a quote button */
  --button-ink: #ffffff;    /* the words on the button */
}

* {
  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;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the card */
.quote {
  position: relative;
  width: min(356px, 90vw);
  padding: clamp(13px, 3.4vh, 20px) 18px clamp(13px, 3.4vh, 18px);
  border-radius: 24px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 20, 15, 0.06),
    0 1px 1px rgba(23, 20, 15, 0.04),
    0 4px 8px -2px rgba(23, 20, 15, 0.05),
    0 18px 36px -14px rgba(23, 20, 15, 0.14),
    0 44px 70px -40px rgba(194, 81, 42, 0.26);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

.quote::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.quote::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.035;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.quote__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quote__title {
  margin: 0;
  font-size: 17px;
  font-weight: 640;
  font-stretch: 104%;
  letter-spacing: -0.01em;
}

.quote__sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-stretch: 96%;
}

.rate {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f7f4f0;
  box-shadow: inset 0 0 0 1px rgba(23, 20, 15, 0.06);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rate__unit {
  margin-left: 1px;
  color: var(--muted);
  font-weight: 500;
}

/* ---------------------------------------------------------------- the roof */
.roof {
  position: relative;
  margin-top: clamp(8px, 2.4vh, 14px);
  padding: clamp(6px, 1.6vh, 10px) 4px 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfaf8, #f6f3ef);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 15, 0.05);
}

.roof__svg {
  display: block;
  width: 100%;
  height: clamp(78px, 25vh, 138px);
  overflow: visible;
}

.roof__plane {
  fill: #ffffff;
}

.roof__guides line {
  stroke: #ece8e2;
  stroke-width: 0.6;
}

.roof__edge {
  fill: none;
  stroke: #cfc9c0;
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.roof__ridge {
  stroke: #cfc9c0;
  stroke-width: 2.4;
  stroke-linecap: round;
  transition: stroke 0.5s ease;
}

.roof[data-full] .roof__ridge {
  stroke: var(--tile-deep);
}

.roof__chimney rect {
  fill: #fff;
  stroke: #cfc9c0;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.roof__chimney .cap {
  fill: #f4f1ec;
}

.roof__gutter,
.roof__wall {
  fill: none;
  stroke: #d8d3cb;
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.roof__gutter {
  stroke-width: 1.6;
}

.roof__shade {
  pointer-events: none;
}

/* a hair of shadow under every course */
.roof__tiles {
  filter: drop-shadow(0 0.7px 0.5px rgba(23, 20, 15, 0.22));
}

/* the tiles: three shades of the material, so the plane has a grain */
.roof {
  --tile: var(--clay);
  --tile-deep: color-mix(in srgb, var(--clay) 74%, #000);
}

.roof[data-mat='slate'] {
  --tile: var(--slate);
  --tile-deep: color-mix(in srgb, var(--slate) 70%, #000);
}

.roof[data-mat='metal'] {
  --tile: var(--metal);
  --tile-deep: color-mix(in srgb, var(--metal) 72%, #000);
}

.tile {
  fill: var(--tile);
  stroke: color-mix(in srgb, var(--tile) 70%, #fff);
  stroke-width: 0.7;
  transition: fill 0.45s ease, stroke 0.45s ease;
}

.tile.s1 {
  fill: color-mix(in srgb, var(--tile) 88%, #fff);
}

.tile.s2 {
  fill: color-mix(in srgb, var(--tile) 90%, #000);
}

.roof__fill {
  position: absolute;
  left: 12px;
  top: clamp(7px, 1.8vh, 11px);
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-stretch: 92%;
}

/* ---------------------------------------------------------------- price and material */
.row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(8px, 2.2vh, 14px);
}

.price {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.price__key {
  font-size: 11.5px;
  color: var(--muted);
  font-stretch: 92%;
}

.price__val {
  display: inline-flex;
  align-items: center;
  margin-top: 1px;
  font-size: clamp(21px, 6vh, 26px);
  font-weight: 650;
  font-stretch: 104%;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.mats {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 999px;
  background: #f5f2ee;
  box-shadow: inset 0 0 0 1px rgba(23, 20, 15, 0.06);
}

.mats__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(23, 20, 15, 0.06), 0 1px 2px rgba(23, 20, 15, 0.1), 0 3px 8px -3px rgba(23, 20, 15, 0.16);
}

.mat {
  position: relative;
  height: 28px;
  padding: 0 clamp(8px, 2.6vw, 11px);
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  font-stretch: 96%;
  cursor: pointer;
  transition: color 0.25s ease, font-stretch 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.mat[aria-checked='true'] {
  color: var(--ink);
  font-stretch: 104%;
}

.mat:focus-visible,
.cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (hover: hover) {
  .mat:hover {
    color: var(--ink);
  }
}

/* ---------------------------------------------------------------- the area slider */
.area {
  margin-top: clamp(8px, 2.2vh, 14px);
}

.area__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.area__key {
  font-size: 11.5px;
  color: var(--muted);
  font-stretch: 92%;
}

.area__val {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.slide {
  --pad: 11px;
  position: relative;
  height: 34px;
  padding: 0 var(--pad);
  touch-action: none;
  cursor: pointer;
}

.slide__track {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 14px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 3px;
  background: var(--line);
}

.slide__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
}

.ticks {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 22px;
  height: 8px;
}

.tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 5px;
  margin-left: -0.5px;
  border-radius: 1px;
  background: #d9d4cc;
  transform-origin: 50% 0;
  transition: background-color 0.3s ease;
}

.tick.is-major {
  height: 7px;
}

.tick.is-on {
  background: var(--accent);
}

.thumb {
  position: absolute;
  top: 14px;
  left: 0;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  outline: none;
  cursor: grab;
  z-index: 2;
}

.thumb__body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #f4f2ef);
  box-shadow:
    0 0 0 1px rgba(23, 20, 15, 0.09),
    0 1px 2px rgba(23, 20, 15, 0.12),
    0 4px 10px -2px rgba(23, 20, 15, 0.16),
    inset 0 1px 0 #fff;
  transition: box-shadow 0.3s ease;
}

.thumb__core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  transform: rotate(45deg);
}

.thumb.is-grab .thumb__body,
.thumb:focus-visible .thumb__body {
  box-shadow:
    0 0 0 1px rgba(194, 81, 42, 0.45),
    0 2px 4px rgba(23, 20, 15, 0.12),
    0 10px 20px -4px rgba(194, 81, 42, 0.36),
    0 0 0 6px rgba(194, 81, 42, 0.1),
    inset 0 1px 0 #fff;
}

/* ---------------------------------------------------------------- the rolling digits */
.roll {
  display: inline-flex;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  vertical-align: bottom;
}

.roll__slot {
  display: inline-block;
  width: 1ch;
  height: 1.2em;
  overflow: hidden;
  transition: width 0.32s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.25s ease;
}

.roll__slot.is-off {
  width: 0;
  opacity: 0;
}

.roll__sep {
  display: inline-block;
  width: 0.28em;
  text-align: center;
}

.roll__col {
  display: block;
}

.roll__col span {
  display: block;
  height: 1.2em;
  text-align: center;
}

/* ---------------------------------------------------------------- the Get a quote button */
.cta {
  display: block;
  width: 100%;
  margin-top: clamp(6px, 1.8vh, 12px);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cta__face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: clamp(40px, 10.5vh, 48px);
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #2b2722, var(--button) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(23, 20, 15, 0.2),
    0 10px 20px -10px rgba(23, 20, 15, 0.5);
  color: var(--button-ink);
  font-size: 14px;
  font-weight: 580;
  font-stretch: 102%;
}

.cta__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 140% at 50% 120%, color-mix(in srgb, var(--accent) 90%, #fff) 0%, var(--accent) 45%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  opacity: 0;
}

.cta__words {
  position: relative;
  white-space: nowrap;
}

.cta__icon {
  position: relative;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cta__icon .chk {
  opacity: 0;
}

.cta__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 236, 220, 0.42) 50%, rgba(255, 255, 255, 0));
  opacity: 0;
}

@media (hover: hover) {
  .cta:hover .cta__icon {
    transform: translateX(2px);
  }
  .cta__icon {
    transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  }
}

/* ---------------------------------------------------------------- the drawn pointer of the autopilot */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.pointer path {
  fill: #17140f;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

@media (max-width: 380px) {
  .quote {
    padding-left: 14px;
    padding-right: 14px;
  }
}
