/* XIAN Action Cam — Connection Automation prototype
   Shared styles for Explore + My Camera screens and snackbar overlays.
   Tokens pulled directly from Figma file YpPHEesZnf4q1bzCJkjZZr (XIAN APP PHASE 2). */

/* ── Font: SF Pro on Apple, Inter (metric-compatible) elsewhere ──
   Inter via Google Fonts is loaded so Windows/Linux viewers get a font with
   the same x-height and tracking as SF Pro instead of falling back to
   Segoe UI / Roboto (which would shift every character width). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;590;600;700&display=swap');

:root {
  /* ── Light Material 3 palette (XIAN brand) ── */
  --xian-primary: #0075f5;
  --xian-on-primary: #ffffff;
  --xian-on-surface: #0a0a0a;
  --xian-on-surface-low: #3d3d3d;
  --xian-on-surface-lowest: #7a7a7a;
  --xian-surface: #f7f7f7;
  --xian-white: #ffffff;
  --xian-outline: #d6d6d6;
  --xian-outline-variant: #ebebeb;
  --xian-fills-primary: rgba(120, 120, 120, 0.2);
  --xian-fills-tertiary: rgba(0, 0, 0, 0.08);
  --xian-translucent-1: rgba(0, 0, 0, 0.1);
  --xian-translucent-2: rgba(0, 0, 0, 0.08);
  --xian-bg-grouped-primary: #f2f2f7;
  --xian-battery-fill: #38f409; /* exact green from Figma battery icon */

  /* ── Type scale (Figma typescale tokens, sizes match design 1:1) ── */
  --type-title-large: 22px;
  --type-title-large-lh: 28px;
  --type-title-medium: 18px;
  --type-title-medium-lh: 23px; /* Figma reports 21 in some uses, 23 in others; My Camera uses 23 */
  --type-title-medium-tighter-lh: 21px; /* used inside chip rows on Explore */
  --type-title-small: 17px;
  --type-title-small-lh: 21px;
  --type-body-medium: 16px;
  --type-body-medium-lh: 22px;
  --type-body-small: 14px;
  --type-body-small-lh: 20px;
  --type-label-large: 16px;
  --type-label-large-lh: 21px; /* Connect button */
  --type-label-medium: 13px;
  --type-label-medium-lh: 18px; /* Filter chips */
  --type-label-vsmall: 12px;
  --type-label-vsmall-lh: 16px; /* Status chips */
  --type-label-small: 13px;
  --type-label-small-lh: 16px; /* Nav-bar label */

  /* Letter spacing (Figma "tracking") values exact */
  --track-title-large: 0px;
  --track-title-medium: -0.45px;
  --track-title-small: -0.31px;
  --track-body-medium: -0.31px;
  --track-body-small: -0.23px;
  --track-label-large: -0.31px;
  --track-label-medium: -0.08px;
  --track-label-small: 0.5px;
  --track-label-vsmall: 0.5px;

  /* ── Corner radii ── */
  --corner-xs: 4px;
  --corner-sm: 8px;
  --corner-md: 12px;
  --corner-pill: 9999px;

  /* ── iPhone 17 Pro frame (matches Dash Cam LINK convention) ── */
  --frame-w: 450px;
  --frame-h: 920px;
  --screen-w: 402px;
  --screen-h: 874px;
  --screen-x: 24px;
  --screen-y: 23px;
  --screen-radius: 55px;

  /* ── Font stack: real SF Pro on Mac/iOS, Inter elsewhere, system fallback ── */
  --font-stack:
    -apple-system, BlinkMacSystemFont, 'SF Pro', 'SF Pro Text', 'Inter', 'Segoe UI', system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: var(--font-stack);
  font-feature-settings: 'cv11', 'ss01', 'ss03'; /* Inter alts that nudge it closer to SF Pro */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #e7e8eb;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ─── Embed mode (iframed inside the Connection-Automation prototype) ───
   The parent renders its own iPhone frame. We hide our device chrome and
   let the screen fill the iframe edge-to-edge so it slots cleanly into
   the parent's <div class="screen"> slot without nesting two frames. */
html[data-embed],
html[data-embed] body {
  width: 100%;
  height: 100%;
  background: transparent;
}
html[data-embed] body {
  padding: 0;
  min-height: 0;
  display: block;
}
html[data-embed] .iphone17 {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: none;
}
html[data-embed] .iphone17::after {
  display: none;
}
html[data-embed] .iphone17 .screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* ───── iPhone 17 Pro Silver device frame ───── */
.iphone17 {
  position: relative;
  width: var(--frame-w);
  height: var(--frame-h);
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, 0.32)) drop-shadow(0 8px 24px rgba(0, 0, 0, 0.18));
}
.iphone17::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/mockups/iphone-17-pro-silver.png') top left / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 30;
}
.iphone17 .screen {
  position: absolute;
  top: var(--screen-y);
  left: var(--screen-x);
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: var(--screen-radius);
  overflow: hidden;
  background: var(--xian-white);
  z-index: 1;
}

/* ───── Status bar (light mode, dark glyphs) ───── */
.status-bar {
  display: block;
  width: 402px;
  height: 62px;
  background-color: #ffffff;
  background-image: url('/mockups/iphone-status-bar.png');
  background-repeat: no-repeat;
  background-position: top left;
  background-size: 402px 62px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

/* ───── Overall screen layout ───── */
.scr {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: inherit;
  position: relative;
}
.scr > * {
  flex-shrink: 0;
}
.scr > .body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

/* Hide native scrollbars but keep scrolling */
.scrollable {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollable::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ───────────────────────────────────────────────
   Bottom navigation (shared by Explore & My Camera)
   Active item: Material 3 navigation-bar selected style — pill background
   behind the icon, primary-blue label below.
   ─────────────────────────────────────────────── */
.nav-bar {
  background: var(--xian-white);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 0 16px;
  width: 100%;
  position: relative;
  z-index: 4;
}
.nav-bar .nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
}
.nav-bar .nav-item .icon-wrap {
  display: grid;
  place-items: center;
  width: 64px;
  height: 32px;
  border-radius: 16px;
  transition: background-color 200ms ease;
}
.nav-bar .nav-item .icon-wrap img,
.nav-bar .nav-item .icon-wrap svg {
  width: 24px;
  height: 24px;
  display: block;
  transition: opacity 200ms ease;
}
/* The More widget glyph (Union svg) fills its full 20×20 viewBox edge-to-edge
   without the 4px inset that the Explore/Media/Camera icons have, so at 24px
   it reads as visually larger. Cap it at 20px so all four nav glyphs share
   the same visual footprint. */
.nav-bar .nav-item[data-id='more'] .icon-wrap img {
  width: 20px;
  height: 20px;
}
.nav-bar .nav-item .label {
  font-family: var(--font-stack);
  font-weight: 510;
  font-size: var(--type-label-small);
  line-height: var(--type-label-small-lh);
  letter-spacing: var(--track-label-small);
  color: var(--xian-on-surface-low);
  font-variation-settings: 'wdth' 100;
  transition: color 200ms ease;
}
/* Active state: blue label only. The focused SVGs (Explore-focused.svg /
   Mycamera-focused.svg) already paint themselves in primary blue, so no
   pill background and no recolour filter are needed. */
.nav-bar .nav-item.is-active .label {
  color: var(--xian-primary);
}
