/*
  Lingua Bud PWA — Design Tokens
  Net-new file. Not linked from any existing page. See docs/PWA_PRD.md §6.
  These are additive CSS custom properties — they do not touch or override
  anything in styles.css or bootstrap.css. Safe to include on new PWA screens
  only; existing pages are unaffected until someone explicitly adds a <link>.
*/

/* Keep the tab bar and header still. Swiping past the end of a page makes iOS
   rubber-band the whole page, and position:fixed elements bounce with it, so
   the tab bar lifts off the bottom of the screen. Lives here because only app
   pages link this file; the marketing site keeps its normal bounce. */
html, body {
  overscroll-behavior: none;
}

:root {
  /* Color — brand accent kept for decorative use only (fails WCAG AA as text/fill,
     see docs/PWA_PRD.md §6.1). --lb-color-action is the corrected, text-safe teal. */
  --lb-color-accent: #20bcba;
  --lb-color-accent-soft: #e3f5f3;
  --lb-color-action: #0b6664;
  --lb-color-action-hover: #094f4d;
  --lb-color-action-ink: #ffffff;

  --lb-color-ink-900: #113448;
  --lb-color-ink-700: #2a5d77;
  --lb-color-ink-500: #39728f;

  --lb-color-surface-0: #fbfbfb;
  --lb-color-surface-100: #ffffff;
  --lb-color-border: #e7e9e7;
  --lb-color-border-strong: #d7dbd8;

  --lb-color-success: #2f9e58;
  --lb-color-warning: #d98a3d;
  --lb-color-danger: #d64545;

  /* Typography — system font stack, no webfont (see docs/PWA_PRD.md §6.2) */
  --lb-font-sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lb-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --lb-text-xs-size: 12px;   --lb-text-xs-leading: 16px;
  --lb-text-sm-size: 14px;   --lb-text-sm-leading: 20px;
  --lb-text-base-size: 16px; --lb-text-base-leading: 24px;
  --lb-text-lg-size: 18px;   --lb-text-lg-leading: 26px;
  --lb-text-h3-size: 22px;   --lb-text-h3-leading: 28px;
  --lb-text-h2-size: 28px;   --lb-text-h2-leading: 34px;
  --lb-text-h1-size: 34px;   --lb-text-h1-leading: 40px;

  /* Spacing — 4px base unit */
  --lb-space-1: 4px;
  --lb-space-2: 8px;
  --lb-space-3: 12px;
  --lb-space-4: 16px;
  --lb-space-5: 24px;
  --lb-space-6: 32px;
  --lb-space-7: 48px;
  --lb-space-8: 64px;

  /* Radius / shadow / motion */
  --lb-radius-sm: 6px;
  --lb-radius-md: 10px;
  --lb-radius-full: 999px;

  --lb-shadow-card: 0 1px 2px rgba(17, 52, 72, 0.06), 0 8px 24px -12px rgba(17, 52, 72, 0.18);

  --lb-duration-fast: 150ms;
  --lb-duration-base: 200ms;
  --lb-ease-out: cubic-bezier(0, 0, 0.2, 1);

  --lb-z-shell: 1000;
}

/* ── Page-to-page transitions ─────────────────────────────────────────────
   Every app screen is its own page, so moving between them used to be a hard
   cut. Browsers that support cross-document View Transitions (Chrome 126+,
   Safari 18.2+) now fade the content across instead; older ones just keep
   the hard cut, nothing breaks. Only pages that link this file opt in, i.e.
   the app-shell pages — the marketing site is unaffected.
   The header and tab bar are named so they're lifted out of the fade and
   stay put: the tab bar shows the new page's own bar immediately, so its
   glider can finish sliding instead of being cross-faded. Named from out
   here via ::part — a view-transition-name set inside the component's
   shadow DOM is ignored for page navigations. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  lb-app-shell::part(header) { view-transition-name: lb-header; }
  lb-app-shell::part(nav) { view-transition-name: lb-nav; }

  ::view-transition-old(root) {
    animation: 160ms cubic-bezier(0, 0, 0.2, 1) both lb-page-out;
  }
  ::view-transition-new(root) {
    animation: 260ms cubic-bezier(0.2, 0.9, 0.1, 1) both lb-page-in;
  }
  ::view-transition-group(lb-header) { animation-duration: 200ms; }
  ::view-transition-old(lb-nav) { display: none; }
  ::view-transition-new(lb-nav) { animation: none; }
}

@keyframes lb-page-out { to { opacity: 0; } }
@keyframes lb-page-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Skeleton placeholders ────────────────────────────────────────────────
   Grey shapes shown where content is about to appear, instead of a spinner
   or an empty "nothing here" message. Written straight into each page's HTML
   (not by its module script) so they're on screen with the very first paint
   — the module scripts only run once the Firebase SDK has downloaded. Each
   page's own render code replaces them when the real data arrives. */
.lb-skel {
  display: block;
  background: linear-gradient(90deg, #eceff1 25%, #f5f7f8 37%, #eceff1 63%);
  background-size: 400% 100%;
  border-radius: 8px;
  animation: lb-skel-shimmer 1.4s ease infinite;
}
.lb-skel-line { height: 12px; margin-bottom: 8px; }
.lb-skel-line:last-child { margin-bottom: 0; }
.lb-skel-title { height: 16px; margin-bottom: 10px; }
.lb-skel-circle { border-radius: 50%; flex-shrink: 0; }
.lb-skel-pill { display: inline-block; height: 24px; width: 72px; border-radius: 999px; margin-right: 6px; }
/* Inline stand-in for a one-line subtitle, sized like the text it replaces. */
.lb-skel-text { display: inline-block; height: 0.8em; width: 10em; vertical-align: middle; }
/* Screen readers get one plain "Loading" instead of a pile of empty shapes. */
.lb-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@keyframes lb-skel-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-skel { animation: none; }
}

/* Directional slides for moving deeper / back up (direction is decided by
   js/page-transitions.js). The header and tab bar stay put as above; only
   the page content slides. Kept in their own rules: a browser that doesn't
   know :active-view-transition-type() drops just these and keeps the fade. */
@media (prefers-reduced-motion: no-preference) {
  html:active-view-transition-type(lb-forward)::view-transition-old(root) {
    animation: 340ms cubic-bezier(0.2, 0.9, 0.1, 1) both lb-push-old-out;
    mix-blend-mode: normal;
  }
  html:active-view-transition-type(lb-forward)::view-transition-new(root) {
    animation: 340ms cubic-bezier(0.2, 0.9, 0.1, 1) both lb-push-new-in;
    mix-blend-mode: normal;
    box-shadow: -10px 0 30px rgba(17, 52, 72, 0.12);
  }
  html:active-view-transition-type(lb-back)::view-transition-old(root) {
    animation: 300ms cubic-bezier(0.2, 0.9, 0.1, 1) both lb-pop-old-out;
    mix-blend-mode: normal;
    box-shadow: -10px 0 30px rgba(17, 52, 72, 0.12);
    z-index: 1; /* the screen being dismissed slides away on top */
  }
  html:active-view-transition-type(lb-back)::view-transition-new(root) {
    animation: 300ms cubic-bezier(0.2, 0.9, 0.1, 1) both lb-pop-new-in;
    mix-blend-mode: normal;
  }
}

@keyframes lb-push-new-in { from { transform: translateX(100%); } }
@keyframes lb-push-old-out { to { transform: translateX(-28%); opacity: 0.6; } }
@keyframes lb-pop-old-out { to { transform: translateX(100%); } }
@keyframes lb-pop-new-in { from { transform: translateX(-28%); opacity: 0.6; } }

/* Country flag emoji — "Twemoji Country Flags" is only defined on devices
   without flag emoji (Windows); see js/flag-emoji.js. */
.flag-emoji {
  font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
