/* Diaberry – coming soon. Mobile-first. */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/figtree-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 {
  --bg: #fbf8f7;
  --ink: #383b42;
  --ink-2: #5f6470;
  --ink-3: #6f6c69;
  --ink-4: #8a8680;
  --green: #407d50;
  --green-dark: #336547;
  --green-light: #6ba076;
  --mint: #eff6f1;
  --sand: #ede7e0;
  --red: #ef5b3c;
  --line: rgba(60, 50, 40, 0.14);
  --font: "Figtree", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1, p, figure { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  padding: 10px 16px;
  font-weight: 600;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  /* keep content clear of notches and rounded corners (viewport-fit=cover) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hero::before,
.nf::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(55% 50% at 50% 28%, rgba(107, 160, 118, 0.14), transparent 72%);
}


.intro {
  position: relative;
  width: min(880px, 100% - 40px);
  margin: 0 auto;
  padding: 56px 0 8px;
  text-align: center;
}

.logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

h1 {
  max-width: 760px;
  margin: 0 auto;
  font-size: clamp(32px, 9vw + 2px, 64px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  max-width: 560px;
  margin: 16px auto 0;
  font-size: clamp(19px, 1.2vw + 14px, 24px);
  line-height: 1.35;
  color: var(--ink-2);
  text-wrap: balance;
}

/* ---------- 404 page ---------- */

.nf {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px;
  text-align: center;
}
.nf .lede { max-width: 420px; }
.back {
  display: inline-flex;
  margin-top: 28px;
  text-decoration: none;
}

/* ---------- Waitlist form ---------- */

.join { margin-top: 28px; container-type: inline-size; }

.notify {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 460px;
  max-width: 100%;
  margin: 0 auto;
}

.notify input[type="email"] {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0 20px;
  font: inherit;
  font-size: 17px; /* 16px+ stops iOS Safari zooming on focus */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: 0;
  box-shadow: 0 1px 2px rgba(60, 50, 40, 0.05), 0 16px 36px -18px rgba(60, 50, 40, 0.28);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.notify input[type="email"]::placeholder { color: #a9a6a0; }
.notify input[type="email"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(64, 125, 80, 0.16), 0 16px 36px -18px rgba(60, 50, 40, 0.28);
}

.jb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 0 26px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, opacity 0.2s, box-shadow 0.2s, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.jb:hover { background: var(--green-dark); transform: translateY(-1px); }
.jb:active { transform: scale(0.98); }
.jb:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.notify:has(input:invalid) .jb { opacity: 0.55; }

.j1 { white-space: nowrap; transition: opacity 0.2s; }
.j2 {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 18px;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s 0.3s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s;
}
.dck {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--green-light);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.55s cubic-bezier(0.3, 1.6, 0.5, 1) 0.45s;
}

/* success state */
.is-joined input[type="email"] { display: none; }
.is-joined .jb {
  opacity: 1;
  pointer-events: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(60, 50, 40, 0.05), 0 16px 36px -18px rgba(60, 50, 40, 0.28);
}
.is-joined .j1 { opacity: 0; }
.is-joined .j2 { opacity: 1; transform: none; }
.is-joined .dck { transform: scale(1); }

/* sending: keep the label, just dim the button */
.is-loading .jb { opacity: 0.7; cursor: progress; }

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

@container (min-width: 400px) {
  /* one pill: input + button */
  .notify {
    flex-direction: row;
    align-items: center;
    gap: 0;
    height: 62px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(60, 50, 40, 0.05), 0 16px 36px -18px rgba(60, 50, 40, 0.28);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .notify:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(64, 125, 80, 0.16), 0 16px 36px -18px rgba(60, 50, 40, 0.28);
  }
  .notify input[type="email"] {
    flex: 1 1 auto;
    width: auto;
    height: 100%;
    padding: 0 8px 0 20px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .notify input[type="email"]:focus { box-shadow: none; }
  .jb { flex: none; height: 50px; }
  .is-joined .notify:focus-within { border-color: var(--line); }
  .is-joined .jb {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .is-joined input[type="email"] { display: block; flex: 0 0 0; width: 0; padding: 0; opacity: 0; pointer-events: none; }
}

/* ---------- Product shot + callouts ---------- */

.showcase {
  position: relative;
  width: min(1100px, 100% - 32px);
  margin: 40px auto 56px;
}

.shot {
  position: relative;
  aspect-ratio: 1 / 1.1;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, #000 72%, transparent);
}
/* on phones, crop in on the main panel so the text stays readable */
.shot img {
  width: 165%;
  max-width: none;
  height: auto;
}

.callouts {
  display: grid;
  gap: 12px;
  margin-top: -36px;
  position: relative;
}

.callout {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid rgba(60, 50, 40, 0.1);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(60, 50, 40, 0.1);
}

.callout--low { display: flex; gap: 11px; align-items: flex-start; }
.callout--low .dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--red);
}
.callout--low p:first-child { font-size: 17px; font-weight: 500; line-height: 1.3; }
.callout--low p + p { margin-top: 6px; font-size: 14px; line-height: 1.35; color: var(--ink-3); }

.callout--win .row { display: flex; gap: 14px; align-items: center; }
.callout--win .badge {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-light);
}
.callout--win .kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-dark);
}
.callout--win .title { margin-top: 3px; font-size: 18px; font-weight: 600; line-height: 1.2; }
.callout--win .detail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}
.callout--win .detail p { flex: 1 1 0; font-size: 14px; line-height: 1.35; color: var(--ink-2); }
.bars { display: flex; align-items: flex-end; gap: 10px; flex: none; text-align: center; font-size: 12px; line-height: 1.2; color: var(--ink-3); }
.bars i { display: block; width: 24px; margin: 0 auto 4px; border-radius: 3px; background: var(--sand); }
.bars .before i { height: 28px; }
.bars .since { color: var(--green-dark); }
.bars .since i { height: 38px; background: var(--green-light); }

@media (min-width: 640px) {
  .shot { aspect-ratio: 900 / 600; }
  .shot img { width: 100%; }
  .callouts { grid-template-columns: 1fr 1fr; margin-top: -48px; gap: 16px; }
}

@media (min-width: 960px) {
  .showcase { margin: 56px auto 96px; }
  .shot { aspect-ratio: 900 / 560; }
  .callouts { display: block; margin: 0; }
  .callout {
    position: absolute;
    width: 340px;
    animation: float 7s ease-in-out infinite alternate;
  }
  .callout--low { left: 0; top: 69%; }
  .callout--win { right: 0; top: 48%; padding: 18px; animation-duration: 8.5s; animation-delay: -3s; }
}

@media (min-width: 1240px) {
  .callout--low { left: -60px; }
  .callout--win { right: -60px; }
}

/* ---------- One screen ----------
   Phones, tablets and desktops fit the page to the viewport: the intro scales
   with the viewport height and the product shot fills what is left, cropped
   from the bottom, so the floating cards always fit. If it cannot fit (very
   small windows, big system text) the hero simply grows and the page scrolls. */

@media (min-width: 720px) and (min-height: 480px), (max-width: 719px) and (min-height: 560px) {
  .hero {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .intro { flex: none; }

  .showcase {
    flex: 1 1 0;
    min-height: 180px;
    max-height: 56vh;
    width: min(940px, 100% - 32px);
  }
  .shot {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
  }
  .shot img {
    height: 100%;
    object-fit: cover;
    object-position: top center;
  }

  /* let the cards anchor to .showcase rather than the empty wrapper */
  .callouts { display: block; position: static; margin: 0; }
  .callout { position: absolute; }
}

/* laptops, desktops, tablets, half-width windows */
@media (min-width: 720px) and (min-height: 480px) {
  /* push the intro down so the form sits around eye level (~35-40% from the top) */
  .intro { padding: clamp(24px, 8vh, 96px) 0 0; }
  .logo {
    width: clamp(40px, 6.6vh, 60px);
    height: clamp(40px, 6.6vh, 60px);
    margin-bottom: clamp(8px, 1.6vh, 16px);
  }
  h1 { max-width: 700px; font-size: clamp(30px, 5.8vh, 56px); }
  .lede { max-width: 580px; margin-top: clamp(8px, 1.6vh, 16px); font-size: clamp(16px, 2.2vh, 20px); }
  .join { margin-top: clamp(14px, 2.6vh, 24px); }
  .notify { width: 430px; height: 56px; }
  .jb { height: 44px; font-size: 16px; }
  .notify input[type="email"] { font-size: 16px; }

  .showcase { margin: clamp(28px, 6.5vh, 68px) auto clamp(14px, 4.5vh, 44px); }
  .shot img { width: 100%; }

  .callout { width: 310px; padding: 14px 16px; }
  .callout--low p:first-child { font-size: 16px; }
  .callout--win .title { font-size: 17px; }
  .callout--low { top: auto; bottom: 8%; }
  .callout--win { top: 22%; padding: 15px 16px; }
}

/* below 960px the cards sit at the edges of the shot (wider screens set their own offsets) */
@media (min-width: 720px) and (max-width: 959px) and (min-height: 480px) {
  .callout--low { left: 0; }
  .callout--win { right: 0; }
}

/* tall phones: one card across the bottom of the shot */
@media (max-width: 719px) and (min-height: 560px) {
  .intro { padding: clamp(24px, 7vh, 64px) 0 0; }
  .logo { width: 44px; height: 44px; margin-bottom: 12px; }
  h1 { font-size: clamp(28px, 7.8vw, 40px); }
  .lede { margin-top: 10px; font-size: 17px; }
  .join { margin-top: 18px; }

  .showcase { margin: 24px auto clamp(14px, 3vh, 28px); max-height: none; }
  .shot img { width: 165%; max-width: none; }

  .callout--low { left: 8px; right: 8px; bottom: 4%; top: auto; width: auto; }
  .callout--win { display: none; }
}

/* small phones (iPhone SE and similar): tighten up so the shot still gets room */
@media (max-width: 719px) and (min-height: 560px) and (max-height: 640px) {
  .intro { padding-top: 16px; }
  .logo { width: 36px; height: 36px; margin-bottom: 8px; }
  .lede { font-size: 16px; }
  .join { margin-top: 14px; }
  .showcase { margin-top: 14px; min-height: 150px; }
}

/* ---------- Side by side ----------
   Landscape phones, short windows and dual-screen devices (Surface Duo,
   spanned): the intro takes one side and the product shot the other. On a
   dual-screen device each side sits on its own screen, clear of the hinge. */

@media (orientation: landscape) and (min-width: 560px) and (min-height: 320px) and (max-height: 600px),
       (horizontal-viewport-segments: 2) {
  :root {
    --col1: minmax(0, 6fr);
    --col2: minmax(0, 5fr);
    --hinge: 0px;
  }

  .hero {
    display: grid;
    grid-template-columns: var(--col1) var(--col2);
    column-gap: var(--hinge);
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .intro { width: auto; margin: 0; padding: 0 clamp(16px, 3vw, 40px); }
  .logo {
    width: clamp(36px, 9vh, 56px);
    height: clamp(36px, 9vh, 56px);
    margin-bottom: clamp(6px, 1.6vh, 14px);
  }
  h1 { max-width: none; font-size: clamp(26px, min(8.4vh, 5.4vw), 48px); }
  .lede { max-width: 440px; margin-top: clamp(6px, 1.6vh, 12px); font-size: clamp(14px, 3.4vh, 19px); }
  .join { margin-top: clamp(12px, 3vh, 22px); }

  .notify { width: min(430px, 100%); height: auto; gap: 8px; }
  .notify input[type="email"], .jb { height: 46px; }
  .jb { font-size: 16px; }
  @container (min-width: 400px) {
    .notify { height: 54px; gap: 0; }
    .jb { height: 42px; }
    .notify input[type="email"] { height: 100%; }
  }

  .showcase {
    flex: none;
    align-self: stretch;
    width: auto;
    min-height: 0;
    max-height: none;
    margin: clamp(12px, 4vh, 28px) clamp(12px, 2.4vw, 28px) clamp(12px, 4vh, 28px) 0;
  }
  .shot {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent);
    mask-image: linear-gradient(to bottom, #000 80%, transparent);
  }
  .shot img { width: 100%; max-width: none; height: 100%; object-fit: cover; object-position: top left; }

  .callouts { display: block; position: static; margin: 0; }
  .callout { position: absolute; width: min(300px, 92%); padding: 13px 15px; }
  .callout--low { left: 8px; right: auto; top: auto; bottom: 6%; }
  .callout--low p:first-child { font-size: 15px; }
  .callout--win { display: none; }
}

/* roomy enough for the second card too */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 480px) and (max-height: 600px),
       (horizontal-viewport-segments: 2) and (min-height: 480px) {
  .callout--win { display: block; right: 8px; left: auto; top: 14%; bottom: auto; }
}

@media (horizontal-viewport-segments: 2) {
  :root {
    --col1: env(viewport-segment-width 0 0, 50vw);
    --col2: env(viewport-segment-width 1 0, 50vw);
    --hinge: calc(env(viewport-segment-left 1 0, 50vw) - env(viewport-segment-right 0 0, 50vw));
  }
  .intro { padding: 0 32px; }
  .showcase { margin: 32px 32px 32px 0; }
}

/* dual-screen turned the other way (hinge across the middle): intro above, shot below */
@media (vertical-viewport-segments: 2) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: env(viewport-segment-height 0 0, 50vh) env(viewport-segment-height 0 1, 50vh);
    row-gap: calc(env(viewport-segment-top 0 1, 50vh) - env(viewport-segment-bottom 0 0, 50vh));
    align-items: center;
  }
  .intro { padding: 0; }
  .logo { width: 44px; height: 44px; margin-bottom: 10px; }
  h1 { font-size: 38px; }
  .lede { margin-top: 10px; font-size: 17px; }
  .join { margin-top: 16px; }
  .showcase { align-self: stretch; flex: none; margin: 16px auto; max-height: none; min-height: 0; }
  .callout--low { left: 8px; bottom: 6%; top: auto; }
  .callout--win { display: none; }
}

/* ---------- Entrance ----------
   Starts when <html> gets .ready (see main.js). With reduced motion, or
   without JS, nothing is hidden, so the page just appears. If the script never
   runs, the failsafe animation below reveals everything after 3.2s. */

@media (prefers-reduced-motion: no-preference) {
  :root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --spring: cubic-bezier(0.3, 1.5, 0.5, 1); }

  .w { display: inline-block; }

  @media (scripting: enabled) {
    .hero::before, .logo, .w, .lede, .join, .shot, .callout {
      opacity: 0;
      animation: fade 0.4s ease-out 3.2s both;
    }
  }

  .ready .hero::before { animation: fade 1.8s ease-out both; }
  .ready .logo { animation: pop 0.9s var(--spring) 0.05s both; }
  .ready .w { animation: rise 0.9s var(--ease) both; }
  .ready .w:nth-of-type(1) { animation-delay: 0.2s; }
  .ready .w:nth-of-type(2) { animation-delay: 0.28s; }
  .ready .w:nth-of-type(3) { animation-delay: 0.36s; }
  .ready .w:nth-of-type(4) { animation-delay: 0.44s; }
  .ready .lede { animation: rise 0.9s var(--ease) 0.55s both; }
  .ready .join { animation: rise 0.9s var(--ease) 0.7s both; }
  .ready .shot { animation: lift 1.2s var(--ease) 0.6s both; }
  .ready .callout { animation: spring 1s var(--spring) both; }
  .ready .callout--low { animation-delay: 1.2s; }
  .ready .callout--win { animation-delay: 1.35s; }

  .ready .callout--win .badge { animation: pop 0.7s var(--spring) 1.65s both; }
  .ready .bars i { transform-origin: bottom; animation: grow 0.8s var(--ease) 1.9s both; }
  .ready .callout--low .dot { animation: ring 1.6s ease-out 1.6s 2; }

  @media (min-width: 960px) {
    /* entrance uses translate/scale, so the idle float (transform) can run alongside */
    .ready .callout--low { animation: spring 1s var(--spring) 1.2s both, float 7s ease-in-out infinite alternate; }
    .ready .callout--win { animation: spring 1s var(--spring) 1.35s both, float 8.5s ease-in-out -3s infinite alternate; }
  }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; translate: 0 14px; filter: blur(6px); }
  to { opacity: 1; translate: 0 0; filter: blur(0); }
}
@keyframes pop {
  from { opacity: 0; scale: 0.6; }
  to { opacity: 1; scale: 1; }
}
@keyframes lift {
  from { opacity: 0; translate: 0 28px; scale: 0.985; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes spring {
  from { opacity: 0; translate: 0 22px; scale: 0.92; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes grow { from { scale: 1 0; } to { scale: 1 1; } }
@keyframes ring {
  from { box-shadow: 0 0 0 0 rgba(239, 91, 60, 0.45); }
  to { box-shadow: 0 0 0 10px rgba(239, 91, 60, 0); }
}

@keyframes float {
  from { transform: translateY(-5px); }
  to { transform: translateY(7px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
