@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/cormorant-garamond-500.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/cormorant-garamond-500-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Karla";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/karla-400.woff2") format("woff2");
}

@font-face {
  font-family: "Karla";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/karla-500.woff2") format("woff2");
}

:root {
  --ink: #2c2333;
  --ink-soft: rgba(44, 35, 51, 0.76);
  --halo: rgba(255, 250, 244, 0.6);
  --wash: 255 252 248;
  --wash-alpha: 0.62;
  --line: rgba(44, 35, 51, 0.16);
  --accent: #b5477a;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Karla", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --edge: clamp(20px, 4vw, 56px);
  --top: calc(clamp(20px, 4.2vw, 52px) + env(safe-area-inset-top, 0px));
  --bottom: calc(clamp(18px, 3vw, 36px) + env(safe-area-inset-bottom, 0px));
}

html.is-night {
  --ink: #f4eee6;
  --ink-soft: rgba(244, 238, 230, 0.8);
  --halo: rgba(18, 20, 48, 0.5);
  --wash: 28 30 62;
  --wash-alpha: 0.5;
  --line: rgba(244, 238, 230, 0.2);
  --accent: #ffc2d6;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #dfe9f3;
}

.bl-stage {
  position: fixed;
  inset: 0;
}

.bl-poster,
.bl-scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.bl-poster {
  object-fit: cover;
  object-position: 50% 50%;
  user-select: none;
}

.bl-scene {
  opacity: 0;
  transition: opacity 1100ms ease;
  touch-action: none;
  cursor: grab;
}

.bl-scene:active {
  cursor: grabbing;
}

html.is-live .bl-scene {
  opacity: 1;
}

html.is-live .bl-poster {
  visibility: hidden;
  transition: visibility 0s linear 1.2s;
}

/* A soft pool of light behind the words keeps them readable over trunk, blossom or night sky. */
.bl-lede::before {
  content: '';
  position: absolute;
  inset: -56px -120px -56px -72px;
  z-index: -1;
  background: radial-gradient(ellipse at 35% 45%, var(--halo) 0%, transparent 68%);
  pointer-events: none;
  transition: background 1600ms ease;
}

.bl-lede {
  position: fixed;
  top: var(--top);
  left: var(--edge);
  display: grid;
  gap: 8px;
  max-width: min(46vw, 520px);
  margin: 0;
  pointer-events: none;
}

.bl-kicker {
  margin: 0;
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.bl-title {
  margin: 0;
  font: 500 clamp(30px, 4.2vw, 54px) / 0.98 var(--serif);
  letter-spacing: 0.005em;
  color: var(--ink);
}

.bl-sub {
  max-width: 26ch;
  margin: 0;
  font: italic 500 clamp(16px, 1.5vw, 21px) / 1.25 var(--serif);
  color: var(--ink-soft);
}

.bl-kicker,
.bl-title,
.bl-sub,
.bl-hint,
.bl-clock-label {
  text-shadow: 0 0 2px var(--halo), 0 0 18px var(--halo);
  transition: color 1600ms ease;
}

.bl-tools {
  position: fixed;
  top: var(--top);
  right: calc(var(--edge) - 8px);
  display: flex;
  gap: 10px;
}

.bl-tools button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(var(--wash) / var(--wash-alpha));
  box-shadow: 0 2px 14px rgba(40, 30, 60, 0.1);
  color: var(--ink);
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  transition: background-color 220ms ease, color 1600ms ease, border-color 1600ms ease, transform 160ms ease;
}

.bl-tools button:hover {
  background: rgb(var(--wash) / 0.9);
}

.bl-tools button:active {
  transform: scale(0.94);
}

.bl-tools button:focus-visible,
.bl-clock input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.bl-tools .bl-icon {
  display: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bl-tools .bl-icon-off,
.bl-tools [aria-pressed="true"] .bl-icon-on {
  display: block;
}

.bl-tools [aria-pressed="true"] .bl-icon-off {
  display: none;
}

.bl-clock {
  position: fixed;
  top: calc(var(--top) + 56px);
  right: calc(var(--edge) - 8px);
  display: grid;
  gap: 4px;
  width: 146px;
}

.bl-clock-label {
  margin: 0;
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.bl-clock input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.bl-clock input::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, #ffd9a0 0%, #ffc2a0 22%, #f08fae 34%, #3a3f88 50%, #141c45 66%, #e39aa8 86%, #fff0d6 100%);
}

.bl-clock input::-moz-range-track {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, #ffd9a0 0%, #ffc2a0 22%, #f08fae 34%, #3a3f88 50%, #141c45 66%, #e39aa8 86%, #fff0d6 100%);
}

.bl-clock input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border: 1.5px solid rgba(44, 35, 51, 0.4);
  border-radius: 50%;
  background: #fff8f2;
  box-shadow: 0 1px 6px rgba(20, 16, 40, 0.28);
  transition: transform 200ms ease;
}

.bl-clock input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(44, 35, 51, 0.4);
  border-radius: 50%;
  background: #fff8f2;
  box-shadow: 0 1px 6px rgba(20, 16, 40, 0.28);
}

.bl-clock input:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.bl-hint {
  position: fixed;
  left: var(--edge);
  bottom: var(--bottom);
  max-width: min(600px, calc(100vw - 420px));
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(var(--wash) / 0.74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font: 400 14px/1.5 var(--sans);
  color: var(--ink-soft);
  text-wrap: balance;
  transition: opacity 900ms ease, color 1600ms ease, background-color 1600ms ease, border-color 1600ms ease;
}

.bl-clock-label {
  justify-self: start;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgb(var(--wash) / 0.74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

html.has-visited .bl-hint {
  opacity: 0.45;
}

.bl-hint .bl-keys {
  white-space: nowrap;
}

.bl-hint kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 0.3em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgb(var(--wash) / 0.7);
  font: 500 12px/1.5 var(--sans);
  text-align: center;
}

.bl-hint-coarse {
  display: none;
}

/* The catalogue pins a share bar to the bottom-right, so the lower strip yields to it on narrower screens. */
@media (max-height: 480px) {
  .bl-kicker,
  .bl-sub {
    display: none;
  }

  .bl-title {
    font-size: 26px;
  }

  .bl-tools button {
    width: 36px;
    height: 36px;
  }

  .bl-hint {
    font-size: 13px;
  }
}

@media (max-width: 1099px) {
  .bl-clock {
    top: auto;
    left: var(--edge);
    right: calc(400px + env(safe-area-inset-right, 0px));
    translate: none;
    width: auto;
    bottom: calc(var(--bottom) - 4px);
  }

  .bl-clock-label {
    text-align: left;
  }

  .bl-hint {
    bottom: calc(var(--bottom) + 58px);
    max-width: min(560px, calc(100vw - 420px));
  }
}

.bl-hint .bl-tail {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .bl-hint .bl-tail {
    display: none;
  }
}

@media (max-width: 640px) {
  .bl-clock {
    right: calc(56px + env(safe-area-inset-right, 0px));
  }

  .bl-hint {
    bottom: calc(var(--bottom) + 58px);
    max-width: calc(100vw - 2 * var(--edge));
  }

  .bl-sub {
    max-width: 22ch;
  }
}

@media (hover: none), (pointer: coarse) {
  .bl-hint-fine {
    display: none;
  }

  .bl-hint-coarse {
    display: block;
  }
}

@media (max-width: 440px), (max-height: 380px) {
  .bl-sub,
  .bl-kicker {
    display: none;
  }

  .bl-title {
    font-size: 24px;
  }

  .bl-tools button {
    width: 36px;
    height: 36px;
  }

  .bl-tools .bl-icon {
    width: 19px;
    height: 19px;
  }
}

/* Short frames have no room to spare: the instructions show briefly, then step aside. */
@keyframes hint-away {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-height: 480px) {
  html .bl-hint {
    animation: hint-away 1.2s ease 7s forwards;
  }
}

@media (max-height: 380px) {
  .bl-hint {
    display: none;
  }
}

@media (max-width: 340px), (max-height: 240px) {
  .bl-clock {
    display: none;
  }

  .bl-title {
    font-size: 18px;
  }
}

@media (hover: none), (pointer: coarse) {
  html.has-visited .bl-hint {
    opacity: 0.6;
  }
}

/* The still image carries the scene on its own: nothing to steer, nothing to scrub. */
html.is-still .bl-tools,
html.is-still .bl-clock,
html.is-still .bl-hint {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .bl-scene,
  .bl-hint,
  .bl-tools button,
  .bl-tools .bl-icon,
  .bl-clock input::-webkit-slider-thumb {
    transition: none;
  }
}
