/* Tokens mirror the app's Tokens.swift / Font+Folio.swift (Figma library). */
:root {
  --ink: #010f1b;
  --muted: #676d73;
  --subtle: #a4a9ae;
  --gray: #dbe0e3;
  --white: #ffffff;

  --xs: 4px;
  --sm: 8px;
  --md: 12px;
  --lg: 16px;
  --xl: 24px;
  --xxl: 32px;
  --screen-margin: 34px;

  --radius-item: 16px;
  --radius-filter: 8px;
  --item-shadow: 0 4px 9.6px rgba(0, 0, 0, 0.16);
  --object-inset: 13%;
  /* CTA height (19 + 25.5 + 19 + border) plus its xl offset and an xl gap. */
  --cta-clearance: 112px;

  color-scheme: light;
}

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

body {
  background: var(--white);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Type styles (size / line height from Figma). */
.display { font-size: 20px; line-height: 1.2; font-weight: 400; }
.body { font-size: 14px; line-height: 1.5; font-weight: 400; }
.caption { font-size: 12px; line-height: 1.6; font-weight: 400; }
.subtle { color: var(--subtle); }

/* Content column at the screen margin, xl below the top (matches the app). */
.main {
  max-width: 430px;
  margin: 0 auto;
  /* Bottom padding leaves room to scroll the last row clear of the CTA. */
  padding: calc(env(safe-area-inset-top) + var(--xl)) var(--screen-margin)
    calc(env(safe-area-inset-bottom) + var(--cta-clearance));
  display: flex;
  flex-direction: column;
  gap: var(--xl);
}

.overview { display: flex; flex-direction: column; gap: var(--sm); }
.counts { display: flex; align-items: center; gap: var(--sm); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--subtle); }

/* Collections bar: pills with no gap, the selected one outlined. */
.chips {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--screen-margin));
  padding: 0 var(--screen-margin);
}
.chips::-webkit-scrollbar { display: none; }
.chips { position: relative; }
.chip {
  position: relative;
  flex: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  color: var(--subtle);
  background: transparent;
  border: 0;
  border-radius: var(--radius-filter);
  padding: var(--xs) var(--md);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
/* Text flips to ink (medium) the instant it's tapped, like the app. */
.chip[aria-pressed="true"] { color: var(--ink); font-weight: 500; }
/* One outline for all chips, slid to the selected one by app.js — the app's
   matchedGeometryEffect outline. */
.chip-outline {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius-filter);
  pointer-events: none;
}

/* Collection info bar: "name • count | date", Caption ink, sm gaps. The
   wrapper's negative margin cancels the column gap while it's collapsed;
   app.js animates its height between 0 and the row plus an xl gap. */
.bar-wrap {
  margin-top: calc(-1 * var(--xl));
  height: 0;
  overflow: hidden;
}
.bar {
  margin-top: var(--xl);
  display: flex;
  align-items: center;
  gap: var(--sm);
  height: 20px;
  color: var(--ink);
  /* Text dissolves at the row's edges as it slides through them. */
  -webkit-mask-image: linear-gradient(transparent, #000 4px, #000 calc(100% - 4px), transparent);
  mask-image: linear-gradient(transparent, #000 4px, #000 calc(100% - 4px), transparent);
}
.bar-slot { display: grid; height: 20px; overflow: hidden; }
.bar-slot:last-child { flex: 1; }
.bar-text { grid-area: 1 / 1; line-height: 20px; white-space: nowrap; }
.dot.ink { background: var(--ink); }
.bar-divider { width: 1px; height: 16px; background: var(--gray); }
[data-bar-date-part][hidden] { display: none; }

/* Object grid: two columns, lg between columns, xl between rows. */
.grid {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--lg);
  row-gap: var(--xl);
}
.card { display: flex; flex-direction: column; gap: var(--sm); min-width: 0; }
/* Hidden cards (filtered out by a collection chip) leave the grid entirely. */
.card[hidden] { display: none; }
/* A filtered-out card fading where it stood (see app.js). */
.card-ghost { position: absolute; pointer-events: none; }
/* The square takes its size from the column alone; the photo is placed
   inside it, so a large cutout can't stretch the card (Safari sizes an
   aspect-ratio box from its content otherwise). */
.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  background: var(--white);
  border-radius: var(--radius-item);
  box-shadow: var(--item-shadow);
}
.card-image img {
  position: absolute;
  inset: var(--object-inset);
  width: calc(100% - 2 * var(--object-inset));
  height: calc(100% - 2 * var(--object-inset));
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.card-image img.loaded { opacity: 1; }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.card-name, .card-collections {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-collections { color: var(--subtle); }

.footer {
  display: flex;
  justify-content: space-between;
  padding-top: var(--lg);
  color: var(--muted);
}
.footer a { color: var(--muted); }

.status { color: var(--muted); font-size: 14px; line-height: 1.5; padding-top: var(--xxl); }

/* Onboarding's "Capture your first item" button (OnboardingView
   ShowcaseHomeView): 17pt medium, 30/19 padding, 1pt black border on a light
   glass capsule — pinned above the bottom edge. */
.cta {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--xl));
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
  color: #1c1c1a;
  text-decoration: none;
  padding: 19px 30px;
  border: 1px solid #000;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.cta:active { transform: translateX(-50%) scale(0.97); }
