/* ============================================
   Timeline Scan — Apps Before/After Demo
   Three faux app shells (Google Photos, iOS Photos,
   Immich) sharing one photo dataset to show the
   sorted-vs-unsorted difference visually.
   ============================================ */

/* ── Section frame ── */
.apps-demo {
  max-width: 1040px;
  margin: 0 auto;
}

.apps-demo__intro {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.apps-demo__intro p {
  color: var(--text-secondary);
}

.apps-demo__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1.4rem;
  margin: 1.5rem 0 1.25rem;
}

.apps-demo__group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.apps-demo__group-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.apps-demo__pill-row {
  display: inline-flex;
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
  box-shadow: var(--shadow-sm);
}

.apps-demo__pill {
  appearance: none;
  background: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
  letter-spacing: 0.01em;
}

.apps-demo__pill:hover {
  color: var(--text-primary);
}

.apps-demo__pill.is-active {
  background: var(--bg-secondary);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.apps-demo__pill--state.is-active {
  background: var(--accent);
  color: var(--bg-secondary);
}

.apps-demo__pill:active { transform: scale(0.97); }

/* ── The viewport: where the active app shell renders ── */
.apps-demo__viewport {
  position: relative;
  background: #f7f7f5;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-height: 540px;
  transition: opacity 0.18s ease;
}

.apps-demo__viewport.is-swapping {
  opacity: 0;
}

.apps-demo__caption {
  margin-top: 1rem;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Small legal-disclaimer line: even smaller and lower-contrast than the
   caption above, so it reads as a footnote rather than competing for
   attention. Sets the trade-dress imitation in the shells in context. */
.apps-demo__attribution {
  margin: 0.4rem auto 0;
  max-width: 640px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: 0.7;
  letter-spacing: 0.005em;
}

/* ── Generic photo tile (used by all shells) ── */
.app-photo {
  --tile-aspect: 1;
  width: 100%;
  margin: 0;
  background: #d8d8d8;
  position: relative;
  overflow: hidden;
}

.app-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-photo--scan img {
  filter: saturate(0.9) contrast(0.95) sepia(0.06);
}

.app-photo--scan::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 255, 246, 0.72);
  box-shadow: inset 0 0 0 1px rgba(60, 42, 28, 0.08), inset 0 0 22px rgba(92, 56, 24, 0.16);
  pointer-events: none;
  z-index: 1;
}

.app-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,0.14) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/></svg>");
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.app-photo--scan::after {
  opacity: 0.42;
  mix-blend-mode: multiply;
}

/* In-flight FLIP state — keeps the photo above its neighbors as it
   travels from old to new position so it doesn't slide under siblings. */
.app-photo--flying {
  position: relative;
  will-change: transform, box-shadow;
  z-index: 5;
}

/* ============================================
   GOOGLE PHOTOS
   ============================================ */
.gp {
  --gp-bg: #ffffff;
  --gp-fg: #1f1f1f;
  --gp-fg-soft: #5f6368;
  --gp-rail-bg: #ffffff;
  --gp-rail-hover: #f1f3f4;
  --gp-rail-active: #fce8e6;
  --gp-rail-active-fg: #c5221f;
  --gp-search-bg: #f1f3f4;
  --gp-border: #e8eaed;
  --gp-blue: #1a73e8;
  background: var(--gp-bg);
  color: var(--gp-fg);
  font-family: 'Google Sans', 'Roboto', -apple-system, sans-serif;
  height: 540px;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .gp {
  --gp-bg: #202124;
  --gp-fg: #e8eaed;
  --gp-fg-soft: #9aa0a6;
  --gp-rail-bg: #202124;
  --gp-rail-hover: #3c4043;
  --gp-rail-active: #3c2725;
  --gp-rail-active-fg: #f28b82;
  --gp-search-bg: #303134;
  --gp-border: #3c4043;
}

.gp__topbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.58rem 1rem;
  border-bottom: 1px solid var(--gp-border);
  flex: 0 0 auto;
}

.gp__menu {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 50%;
}
.gp__menu span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--gp-fg-soft);
  border-radius: 1px;
}

.gp__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 105px;
  color: var(--gp-fg);
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: 0;
}

.gp__brand-mark {
  position: relative;
  width: 27px;
  height: 27px;
  display: inline-block;
}

.gp__brand-mark i {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 10px 10px 2px 10px;
  opacity: 0.95;
}

.gp__brand-mark i:nth-child(1) { left: 6px; top: 0; background: #ea4335; transform: rotate(45deg); }
.gp__brand-mark i:nth-child(2) { right: 0; top: 6px; background: #fbbc04; transform: rotate(135deg); }
.gp__brand-mark i:nth-child(3) { left: 6px; bottom: 0; background: #34a853; transform: rotate(225deg); }
.gp__brand-mark i:nth-child(4) { left: 0; top: 6px; background: #4285f4; transform: rotate(315deg); }

.gp__search {
  flex: 1;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--gp-search-bg);
  color: var(--gp-fg-soft);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.gp__icons {
  display: inline-flex;
  gap: 0.35rem;
}
.gp__icon-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  position: relative;
}
.gp__icon-dot::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 2px;
  background: var(--gp-fg-soft);
  opacity: 0.55;
}
.gp__icon-dot--grid::after {
  inset: 8px;
  border-radius: 50%;
}

.gp__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f4b400, #db4437);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.gp__layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.gp__rail {
  flex: 0 0 214px;
  border-right: 1px solid var(--gp-border);
  padding: 0.6rem 0.4rem;
  background: var(--gp-rail-bg);
}

.gp__rail-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: 0 999px 999px 0;
  margin: 0 0.4rem 2px 0;
  font-size: 0.88rem;
  color: var(--gp-fg);
  cursor: default;
}

.gp__rail-item:hover {
  background: var(--gp-rail-hover);
}

.gp__rail-item--active {
  background: var(--gp-rail-active);
  color: var(--gp-rail-active-fg);
  font-weight: 500;
}

.gp__rail-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.72;
}

.gp__rail-dot--photos {
  background: conic-gradient(#4285f4 0 25%, #34a853 0 50%, #fbbc04 0 75%, #ea4335 0);
}

.gp__rail-dot--memories { border-radius: 6px; }
.gp__rail-dot--albums { border-radius: 4px; }
.gp__rail-dot--sharing {
  width: 20px;
  height: 14px;
  border-radius: 999px;
}

.gp__rail-rule {
  height: 1px;
  background: var(--gp-border);
  margin: 0.7rem 1rem;
}

.gp__storage {
  display: grid;
  gap: 0.12rem;
  padding: 0.3rem 1rem;
  color: var(--gp-fg-soft);
  font-size: 0.76rem;
}

.gp__storage strong {
  color: var(--gp-fg);
  font-size: 0.82rem;
  font-weight: 500;
}

.gp__main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem 2rem;
  /* No scroll-behavior:smooth here — it fights the rAF-driven scroll-follow
     animation that runs during Before/After transitions, causing each
     scrollTop write to be wrapped in its own smooth-scroll and falling
     behind the tween. Native wheel/touch scrolling is unaffected. */
}

.gp__group {
  margin-bottom: 1.4rem;
}

.gp__date {
  font-family: 'Google Sans', 'Roboto', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gp-fg);
  margin: 0 0 0.6rem;
  letter-spacing: 0;
}

.gp__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.gp__grid .app-photo {
  border-radius: 0;
}

/* ============================================
   iOS PHOTOS
   ============================================ */
.ios {
  box-sizing: border-box;
  background:
    radial-gradient(circle at 24% 22%, rgba(255,255,255,0.46), transparent 32%),
    linear-gradient(180deg, #dfe4e9 0%, #bfc7d0 100%);
  height: 540px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

[data-theme="dark"] .ios {
  background: linear-gradient(180deg, #2a2c30 0%, #1a1c20 100%);
}

.ios__device {
  box-sizing: border-box;
  --ios-frame: #151515;
  --ios-bg: #ffffff;
  --ios-fg: #000000;
  --ios-fg-soft: #6c6c70;
  --ios-fg-blue: #007aff;
  --ios-border: #e5e5ea;
  --ios-tab-bg: rgba(249, 249, 249, 0.78);
  width: 334px;
  height: 100%;
  background: var(--ios-frame);
  color: var(--ios-fg);
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  border-radius: 36px;
  padding: 10px;
  position: relative;
  overflow: visible;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
}

[data-theme="dark"] .ios__device {
  --ios-frame: #050505;
  --ios-bg: #000000;
  --ios-fg: #ffffff;
  --ios-fg-soft: #8e8e93;
  --ios-fg-blue: #0a84ff;
  --ios-border: #1c1c1e;
  --ios-tab-bg: rgba(28, 28, 30, 0.7);
  box-shadow: 0 12px 36px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
}

.ios__screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--ios-bg);
  color: var(--ios-fg);
  border-radius: 26px;
  overflow: hidden;
  clip-path: inset(0 round 26px);
  display: flex;
  flex-direction: column;
  isolation: isolate;
  transform: translateZ(0);
}

.ios__notch {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 26px;
  background: #1a1a1a;
  border-radius: 16px;
  z-index: 5;
}

.ios__statusbar {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.62rem 1.42rem 0.16rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.ios__time { letter-spacing: 0; }
.ios__status-icons { display: inline-flex; align-items: center; gap: 5px; }
/* Cellular bars */
.ios__status-icons span:nth-child(1) {
  width: 16px;
  height: 10px;
  background: var(--ios-fg);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'><rect x='0' y='7' width='2.5' height='3' rx='0.5'/><rect x='4' y='5' width='2.5' height='5' rx='0.5'/><rect x='8' y='3' width='2.5' height='7' rx='0.5'/><rect x='12' y='0' width='2.5' height='10' rx='0.5'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'><rect x='0' y='7' width='2.5' height='3' rx='0.5'/><rect x='4' y='5' width='2.5' height='5' rx='0.5'/><rect x='8' y='3' width='2.5' height='7' rx='0.5'/><rect x='12' y='0' width='2.5' height='10' rx='0.5'/></svg>") center/contain no-repeat;
}
/* Wifi arcs */
.ios__status-icons span:nth-child(2) {
  width: 14px;
  height: 10px;
  background: var(--ios-fg);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10'><path d='M7 9.5a1 1 0 100-2 1 1 0 000 2zM2.5 5.2A6 6 0 017 3.5a6 6 0 014.5 1.7l1.1-1.2A7.6 7.6 0 007 2 7.6 7.6 0 001.4 4l1.1 1.2zM4.4 7.1A3.5 3.5 0 017 6a3.5 3.5 0 012.6 1.1l1-1.1A5 5 0 007 4.5 5 5 0 003.4 6l1 1.1z'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10'><path d='M7 9.5a1 1 0 100-2 1 1 0 000 2zM2.5 5.2A6 6 0 017 3.5a6 6 0 014.5 1.7l1.1-1.2A7.6 7.6 0 007 2 7.6 7.6 0 001.4 4l1.1 1.2zM4.4 7.1A3.5 3.5 0 017 6a3.5 3.5 0 012.6 1.1l1-1.1A5 5 0 007 4.5 5 5 0 003.4 6l1 1.1z'/></svg>") center/contain no-repeat;
}
/* Battery */
.ios__status-icons span:nth-child(3) {
  width: 24px;
  height: 11px;
  background: transparent;
  border: 1px solid var(--ios-fg);
  border-radius: 2.5px;
  opacity: 0.5;
  position: relative;
}
.ios__status-icons span:nth-child(3)::before {
  content: '';
  position: absolute;
  inset: 1.2px;
  background: var(--ios-fg);
  border-radius: 1px;
  width: calc(100% - 2.4px);
}
.ios__status-icons span:nth-child(3)::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 3px;
  width: 1.5px;
  height: 4px;
  background: var(--ios-fg);
  border-radius: 0 1px 1px 0;
  opacity: 0.5;
}

.ios__header {
  padding: 0.45rem 1.05rem 0.36rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ios__title {
  font-family: -apple-system, 'SF Pro Display', sans-serif;
  font-size: 1.48rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}
.ios__select {
  font-size: 0.92rem;
  color: var(--ios-fg-blue);
  font-weight: 400;
}

.ios__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.ios__more {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ios-border);
  color: transparent;
  position: relative;
  font-size: 0;
}
.ios__more::before {
  content: '';
  width: 14px;
  height: 3px;
  background-image:
    radial-gradient(circle, var(--ios-fg-blue) 1.5px, transparent 1.6px),
    radial-gradient(circle, var(--ios-fg-blue) 1.5px, transparent 1.6px),
    radial-gradient(circle, var(--ios-fg-blue) 1.5px, transparent 1.6px);
  background-size: 3px 3px;
  background-position: 0 50%, 50% 50%, 100% 50%;
  background-repeat: no-repeat;
}

.ios__seg {
  margin: 0.4rem 0.85rem 0.5rem;
  background: var(--ios-border);
  border-radius: 9px;
  padding: 2px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  font-size: 0.73rem;
  font-weight: 600;
}
.ios__seg-item {
  text-align: center;
  padding: 0.32rem 0;
  border-radius: 7px;
  color: var(--ios-fg-soft);
}
.ios__seg-item--active {
  background: var(--ios-bg);
  color: var(--ios-fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.ios__scroll {
  flex: 1;
  overflow-y: auto;
  /* No horizontal padding — let photos extend to the very edges so the
     device's overflow:hidden + border-radius clips them along the curve,
     just like real iOS Photos. */
  padding: 0.35rem 0 4.55rem;
  /* Touch-style cursor: a translucent circle to suggest finger interaction
     rather than a click target. Drag-state shrinks + darkens for tactile
     feedback. Hotspot (16,16) is the centre of the 32x32 image. */
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='12' fill='rgba(0,0,0,0.18)' stroke='rgba(0,0,0,0.45)' stroke-width='1.5'/></svg>") 16 16, grab;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.ios__scroll.is-dragging {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='9' fill='rgba(0,0,0,0.42)' stroke='rgba(0,0,0,0.7)' stroke-width='1.5'/></svg>") 16 16, grabbing;
}

/* Photo tiles inside the iOS scroll must not steal the drag (default img
   drag behaviour would interrupt and show a ghost preview). */
.ios__scroll img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

.ios__group { margin-bottom: 0.85rem; }

/* Date headers need a small horizontal inset — only the photo grid goes edge-to-edge */
.ios__date {
  font-family: -apple-system, 'SF Pro Display', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0.4rem 0 0.35rem;
  padding: 0 0.85rem;
  letter-spacing: -0.01em;
}

.ios__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
}

.ios__grid .app-photo { border-radius: 0; }

.ios__tabbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--ios-tab-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  padding: 0.55rem 0.4rem 1.55rem;
  z-index: 4;
}

[data-theme="dark"] .ios__tabbar {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.ios__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--ios-fg-soft);
  letter-spacing: -0.01em;
}

.ios__tab--active { color: var(--ios-fg-blue); }

.ios__tab-glyph {
  width: 24px;
  height: 24px;
  display: block;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Library — 4-photo grid (top-left photo accented for the active state) */
.ios__tab-glyph--library {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'><rect x='3' y='3' width='8' height='8' rx='1.5'/><rect x='13' y='3' width='8' height='8' rx='1.5'/><rect x='3' y='13' width='8' height='8' rx='1.5'/><rect x='13' y='13' width='8' height='8' rx='1.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'><rect x='3' y='3' width='8' height='8' rx='1.5'/><rect x='13' y='3' width='8' height='8' rx='1.5'/><rect x='3' y='13' width='8' height='8' rx='1.5'/><rect x='13' y='13' width='8' height='8' rx='1.5'/></svg>");
}

/* For You — heart outline */
.ios__tab-glyph--memories {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M12 20.5s-7.4-4.6-7.4-10.1A4.4 4.4 0 0112 6.6a4.4 4.4 0 017.4 3.8C19.4 15.9 12 20.5 12 20.5z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M12 20.5s-7.4-4.6-7.4-10.1A4.4 4.4 0 0112 6.6a4.4 4.4 0 017.4 3.8C19.4 15.9 12 20.5 12 20.5z'/></svg>");
}

/* Albums — stacked rectangles */
.ios__tab-glyph--albums {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'><rect x='6' y='8' width='15' height='13' rx='2'/><path d='M4.5 17V6a2 2 0 012-2H17'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'><rect x='6' y='8' width='15' height='13' rx='2'/><path d='M4.5 17V6a2 2 0 012-2H17'/></svg>");
}

/* Search — magnifying glass */
.ios__tab-glyph--search {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='10.5' cy='10.5' r='6'/><line x1='15' y1='15' x2='20' y2='20'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='10.5' cy='10.5' r='6'/><line x1='15' y1='15' x2='20' y2='20'/></svg>");
}

.ios__home {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 4px;
  border-radius: 4px;
  background: var(--ios-fg);
  opacity: 0.85;
  z-index: 5;
}

/* ============================================
   IMMICH
   ============================================ */
.im {
  --im-bg: #18181b;
  --im-side: #0f0f12;
  --im-fg: #e4e4e7;
  --im-fg-soft: #a1a1aa;
  --im-accent: #18c2b6;
  --im-accent-2: #a855f7;
  --im-border: #27272a;
  --im-search-bg: #27272a;
  --im-card: #1f1f23;
  background: var(--im-bg);
  color: var(--im-fg);
  font-family: 'Inter', -apple-system, sans-serif;
  height: 540px;
  display: flex;
}

/* Immich is dark-by-default. In light theme we still keep it dark-ish but
   slightly lighter so it doesn't fight the page. */
[data-theme="light"] .im,
:root:not([data-theme="dark"]) .im {
  --im-bg: #1e1e22;
  --im-side: #131316;
  --im-fg: #f4f4f5;
  --im-fg-soft: #a1a1aa;
  --im-border: #2a2a2e;
  --im-search-bg: #2a2a2e;
  --im-card: #232327;
}

.im__side {
  flex: 0 0 200px;
  background: var(--im-side);
  border-right: 1px solid var(--im-border);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
}

.im__brand {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.85rem 1rem;
}

/* Real Immich wordmark — sourced from the project's design/ folder
   (AGPL-3.0). Inline-dark variant (icon + wordmark) for desktop; the
   icon-only variant takes over at narrow widths where the sidebar
   collapses to icons (no room for the wordmark). */
.im__brand-logo {
  display: block;
  height: 22px;
  width: auto;
}
.im__brand-logo--icon { display: none; }

.im__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.im__nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  color: var(--im-fg-soft);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: default;
}

.im__nav-item:hover { background: var(--im-border); }

.im__nav-item--active {
  background: rgba(79, 70, 229, 0.16);
  color: var(--im-fg);
}

.im__nav-glyph {
  width: 18px;
  height: 18px;
  display: inline-block;
  position: relative;
  text-align: center;
  opacity: 0.85;
}

.im__nav-glyph::before,
.im__nav-glyph::after {
  content: '';
  position: absolute;
  box-sizing: border-box;
}

.im__nav-glyph--photos::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 4px;
}
.im__nav-glyph--photos::after {
  width: 7px;
  height: 7px;
  right: 3px;
  top: 3px;
  border-radius: 50%;
  background: currentColor;
}
.im__nav-glyph--people::before {
  width: 8px;
  height: 8px;
  left: 5px;
  top: 2px;
  border-radius: 50%;
  background: currentColor;
}
.im__nav-glyph--people::after {
  width: 16px;
  height: 8px;
  left: 1px;
  bottom: 1px;
  border-radius: 8px 8px 3px 3px;
  border: 2px solid currentColor;
}
.im__nav-glyph--places::before {
  inset: 2px 5px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 9px 2px;
  transform: rotate(-45deg);
}
.im__nav-glyph--places::after {
  width: 4px;
  height: 4px;
  left: 7px;
  top: 6px;
  border-radius: 50%;
  background: currentColor;
}
.im__nav-glyph--albums::before {
  inset: 4px 3px 3px 5px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: -4px -4px 0 -1px var(--im-side), -4px -4px 0 0 currentColor;
}
.im__nav-glyph--archive::before {
  left: 2px;
  top: 4px;
  width: 14px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.im__nav-glyph--archive::after {
  left: 4px;
  top: 2px;
  width: 10px;
  height: 4px;
  border: 2px solid currentColor;
  border-radius: 3px 3px 0 0;
}

.im__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.im__top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 1.1rem;
  border-bottom: 1px solid var(--im-border);
}

.im__heading {
  display: grid;
  gap: 0.05rem;
  min-width: 96px;
}

.im__heading strong {
  font-size: 0.95rem;
  font-weight: 650;
}

.im__heading span {
  font-size: 0.68rem;
  color: var(--im-fg-soft);
}

.im__search {
  flex: 1;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--im-search-bg);
  color: var(--im-fg-soft);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

.im__count {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--im-fg-soft);
}

.im__actions {
  display: inline-flex;
  gap: 0.38rem;
}

.im__actions span {
  width: 26px;
  height: 26px;
  border: 1px solid var(--im-border);
  border-radius: 5px;
  background:
    linear-gradient(currentColor, currentColor) center / 11px 2px no-repeat,
    var(--im-search-bg);
  color: var(--im-fg-soft);
}

.im__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1.6rem 1.5rem 1.1rem;
}

.im__group { margin-bottom: 1rem; }

.im__date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--im-fg);
  margin: 0 0 0.45rem;
  letter-spacing: -0.005em;
}

.im__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  /* Justified row: each photo's flex-basis follows its aspect.
     We approximate justification by using flex-grow on natural-width tiles. */
}

.im__grid .app-photo {
  height: 110px;
  width: calc(110px * var(--tile-aspect));
  flex: 0 0 auto;
  min-width: 90px;
  border-radius: 2px;
  /* aspect-ratio inline gives each timeline tile its natural width. */
}

.im__scrub {
  position: absolute;
  top: 60px;
  bottom: 12px;
  right: 4px;
  width: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.6rem;
  color: var(--im-fg-soft);
  font-weight: 500;
  pointer-events: none;
}

.im__scrub-tick {
  padding: 1px 4px;
  border-radius: 3px;
}
.im__scrub-tick--active {
  background: var(--im-accent);
  color: white;
}

/* ── Highlight scanned-photo group when in BEFORE state ──
   Adds a subtle "this whole pile arrived in March 2024" treatment so
   the problem reads at a glance. */
.apps-demo__viewport[data-state="before"] .gp__date,
.apps-demo__viewport[data-state="before"] .ios__date,
.apps-demo__viewport[data-state="before"] .im__date {
  position: relative;
}

/* ── Responsive ── */
@media (max-width: 760px) {
  .apps-demo__viewport { min-height: 580px; }
  .gp { height: 580px; }
  .gp__rail { display: none; }
  .gp__grid { grid-template-columns: repeat(4, 1fr); }
  .ios { height: 580px; }
  .im { height: 580px; }
  .im__side { flex-basis: 64px; }
  .im__nav-item { font-size: 0; padding: 0.5rem; justify-content: center; }
  .im__nav-glyph { font-size: 1.05rem; }
  .im__brand { padding: 0.55rem 0.4rem 0.85rem; justify-content: center; }
  /* Swap the inline wordmark for the icon-only logo: the wordmark would
     squish to ~40px wide and become unreadable in the 64px-wide
     collapsed sidebar. */
  .im__brand-logo--full { display: none; }
  .im__brand-logo--icon { display: block; height: 28px; width: 28px; }

  /* Compact the topbar: drop the "Timeline" subtitle, the action dots,
     and the asset count, and collapse the search input to its icon so
     the topbar stays one row tall. */
  .im__heading span { display: none; }
  .im__actions { display: none; }
  .im__count { display: none; }
  .im__search { flex: 0 0 auto; max-width: 36px; padding: 0.45rem; }
  .im__search span { display: none; }
  .im__top { gap: 0.6rem; padding: 0.55rem 0.7rem; }

  .im__scrub { display: none; }
  .im__scroll { padding-right: 0.85rem; }
  .im__grid .app-photo { height: 84px; width: calc(84px * var(--tile-aspect)); min-width: 72px; }
}

@media (max-width: 460px) {
  .gp__topbar { gap: 0.5rem; padding: 0.5rem 0.65rem; }
  .gp__icons, .gp__menu { display: none; }
  .gp__search { font-size: 0.78rem; padding: 0.45rem 0.75rem; }
  .gp__main { padding: 0.85rem 0.85rem 1.5rem; }
  .gp__grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }

  /* Same compaction trick as Immich at this tighter width — the
     "Search your photos" placeholder eats too much horizontal space
     once the rail and brand have collapsed. */
  .gp__search span { display: none; }
  .gp__search { flex: 0 0 auto; max-width: 36px; padding: 0.45rem; }

  .ios__device { width: 280px; }
  .apps-demo__pill { padding: 0.38rem 0.7rem; font-size: 0.72rem; }
}
