@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&display=swap');

.abril-fatface-regular {
  font-family: "Abril Fatface", serif;
  font-weight: 400;
  font-style: normal;
}

:root {
  --color-primary: #0a387c;
  --color-paper: #f7f7f4;
  --color-open: #2e7a4b;
  --color-closed: #a8432f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Bar napkin: printed border on textured tissue paper */
.napkin {
  --band: var(--napkin-band, clamp(16px, 4vw, 28px)); /* printed band thickness */
  --margin: calc(var(--band) * 1.2); /* blank paper outside the print */

  position: relative;
  isolation: isolate;
  padding: calc(var(--margin) + var(--band) * 2.5);
  background: url(images/napkin-paper.svg) 0 0 / 300px, var(--color-paper);
  background-blend-mode: multiply;
}

/* the border lives on a pseudo-element so the paper texture runs under it */
.napkin::before {
  content: "";
  position: absolute;
  inset: var(--margin);
  z-index: -1;
  pointer-events: none;
  border: var(--band) solid transparent;
  border-image: url(images/napkin-border.svg) 84 / var(--band) round; /* printed in primary ink */
  mix-blend-mode: multiply;          /* ink sinks into the paper */
  opacity: .92;
}

/* SVG filters referenced from CSS; must stay rendered (not display: none) */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
}

.primary-ink-flood {
  flood-color: var(--color-primary);
}

.paper-flood {
  flood-color: var(--color-paper);
}

.loading,
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* start screen, laid over the map until it is ready */
.loading {
  position: fixed;
  inset: 0;
  z-index: 2000; /* above Leaflet panes and controls */
  transition: opacity .3s .4s; /* fades once the bocadillo is big */
}

.loading h1 {
  color: var(--color-primary);
  text-align: center;
  /* sized by the smaller side, so it fills portrait and landscape screens */
  font-size: clamp(2rem, min(9vw, 10vh), 8rem);
  line-height: 0.9;
  margin: 0 0 .3em;
  transition: opacity .2s;
}

.loading img {
  width: min(75vw, 80vh, 720px);
  max-width: 100%;
  height: auto;
}

/* closing: the bocadillo grows towards the screen while the napkin fades */
.loading.is-done,
.loading.is-done h1 {
  opacity: 0;
}

.loading.is-done img {
  animation: grow .7s forwards;
}

@keyframes grow {
  25% {
    transform: scale(.85); /* small dip before growing */
    animation-timing-function: cubic-bezier(.5, 0, .9, .5);
  }
  100% {
    transform: scale(12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading.is-done img {
    animation: none;
  }
}

#app {
  height: 100%;
  background: var(--color-paper); /* shows while tiles load, instead of Leaflet's grey */
}

/* basemap printed in primary ink on paper, so the spots stand out */
.tinted-tiles img {
  filter: url(#primary-tint);
}

/* spot popup printed as a small napkin */
.spot-popup {
  --napkin-band: 10px;
}

.spot-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 0;
  background: none;
}

.spot-popup .leaflet-popup-content {
  margin: 0;
  font-size: 14px;
}

.spot-popup .leaflet-popup-tip {
  background: var(--color-paper);
}

.spot-popup h2 {
  margin: 0 0 .25rem;
  color: var(--color-primary);
  font-size: 1.25rem;
  font-weight: 400;
}

.spot-popup p {
  margin: .25rem 0;
}

.spot-popup a {
  color: var(--color-primary);
}

/* link rows: tall enough to tap (~35px), without extra space between them */
.spot-popup .icon-line:has(a) {
  align-items: center;
  margin: 0;
}

.spot-popup .icon-line a {
  display: inline-block;
  padding: .6em 0;
}

.link-separator {
  margin: 0 .6em;
}

.icon-line {
  display: flex;
  align-items: flex-start; /* icon stays on the first line when the text wraps */
  gap: .4em;
}

.icon-line svg {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: .05em;
  color: var(--color-primary);
}

.spot-status,
.spot-distance {
  font-weight: bold;
}

.spot-status svg {
  color: inherit;
}

.spot-status.is-open {
  color: var(--color-open);
}

.spot-status.is-closed {
  color: var(--color-closed);
}

.spot-distance {
  color: var(--color-primary);
}

/* the map's only control: centre on the user, as frosted glass like iOS Maps */
.locate-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / .6);
  border-radius: 50%;
  background: linear-gradient(rgb(255 255 255 / .55), rgb(255 255 255 / .25)), rgb(255 255 255 / .35);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / .9), /* glossy top edge */
    0 4px 16px rgb(0 0 0 / .15);
  color: var(--color-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s;
}

.locate-button:active {
  transform: scale(.92);
}

.locate-button svg {
  width: 22px;
  height: 22px;
  margin: 2px 2px 0 0; /* the arrow's weight sits bottom-left; nudge it to look centred */
}

.locate-button.is-following {
  --icon-fill: currentColor; /* filled arrow while centred on the user */
}

.leaflet-bottom.leaflet-right .locate-button {
  margin: 0 16px 16px 0;
}

/* the user's position */
.user-marker {
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 1px 4px rgb(0 0 0 / .35);
}

/* spots not serving esmorzaret right now */
.leaflet-marker-icon.is-closed {
  filter: grayscale(1);
  opacity: .5;
}
