/* The Download offline map button: the offline map card of an invented hotel app, Casa Vela, on black. Under the
   button the map of the neighbourhood waits as a blurred low resolution preview; pressed, the button fills with an
   amber light and the sharp map arrives in tiles, each one settling on a spring, outward from the hotel pin. */
:root {
  --page: #000000;          /* the page */
  --card: #0e1013;          /* the body of the card */
  --edge: rgba(255, 255, 255, 0.075); /* the 1px edge of the card */
  --ink: #eeece7;           /* the words */
  --muted: #8b8f97;         /* the small words */
  --accent: #f3a54c;        /* the amber of the progress, the pin and the route */
  --accent-ink: #1b1206;    /* the words on the amber */
  --water: #0f2a31;         /* the sea and the river on the map */
  --land: #171a1f;          /* the land on the map */
  --button: #f2efe8;        /* the button at rest */
  --button-ink: #0d0e10;    /* 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;
}

p {
  margin: 0;
}

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

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

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

/* ---------- the card ---------- */
.om {
  position: relative;
  width: min(400px, 92vw, calc((90vh - 150px) * 1.66));
  min-width: 260px;
  padding: clamp(10px, 2.6vh, 16px);
  border-radius: 22px;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, 0.045), transparent 60%),
    var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 24px 48px -20px rgba(0, 0, 0, 0.9),
    0 60px 90px -40px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* a soft grain over the card, like the matte of a printed map */
.om::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.om__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px clamp(8px, 2vh, 12px);
}

.om__mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(180deg, #1c1f24, #131518);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.om__mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.om__title {
  min-width: 0;
  flex: 1;
}

.om__name {
  font-size: 15px;
  font-weight: 620;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.om__sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.om__chip {
  flex: none;
  font-size: 11.5px;
  font-weight: 540;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  overflow: hidden;
}

.om__chip span {
  display: inline-block;
}

.om__chip.is-done {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
}

/* ---------- the map ---------- */
.map {
  position: relative;
  aspect-ratio: 480 / 280;
  border-radius: 14px;
  overflow: hidden;
  background: var(--land);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  isolation: isolate;
}

/* the inner edge and a vignette over everything on the map */
.map::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.map__low {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  filter: blur(3px) saturate(0.15) brightness(0.62);
}

/* the tile grid over the preview: the seams of what is still to download */
.map__grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
}

.map__grid i {
  box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.045);
}

.map__tiles {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
}

.tile {
  position: relative;
  overflow: visible;
  opacity: 0;
  will-change: transform, opacity;
}

.tile svg {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% + 1px);
  height: calc(100% + 1px);
  display: block;
}

/* the amber edge a tile shows for an instant as it lands */
.tile b {
  position: absolute;
  inset: 0;
  opacity: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 80%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.map__glint {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 34%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 236, 205, 0.16) 45%, rgba(255, 255, 255, 0.26) 50%, rgba(255, 236, 205, 0.16) 55%, transparent);
  mix-blend-mode: screen;
}

.map__pin {
  position: absolute;
  left: 36.5%;
  top: 47%;
  z-index: 4;
  width: 26px;
  height: 32px;
  margin: -32px 0 0 -13px;
}

.pin__body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6));
}

.pin__body path:first-child {
  fill: var(--accent);
  stroke: rgba(255, 240, 220, 0.55);
  stroke-width: 1;
}

.pin__bed {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pin__shadow {
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 14px;
  height: 5px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
}

.map__badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--ink);
  background: rgba(14, 16, 19, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px -6px rgba(0, 0, 0, 0.8);
  opacity: 0;
}

.map__badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- the button ---------- */
.dl {
  position: relative;
  display: block;
  width: 100%;
  height: 60px;
  margin-top: clamp(10px, 2.2vh, 14px);
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: var(--button-ink);
  background: var(--button);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 10px 24px -10px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

/* the light that follows the pointer over the pill */
.dl__light {
  --mx: 50%;
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(120px 60px at var(--mx) 0%, rgba(255, 255, 255, 0.95), transparent 70%);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .dl:hover .dl__light {
    opacity: 1;
  }
}

.dl.is-hover .dl__light {
  opacity: 1;
}

.dl.is-busy {
  background: #16181c;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 24px -10px rgba(0, 0, 0, 0.8);
}

.dl.is-busy .dl__light {
  opacity: 0;
}

.dl__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px 0 20px;
  pointer-events: none;
}

.dl__icon {
  flex: none;
  width: 22px;
  height: 22px;
}

.dl__icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ic__map,
.ic__arrow path,
.ic__check {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ic__panel {
  fill: currentColor;
  opacity: 0;
}

.ic__check {
  stroke-width: 2;
  opacity: 0;
}

.dl__label {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.002em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl__meta {
  flex: none;
  min-width: 3.4em;
  text-align: right;
  font-size: 13px;
  font-weight: 540;
  opacity: 0.6;
  white-space: nowrap;
}

/* the amber fill: the same face again in dark ink, cut from the left as the download goes */
.dl__fill {
  position: absolute;
  inset: 0;
  color: var(--accent-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%),
    var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  clip-path: inset(0% 100% 0% 0%);
  pointer-events: none;
}

.dl__fill .dl__meta {
  opacity: 0.72;
}

.dl__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -2px;
  background: linear-gradient(180deg, transparent, #fff6e6 30%, #fff6e6 70%, transparent);
  box-shadow: 0 0 12px 3px rgba(255, 220, 170, 0.7);
  opacity: 0;
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  width: 22px;
  height: 22px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}

.ghost path {
  fill: #ffffff;
  stroke: #0d0e10;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

@media (max-width: 360px) {
  .dl__face {
    padding: 0 16px 0 16px;
    gap: 9px;
  }

  .dl__label {
    font-size: 14.5px;
    font-variation-settings: 'wdth' 96;
  }
}
