/* Buxie landing page.
   One viewport, no scroll. A pixel-art meadow as the background and glass
   panels on top of it. Type: Helvetica for the wordmark and headings (system
   font on every Apple device; not self-hosted because it is not licensable
   for that), EB Garamond for the copy, self-hosted so no visitor's IP goes to
   Google Fonts. */

/* EB Garamond is a variable font: this one 44 KB file covers weights 400-800.
   Latin subset only; the page has no other scripts. */
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/EBGaramond-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/EBGaramond-Italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #000;
  --sans: "Helvetica Neue", Helvetica;
  --serif: "EB Garamond";

  /* Glass. The background is busy pixel art, so the blur is on the high side
     (NN/g: more blur for intricate backgrounds) and the fill is opaque enough
     that black text clears WCAG AA everywhere on the panel. */
  --glass-fill: rgba(255, 255, 255, 0.46);
  --glass-line: rgba(255, 255, 255, 0.70);
  --glass-shadow: 0 12px 40px rgba(20, 50, 80, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --glass-blur: blur(20px) saturate(160%);

  /* One blue, chosen to sit calm rather than urgent. */
  --blue: #3a7ff2;
  --blue-deep: #2563d8;
  --blue-shadow: rgba(37, 99, 216, 0.36);

  --radius: 26px;
  --gutter: clamp(14px, 3vw, 32px);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 19px/1.4 var(--serif);
  -webkit-font-smoothing: antialiased;
  background: #8fd0f0;
  overflow-x: hidden;
}

/* The meadow. A fixed layer rather than background-attachment: fixed, which
   iOS Safari ignores. cover keeps the bunny in frame at every aspect ratio;
   the 60% vertical anchor favours the grass over the sky when cropping. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #8fd0f0;
  background-image: url("assets/bg.jpg");
  background-image: image-set(url("assets/bg.webp") type("image/webp"), url("assets/bg.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: 50% 60%;
  background-repeat: no-repeat;
}
@media (max-width: 720px) {
  body::before {
    background-image: url("assets/bg-small.webp");
    /* Portrait shows a quarter of the image's width; 33% puts the bunny in
       the middle of that window rather than on its edge. */
    background-position: 33% 60%;
  }
}

.skip {
  position: absolute;
  left: 8px;
  top: -60px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  z-index: 10000;
}
.skip:focus { top: 8px; }

/* ---------- Glass ---------- */

.glass {
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

/* Browsers without backdrop-filter (old Firefox ESR) get a heavier fill so
   the text stays readable without the blur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, 0.82); }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 500 18px/1 var(--sans);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.btn-blue {
  color: #fff;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 24px var(--blue-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.btn-blue:hover { box-shadow: 0 12px 30px var(--blue-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5); transform: translateY(-1px); }
.btn-blue:active { transform: translateY(1px); }

.btn-glass {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  border-color: var(--glass-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.7); }

.feedback-open {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  z-index: 50;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

/* ---------- Page ---------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--gutter);
  display: grid;
  /* The hero centres inside the top 60%, so its midline lands just under
     one third of the viewport and it clears the bunny in the meadow below
     it. The try-me panel sits at the bottom. */
  grid-template-rows: minmax(min-content, 60vh) minmax(min-content, 1fr);
  grid-template-rows: minmax(min-content, 60dvh) minmax(min-content, 1fr);
  justify-items: center;
  row-gap: 16px;
}

.hero {
  align-self: center;
  width: min(100%, 860px);
  padding: 0 clamp(24px, 5vw, 60px);
  text-align: center;
}

.wordmark {
  margin: 0;
  font: 700 clamp(60px, 11vw, 124px)/0.92 var(--sans);
  letter-spacing: -0.045em;
  color: var(--ink);
}

.btn-install {
  font-size: clamp(17px, 1.5vw, 21px);
  padding: 16px 28px;
  margin-top: 22px;
}
/* Placed by cta.js once it knows where the bunny is. Until then, and on
   any viewport the script decides is too narrow, it sits under the subcopy. */
.btn-install.is-placed {
  position: fixed;
  z-index: 40;
  margin: 0;
}

.sub {
  margin: clamp(14px, 2.2vw, 22px) auto 0;
  max-width: 52ch;
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.32;
  color: var(--ink);
}

/* ---------- Try me ---------- */

.try {
  align-self: end;
  width: min(100%, 860px);
  padding: 18px clamp(18px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.try-copy { min-width: 0; }
.try-title {
  margin: 0;
  font: 700 22px/1.1 var(--sans);
  letter-spacing: -0.02em;
  color: var(--blue-deep);
}
.try-hint {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.3;
}

.try-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Deliberately look like a store's own buttons, not our CTAs: the bunny
   reacts to the words, and the words should read like a shop. */
.shop {
  display: inline-flex;
  align-items: center;
  padding: 13px 22px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 8px rgba(20, 50, 80, 0.08);
  color: var(--ink);
  font: 500 17px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}
.shop:hover { background: rgba(255, 255, 255, 0.85); transform: translateY(-1px); }
.shop:active { transform: translateY(1px); }
.shop:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.fallback {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 17px;
}
.fallback img { image-rendering: pixelated; }
.fallback .arrow { font-size: 22px; }

/* ---------- The cursor bunny ---------- */

/* Hidden by default: no script, no bunny, no dead image in the corner. It
   only appears for a fine pointer, a wide enough viewport, and a visitor who
   has not asked for reduced motion. CSS re-evaluates all three on its own. */
#buxie {
  position: fixed;
  left: 0;
  top: 0;
  /* 64px, not 56: the source sprite is 128px, so 64 is an exact 2:1 and stays
     crisp at both 1x and 2x device pixel ratios. */
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-200px, -200px, 0);
  display: none;
}

/* Shown only once the script has wired up the pointer handlers. */
@media (pointer: fine) and (min-width: 620px) and (prefers-reduced-motion: no-preference) {
  .buxie-ready #buxie { display: block; }
  .buxie-ready .fallback { display: none; }
}

/* ---------- Feedback dialog ---------- */

.feedback {
  width: min(calc(100vw - 2 * var(--gutter)), 440px);
  margin: auto;
  padding: clamp(24px, 4vw, 36px);
  color: var(--ink);
  /* The dialog blurs whatever is behind it, and the backdrop dims the page
     so the panel reads as the top layer. */
}
.feedback::backdrop {
  background: rgba(20, 40, 60, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.feedback[open] { animation: rise 180ms ease-out; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback[open] { animation: none; }
  .btn, .shop { transition: none; }
}

.feedback-title {
  margin: 0 0 6px;
  font: 700 28px/1.05 var(--sans);
  letter-spacing: -0.03em;
}
.feedback-lead {
  margin: 0 0 18px;
  font-size: 18px;
  line-height: 1.35;
}

.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  margin-bottom: 6px;
  font: 600 13px/1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: 400 18px/1.3 var(--serif);
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.85);
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(0, 0, 0, 0.42); }
.field input:user-invalid,
.field textarea:user-invalid { border-color: #c0392b; }

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.feedback-actions .btn { padding: 12px 22px; font-size: 16px; }

.feedback-status {
  margin: 12px 0 0;
  min-height: 1.3em;
  font-size: 17px;
  line-height: 1.3;
}
.feedback-status a { color: var(--ink); }
.feedback-status.is-error { color: #8e1e12; }

.feedback-done { text-align: center; }
.feedback-done img { image-rendering: pixelated; }
.feedback-done .feedback-actions { justify-content: center; }

/* ---------- Small screens ---------- */

@media (max-width: 620px) {
  body { font-size: 17px; }
  .feedback-open { padding: 10px 16px; font-size: 12px; }
  .page { padding-top: 64px; row-gap: 12px; }   /* clear the fixed FEEDBACK button */
  .hero { padding: 0 6px; }
  .sub { font-size: 18px; margin-top: 12px; }
  .try { padding: 12px 16px 14px; justify-content: center; text-align: center; gap: 8px 12px; }
  .try-hint { display: none; }        /* the fallback caption says it instead */
  .try-buttons { justify-content: center; }
  .fallback { justify-content: center; font-size: 15px; padding-top: 10px; gap: 8px; }
  /* 32px is 128/4: still a whole-number scale, so the pixels stay square. */
  .fallback img { width: 32px; height: 32px; }
  .fallback .arrow { font-size: 18px; }
  .fallback span:last-child { flex-basis: 100%; }
}

/* Small AND short (an iPhone SE): trade type size for fit. */
@media (max-width: 620px) and (max-height: 720px) {
  .page { padding-top: 52px; row-gap: 8px; }
  .hero { padding: 0 4px; }
  .wordmark { font-size: 48px; }
  .btn-install { padding: 12px 20px; font-size: 16px; }
  .sub { font-size: 16px; margin-top: 8px; }
  .try { padding: 10px 14px 12px; gap: 6px 10px; }
  .try-title { font-size: 18px; }
  .shop { padding: 10px 16px; font-size: 15px; }
  /* No room for the sprite pair here; the caption carries the message. */
  .fallback { padding-top: 6px; font-size: 14px; }
  .fallback img, .fallback .arrow { display: none; }
}

/* Short, wide viewports (a laptop with the dock up, a phone on its side):
   tighten the vertical rhythm so the page still fits without scrolling. */
@media (max-height: 640px) {
  .page { row-gap: 10px; }
  .hero { padding-top: 22px; padding-bottom: 22px; }
  .wordmark { font-size: clamp(48px, 8vw, 88px); }
  .sub { font-size: clamp(18px, 2vw, 22px); margin-top: 12px; }
  .try { padding-top: 12px; padding-bottom: 12px; }
}
