/*
 * The public pages' only stylesheet. Hand-written rather than Tailwind: these
 * pages have no build step of their own and no React, and a few hundred lines
 * of utility CSS would outweigh the page. Colours are the app's tokens from
 * src/index.css, as hex.
 */
:root {
  --bg: #fcfcfc;
  --fg: #141820;
  --muted: #6b7380;
  --border: #e5e7eb;
  --card: #ffffff;
  /* Darker than the app's #10B77F on purpose: that green is 2.6:1 behind
     white text and as text on this background, under the 4.5:1 that body
     text and buttons need. This one is about 5.5:1 for both. */
  --primary: #047857;
  --primary-fg: #ffffff;
  --link: #047857;
  --accent: #f59e0b;
  color-scheme: light;
}
/* Light unless chosen: `public/theme.js` sets data-theme from the switch. */
:root[data-theme="dark"] {
  --bg: #0f1216;
  --fg: #f2f2f2;
  --muted: #8f97a3;
  --border: #262b33;
  --card: #161a20;
  /* On near-black, a link needs the light green instead. */
  --link: #34d399;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  /* Set here as well as on body: an overflow set on body alone is handed
     to the viewport and body itself stops clipping. */
  overflow-x: clip;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  line-height: 1.55;
  /* The hero's badges and glow hang past its edges on purpose. In Arabic
     that overhang is on the side a page can scroll towards, and the whole
     page slid sideways on a phone; `clip`, unlike `hidden`, makes no
     scroll container, so nothing else changes. */
  overflow-x: clip;
}
a {
  color: var(--link);
}
img {
  max-width: 100%;
  height: auto;
}

.bar,
main,
.foot {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}
.bar {
  padding-top: 16px;
  padding-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  /* Above the hero's background, which reaches up behind it: without this
     the dot grid swallowed every click on the header's switches. */
  position: relative;
  z-index: 2;
}
.langs {
  margin-inline-start: auto;
  display: flex;
  gap: 4px;
}
/* 44px tall: the comfortable size for a thumb, not just WCAG's 24px floor. */
.langs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0 10px;
  border-radius: 10px;
}
.langs a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--border);
}
.langs .short {
  display: none;
}
@media (max-width: 480px) {
  .langs .long {
    display: none;
  }
  .langs .short {
    display: inline;
  }
}
.theme {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  flex: none;
}
.theme .sun,
:root[data-theme="dark"] .theme .moon {
  display: none;
}
:root[data-theme="dark"] .theme .sun {
  display: block;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
main {
  padding-bottom: 48px;
}
h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 24px 0 12px;
}
h2 {
  font-size: 1.3rem;
  margin: 32px 0 12px;
}
h3 {
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.lead {
  font-size: 1.1rem;
}
.muted {
  color: var(--muted);
  font-weight: normal;
}
.small {
  font-size: 0.85rem;
}

.hero {
  padding: 24px 0 8px;
}
.hero-text {
  max-width: 640px;
}
.hero p {
  font-size: 1.1rem;
}
.hero .trust {
  color: var(--muted);
  font-size: 0.95rem;
}
/* The app on the first screen: beside the text on a wide screen, straight
   under the buttons on a phone. */
.hero-shot {
  margin: 24px auto 0;
  max-width: 300px;
}
@media (min-width: 860px) {
  .hero.has-shot {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 48px;
    align-items: center;
  }
  .hero-shot {
    margin: 0;
    justify-self: end;
  }
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  background: var(--primary);
  color: var(--primary-fg);
  border: 1.5px solid var(--primary);
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.button.secondary {
  background: transparent;
  color: var(--link);
  border-color: var(--link);
}
.link {
  font-weight: 600;
}

.cta {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

/* "What's inside": everything the app does, at a glance. */
.capabilities {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  /* Two columns even on a 320px phone, so twelve items stay a glance. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
}
@media (min-width: 640px) {
  .capabilities {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}
.capabilities li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.35;
}
.capabilities li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.5em;
  border-radius: 999px;
  background: var(--primary);
}

/* One section per thing the app does: words beside the screens that show
   it, swapping sides from one section to the next on a wide screen. */
.feature {
  padding: 40px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.feature h2 {
  margin-top: 0;
}
.feature-text p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 560px;
}
.feature-shots {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.feature-shots.shots-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* Screens of different heights (a search bar beside a whole sheet) sit
     on their middles rather than hanging from the top. */
  align-items: center;
}
.feature-shots.shots-1 {
  max-width: 320px;
}
.feature-shots figure {
  margin: 0;
}
.feature-shots figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
@media (min-width: 860px) {
  .feature:not(.text-only) {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 48px;
    align-items: center;
  }
  /* Swapped sides keep the wider column for the screens. */
  .feature:not(.text-only):nth-of-type(odd) {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
  .feature:not(.text-only):nth-of-type(odd) .feature-text {
    order: 2;
  }
  .feature-shots {
    margin-top: 0;
  }
}
/* Two screens side by side are too small on a phone; swipe instead. */
@media (max-width: 640px) {
  .feature-shots.shots-2 {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 16px -16px 0;
    padding: 0 16px 8px;
    scroll-padding-inline: 16px;
  }
  .feature-shots.shots-2 figure {
    flex: 0 0 80%;
    scroll-snap-align: start;
  }
}

.closing {
  margin-top: 48px;
  padding: 32px 24px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: center;
}
.closing h2 {
  margin-top: 0;
}
.closing p {
  color: var(--muted);
}
.closing .actions {
  justify-content: center;
}

.dishes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.dishes a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--fg);
  text-decoration: none;
}
.dishes img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--border);
}
.dishes .name {
  font-weight: 600;
}
.dishes .kcal {
  color: var(--muted);
  font-size: 0.85rem;
}

.feature-shots img,
.hero-shot img {
  width: 100%;
  /* A white frame like a phone's bezel: some screens run text to the very
     edge, and the rounded corner would otherwise clip it. White in both
     themes, because the screens themselves are. */
  padding: 8px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}
.crumbs {
  margin: 8px 0 0;
}
.dish {
  max-width: 680px;
}
.photo {
  margin: 16px 0;
}
.photo img {
  border-radius: 16px;
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
  max-width: 480px;
}
.photo figcaption {
  color: var(--muted);
  font-size: 0.8rem;
}
.nutrition {
  border-collapse: collapse;
  width: 100%;
  max-width: 420px;
}
.nutrition th,
.nutrition td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-align: start;
}
.nutrition td {
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.nutrition th {
  font-weight: normal;
}
.ingredients,
.steps {
  padding-inline-start: 20px;
}
.ingredients li,
.steps li {
  margin-bottom: 6px;
}
.amount {
  font-weight: 600;
}
.cta {
  margin-top: 32px;
}
.cta h2 {
  margin-top: 0;
}

.foot {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.foot a {
  display: inline-block;
  padding: 12px 0;
  color: var(--muted);
}

/* ── Showing off, a little ─────────────────────────────────────────────────
   Everything below is decoration, and all of it stands still for anyone who
   asks their system for reduced motion (the block at the end). No library,
   no script: CSS animations, and scroll-driven ones where the browser has
   them. */

.brand-name {
  white-space: nowrap;
}

/* The hero's headline fades from ink into the brand green, top to bottom,
   so a line never changes colour halfway through a word. */
.hero h1 {
  background: linear-gradient(180deg, var(--fg) 30%, var(--link) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* A faint dot grid behind the hero, fading out towards the edges. */
.hero {
  position: relative;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40px -16px 0;
  z-index: -1;
  background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 70% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 70% at 70% 40%, #000 30%, transparent 75%);
}

/* The phone in the hero: tilted towards the text, floating, with a warm
   glow behind it and three badges drifting around it. */
.hero-shot {
  position: relative;
  perspective: 1200px;
}
.hero-shot img {
  position: relative;
  transform: rotateY(-10deg) rotateX(4deg);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  animation: kb-float 7s ease-in-out infinite;
}
[dir="rtl"] .hero-shot img {
  transform: rotateY(10deg) rotateX(4deg);
}
.hero-shot:hover img {
  transform: none;
  animation-play-state: paused;
}
.glow {
  position: absolute;
  inset: -12% -18%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(closest-side at 35% 40%, rgb(16 183 127 / 0.35), transparent),
    radial-gradient(closest-side at 70% 65%, rgb(245 158 11 / 0.28), transparent);
  filter: blur(24px);
  animation: kb-drift 12s ease-in-out infinite alternate;
}
.badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
  font-size: 0.85rem;
  white-space: nowrap;
  animation: kb-float 6s ease-in-out infinite;
}
.badge b {
  font-weight: 700;
  color: var(--fg);
}
.badge small {
  color: var(--muted);
}
.badge-ring {
  top: 16%;
  inset-inline-start: -28px;
  color: var(--primary);
  padding-block: 6px;
  padding-inline: 6px 12px;
  animation-delay: -1.5s;
}
.badge-ring .ring-arc {
  animation: kb-ring 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}
.badge-hp {
  top: 46%;
  inset-inline-end: -22px;
  color: var(--primary);
  animation-delay: -3s;
}
.badge-streak {
  bottom: 12%;
  inset-inline-start: -14px;
  color: var(--accent);
  animation-delay: -4.5s;
}

/* On a phone the hero shot has only a few pixels of margin either side, so
   the badges tuck in rather than hang past the screen's edge. */
@media (max-width: 640px) {
  .badge-ring {
    inset-inline-start: -10px;
  }
  .badge-hp {
    inset-inline-end: -10px;
  }
  .badge-streak {
    inset-inline-start: -6px;
  }
}

@keyframes kb-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}
@keyframes kb-drift {
  from {
    transform: translate(-3%, 2%) scale(1);
  }
  to {
    transform: translate(3%, -2%) scale(1.06);
  }
}
@keyframes kb-ring {
  from {
    stroke-dasharray: 0 100;
  }
}

/* Dish names drifting past. Two identical groups, moved by exactly one
   group's width, make the loop seamless; hovering stops it to click. */
.marquee {
  margin: 40px -16px 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: kb-marquee 60s linear infinite;
}
.marquee:hover .marquee-track,
.marquee:focus-within .marquee-track {
  animation-play-state: paused;
}
.marquee-group {
  display: flex;
  gap: 10px;
  padding-inline-end: 10px;
}
.marquee a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.marquee a:hover {
  border-color: var(--link);
  color: var(--link);
}
@keyframes kb-marquee {
  to {
    transform: translateX(-50%);
  }
}

/* Screens lift a little under the pointer. */
.feature-shots img {
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s;
}
.feature-shots figure:hover img {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.14);
}

/* Sections rise into place as they scroll in, where the browser can tie an
   animation to scrolling. Elsewhere they are simply there. */
@supports (animation-timeline: view()) {
  .inside,
  .feature,
  .closing {
    animation: kb-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
}
@keyframes kb-reveal {
  from {
    opacity: 0;
    translate: 0 32px;
  }
}

/* ── The marketing switch ─────────────────────────────────────────────────
   Where Sentry puts theirs: a card of its own floating in the top corner,
   under the header, so nobody has to go looking for it. On a phone it moves
   to the bottom corner, within reach of a thumb and clear of the header. */
.marketing-card {
  position: fixed;
  z-index: 10;
  bottom: 16px;
  inset-inline-end: 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.16);
}
/* Top corner only where the page leaves a margin for it; on anything
   narrower it would sit on the hero's phone. */
@media (min-width: 1280px) {
  .marketing-card {
    top: 84px;
    bottom: auto;
    inset-inline-end: 24px;
  }
}
.marketing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.marketing-label {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
/* The thumb and the word swap sides with the state; the word says the
   state outright, as Sentry's does, rather than leaving it to a colour. */
.marketing-track {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 64px;
  height: 28px;
  padding: 0 3px 0 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 0.25s;
}
.marketing-thumb {
  flex: none;
  width: 22px;
  height: 22px;
  margin-inline-start: auto;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
}
.marketing .state-off {
  display: none;
}
.marketing[aria-checked="false"] .marketing-track {
  flex-direction: row-reverse;
  padding: 0 10px 0 3px;
  background: var(--border);
  color: var(--muted);
}
.marketing[aria-checked="false"] .marketing-thumb {
  margin-inline-start: 0;
  margin-inline-end: auto;
}
.marketing[aria-checked="false"] .state-on {
  display: none;
}
.marketing[aria-checked="false"] .state-off {
  display: inline;
}
.marketing:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 6px;
  border-radius: 8px;
}
@media (max-width: 380px) {
  .brand-name {
    display: none;
  }
}

/* Marketing off: everything goes but one line and the way in. */
.plain {
  display: none;
}
[data-marketing="off"] main > section:not(.plain) {
  display: none;
}
[data-marketing="off"] .plain {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-height: calc(100vh - 220px);
  text-align: center;
}
.plain::before {
  content: "";
  position: absolute;
  inset: 10% 15%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(closest-side at 40% 45%, rgb(16 183 127 / 0.25), transparent),
    radial-gradient(closest-side at 62% 58%, rgb(245 158 11 / 0.2), transparent);
  filter: blur(30px);
  animation: kb-drift 10s ease-in-out infinite alternate;
}
.plain-line {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 5.5rem);
  font-weight: 800;
  line-height: 1.25;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(120deg, var(--fg) 30%, var(--link));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.plain-cta {
  min-height: 56px;
  padding: 0 32px;
  font-size: 1.1rem;
}

/* Reduced motion: every flourish above, holding still. */
@media (prefers-reduced-motion: reduce) {
  .hero-shot img,
  .glow,
  .badge,
  .badge-ring .ring-arc,
  .marquee-track,
  .plain::before,
  .inside,
  .feature,
  .closing {
    animation: none;
  }
  .marquee {
    overflow-x: auto;
  }
  .hero-shot img,
  .feature-shots img,
  .marketing-thumb {
    transition: none;
  }
}
