@font-face {
  font-family: "Bricolage Grotesque";
  src: url("./media/bricolage-grotesque.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --paper: #081310;
  --ink: #f0f5ed;
  --muted: #b5c5b9;
  --green: #a3e86f;
  --green-strong: #c0f396;
  --gutter: clamp(19px, 5vw, 75px);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --ease: cubic-bezier(.22, .75, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

figure, p, h1 { margin: 0; }
img, svg { display: block; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--green); color: var(--paper); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 5px; }

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

.skip-link {
  position: fixed;
  z-index: 5;
  inset: 12px auto auto 12px;
  padding: 10px 15px;
  transform: translateY(calc(-100% - 18px));
  background: var(--green);
  color: var(--paper);
  border-radius: 8px;
}

.skip-link:focus { transform: none; }

.site-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1600px;
  padding-inline: var(--gutter);
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  font: 800 22px/1 var(--display);
  letter-spacing: -.035em;
}
.preview-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: #5c7e66;
  text-underline-offset: 5px;
  transition: color 150ms ease;
}
.preview-link:hover { color: var(--green); }

.launch {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.intro {
  max-width: 1450px;
  padding: clamp(20px, 2.2vw, 32px) var(--gutter) 0;
  margin-inline: auto;
  text-align: center;
}

.app-title {
  display: grid;
  justify-items: center;
  gap: clamp(18px, 2vw, 27px);
}

.app-title img {
  width: clamp(68px, 7vw, 96px);
  height: auto;
}

h1 {
  font: 760 clamp(37px, 5.15vw, 74px)/1.04 var(--display);
  letter-spacing: -.039em;
  text-wrap: balance;
}

.intro > p {
  max-width: 55ch;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 20px);
  text-wrap: balance;
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 23px;
}

.store {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  background: var(--green);
  border-radius: 7px;
  color: var(--paper);
  font-size: 15px;
  font-weight: 720;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 180ms var(--ease);
}
.store svg { width: 20px; height: 20px; }
.store:hover { background: var(--green-strong); }
.store:active { transform: scale(.97); }

.app-preview {
  --selected: 1;
  margin-top: clamp(26px, 3vw, 42px);
  scroll-margin-top: 16px;
}

.app-preview:has(input[value="upload"]:checked) { --selected: 0; }
.app-preview:has(input[value="history"]:checked) { --selected: 2; }

.screen-picker {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 4px;
  border: 0;
  margin: 0 auto -10px;
  background: #162820;
  border-radius: 8px;
}

.screen-picker label { cursor: pointer; }

.screen-picker span {
  display: flex;
  min-width: clamp(82px, 8vw, 105px);
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  transition: background-color 150ms ease, color 150ms ease;
}

.screen-picker label:hover span { color: var(--ink); }
.screen-picker input:checked + span { background: #304a36; color: var(--ink); }
.screen-picker input:focus-visible + span { outline: 2px solid var(--green); outline-offset: -2px; }

.stage {
  --device: clamp(210px, 22vw, 302px);
  --gap: clamp(12px, 1.1vw, 18px);
  --neighbor-scale: .85;
  --pitch: calc(var(--device) * (1 + var(--neighbor-scale)) / 2 + var(--gap));
  position: relative;
  isolation: isolate;
  height: calc(var(--device) * 1339 / 660 + 36px);
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}

.stage-art {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(
    to bottom,
    transparent,
    rgb(0 0 0 / 24%) 7%,
    rgb(0 0 0 / 65%) 18%,
    black 32% 64%,
    rgb(0 0 0 / 70%) 77%,
    rgb(0 0 0 / 30%) 87%,
    rgb(0 0 0 / 6%) 93%,
    transparent
  );
}

.market-line {
  width: 100%;
  height: 100%;
  mask-image: radial-gradient(
    ellipse clamp(340px, 48vw, 660px) 295px at 50% clamp(148px, 14vw, 200px),
    rgb(0 0 0 / 10%) 50%,
    rgb(0 0 0 / 35%) 71%,
    black
  );
}
.market-area { fill: #0e2018; }
.market-trace {
  stroke: #619744;
  stroke-width: 2.5;
  stroke-opacity: .7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.plot-mark circle:first-child { fill: #70ae4b43; }
.plot-mark circle:nth-child(2) { fill: #39672d; stroke: #a3e86f; stroke-width: 2; }
.plot-mark path { fill: #bdf792; }

.screen {
  --shift: calc(var(--index) - var(--selected));
  --distance: max(var(--shift), calc(-1 * var(--shift)));
  --neighbor: min(var(--distance), 1);
  position: absolute;
  top: 22px;
  left: calc(50% - var(--device) / 2);
  z-index: calc(3 - var(--distance));
  width: var(--device);
  transform: translateX(calc(var(--shift) * var(--pitch) + var(--drag-offset, 0px))) translateY(calc(var(--neighbor) * 22px)) scale(calc(1 - var(--neighbor) * (1 - var(--neighbor-scale))));
  filter: brightness(calc(1 - var(--neighbor) * .29));
  transform-origin: 50% 12%;
  transition: transform 380ms var(--ease), filter 260ms ease;
}

.screen-upload { --index: 0; }
.screen-analysis { --index: 1; }
.screen-history { --index: 2; }
.screen img { width: 100%; height: auto; }
.stage[data-swipe] .screen { cursor: grab; user-select: none; }
.stage[data-swipe]:active .screen { cursor: grabbing; }
.stage[data-dragging] .screen { transition: none; }

.screen-notes {
  max-width: 47ch;
  min-height: 49px;
  padding-inline: var(--gutter);
  margin: 8px auto 0;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

.screen-notes p { display: none; }
.app-preview:has(input[value="upload"]:checked) .note-upload,
.app-preview:has(input[value="analysis"]:checked) .note-analysis,
.app-preview:has(input[value="history"]:checked) .note-history { display: block; }

.site-footer {
  padding: 25px var(--gutter) 30px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 640px) {
  .site-header { min-height: 65px; }

  .app-title { gap: 19px; }
  h1 { font-size: clamp(42px, 11vw, 62px); }

  .intro > p {
    max-width: 39ch;
    margin-top: 16px;
  }

  .stores { margin-top: 19px; }

  .stage {
    --device: clamp(178px, 58vw, 253px);
    --pitch: 58vw;
  }

  .stage-art { inset-inline: -150px; }
  .screen { top: 18px; }
  .screen-notes { min-height: 72px; margin-top: 4px; }
  .site-footer { padding-top: 12px; }
}

@media (max-width: 355px) {
  .store { padding-inline: 11px; }
}

@media (prefers-reduced-motion: no-preference) {
  .stage-art { animation: plot-appear 520ms ease-out backwards; }
  .screen-picker { animation: controls-appear 380ms 75ms var(--ease) backwards; }
}

@keyframes plot-appear {
  from { opacity: .48; }
}

@keyframes controls-appear {
  from { opacity: .65; transform: translateY(5px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .screen { --drag-offset: 0px; }
  .store, .preview-link, .screen-picker span, .screen { transition: none; }
  .store:active { transform: none; }
}
