/* ==========================================================================
   AnySync v2 — Home (src/client/orbit-v2-home.ts). Semantic tokens only.
   ========================================================================== */

.v2-home { display: flex; flex-direction: column; gap: 22px; padding-top: 2px; }

/*
 * Section panels (desktop + tablet): every Home section sits in one glass
 * panel with its header inside, as in all three desktop mockups. Phones keep
 * the open layout of the phone mockups.
 */
@media (min-width: 600px) {
  .v2-home { gap: 18px; }
  .v2-home .v2-section {
    gap: 12px;
    padding: 14px 16px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
    backdrop-filter: blur(var(--blur)) saturate(140%);
    box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow), var(--card-glow, 0 0 0 transparent);
  }
  .v2-home .v2-section-head { padding: 0 2px; }
}

/*
 * Quick-start surfaces per theme (layout identical in all three):
 *   Dark      a saturated tone card with white type and a frosted glyph tile
 *   Universe  tone-tinted glass with a vivid tile
 *   Light     white glass, barely tinted, with a vivid tile
 */
:root {
  --qs-top: 9%; --qs-bottom: 2%; --qs-ink: var(--foreground); --qs-sub: var(--muted);
  --qs-border: 30%; --qs-tile: none;
}
:root[data-theme="dark"] {
  --qs-top: 66%; --qs-bottom: 30%; --qs-ink: #ffffff; --qs-sub: rgba(255, 255, 255, .84);
  --qs-border: 62%; --qs-tile: rgba(255, 255, 255, .16);
}
:root[data-theme="universe"] { --qs-top: 34%; --qs-bottom: 8%; --qs-border: 58%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="universe"]) { --qs-top: 34%; --qs-bottom: 8%; --qs-border: 58%; }
}

/* ------------------------------------------------------------ Right now -- */

.v2-home-rightnow-card.v2-card {
  /* The section panel (desktop) or the hero itself (phone) is the frame. */
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.v2-home-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: calc(var(--radius) - 6px);
}
.v2-home-carousel::-webkit-scrollbar { display: none; }
.v2-home-carousel:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-home-hero {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 252px;
  padding: 20px 24px 18px;
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  color: var(--media-ink);
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 12px 32px -18px rgba(0, 0, 0, .55);
}
.v2-home-hero::after {
  /* A glass rim over the art, so the picture reads as a lit card, not a hole. */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .1);
  pointer-events: none;
}
.v2-home-hero-art { position: absolute; inset: 0; z-index: -2; }
.v2-home-hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Theme-independent, like the art beneath it: just enough to seat the type. */
  background:
    linear-gradient(90deg, rgba(8, 10, 32, .66), rgba(8, 10, 32, .28) 40%, rgba(8, 10, 32, 0) 68%),
    linear-gradient(0deg, rgba(6, 6, 20, .55), rgba(6, 6, 20, 0) 52%);
}
.v2-home-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.v2-home-hero-titles { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.v2-home-hero-title {
  margin: 4px 0 0;
  font-size: clamp(1.625rem, 1.1rem + 1.3vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -.03em;
  line-height: 1.08;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .4);
}
.v2-home-hero-sub { margin: 0; color: var(--media-muted); font-size: 1.0625rem; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.v2-home-hero-bottom { display: flex; flex-direction: column; gap: 14px; }
.v2-home-hero .v2-progress { max-width: 420px; background: rgba(255, 255, 255, .25); }
.v2-home-hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.v2-home-hero-stats { display: flex; flex-wrap: wrap; gap: 14px 30px; }
.v2-home-hero-stat { display: flex; align-items: center; gap: 10px; }
.v2-home-hero-stat > svg { flex: none; color: var(--media-ink); opacity: .95; }
.v2-home-hero-stat-value { font-size: 1.1875rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v2-home-hero-stat-label { font-size: .8125rem; color: var(--media-muted); white-space: nowrap; }
.v2-home-hero-cta { min-width: 168px; }
.v2-home-hero .v2-avatar-stack > * { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.v2-home-hero .v2-tag { background: var(--media-ink); color: var(--avatar-base); border-color: transparent; }

.v2-home-dots { display: none; justify-content: center; gap: 6px; padding: 8px 0 2px; }
.v2-home-dot { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--foreground) 35%, transparent); }
.v2-home-dot.is-active { background: var(--primary); width: 16px; border-radius: 999px; }

/* Desktop shows the live card only; phones swipe through Right now. */
@media (min-width: 600px) {
  .v2-home-hero:not(:first-child) { display: none; }
  .v2-home-carousel { overflow: hidden; }
}
@media (max-width: 599px) {
  .v2-home { gap: 18px; }
  .v2-home-carousel { border-radius: 22px; }
  .v2-home-hero { min-height: 214px; padding: 16px 14px 14px; gap: 12px; border-radius: 22px; }
  .v2-home-hero-title { font-size: 1.5rem; }
  .v2-home-hero-sub { font-size: .9375rem; }
  .v2-home-hero-stats { flex-wrap: nowrap; gap: 12px; }
  .v2-home-hero-stat { gap: 6px; }
  .v2-home-hero-stat > svg { width: 20px; height: 20px; }
  .v2-home-hero-stat-value { font-size: .9375rem; }
  .v2-home-hero-stat-label { font-size: .75rem; }
  .v2-home-hero-row { flex-wrap: nowrap; align-items: center; }
  .v2-home-hero-row { gap: 10px; }
  .v2-home-hero-stats { gap: 10px; }
  .v2-home-hero-stat > svg { width: 18px; height: 18px; }
  .v2-home-hero .v2-home-hero-cta { flex: none; min-width: 0; min-height: 44px; padding: 0 14px; gap: 4px; font-size: .8125rem; margin-left: auto; }
  .v2-home-hero .v2-home-hero-cta svg { width: 16px; height: 16px; }
  .v2-home-dots { display: flex; }
  .v2-home .is-wide-only { display: none; }
}

/* ---------------------------------------------------------- Quick start -- */

.v2-home-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.v2-home-quick-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--tile-a) var(--qs-border), var(--glass-border));
  border-radius: var(--radius);
  background:
    radial-gradient(90% 70% at 0% 0%, color-mix(in srgb, var(--tile-a) calc(var(--qs-bottom) * 2), transparent), transparent 70%),
    linear-gradient(150deg, color-mix(in srgb, var(--tile-b) var(--qs-top), transparent), color-mix(in srgb, var(--tile-b) var(--qs-bottom), transparent)),
    var(--surface-glass);
  color: var(--qs-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow), 0 0 calc(22px * var(--glow-scale, 1)) color-mix(in srgb, var(--tile-a) 14%, transparent);
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.v2-home-quick-tile:hover { border-color: var(--tile-a); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow), 0 0 calc(26px * var(--glow-scale, 1)) color-mix(in srgb, var(--tile-a) 40%, transparent); }
.v2-home-quick-tile .v2-icon-tile { background-color: transparent; }
:root[data-theme="dark"] .v2-home-quick-tile .v2-icon-tile {
  background: var(--qs-tile);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.v2-home-quick-tile:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-home-quick-tile:active { transform: scale(.98); }
.v2-home-quick-text { display: flex; flex-direction: column; gap: 4px; padding-right: 22px; }
.v2-home-quick-label { font-size: 1.1875rem; font-weight: 600; letter-spacing: -.018em; }
.v2-home-quick-sub { font-size: .875rem; color: var(--qs-sub); }
.v2-home-quick-chev { position: absolute; right: 14px; bottom: 22px; color: var(--qs-sub); }
@media (max-width: 899px) and (min-width: 600px) {
  .v2-home-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
  .v2-home-quick { gap: 8px; }
  .v2-home-quick-tile { min-height: 96px; padding: 12px 6px; align-items: center; justify-content: center; gap: 8px; text-align: center; border-radius: 20px; }
  .v2-home-quick-tile .v2-icon-tile { width: 44px; height: 44px; border-radius: 14px; }
  .v2-home-quick-text { padding: 0; }
  .v2-home-quick-label { font-size: .75rem; font-weight: 600; letter-spacing: -.012em; white-space: nowrap; }
  .v2-home-quick-sub, .v2-home-quick-chev { display: none; }
}

.v2-home-customize { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.v2-home-customize-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--surface-glass);
  color: var(--foreground);
  font: inherit;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.v2-home-customize-item > span:not(.v2-icon-tile) { flex: 1; }
.v2-home-customize-item.is-on { border-color: var(--primary); background: var(--primary-soft); }
.v2-home-customize-item > svg { color: var(--primary); }
.v2-home-customize-item:focus-visible { outline: none; box-shadow: var(--ring); }

/* ------------------------------------- nearby + apps (two columns) ------ */

.v2-home-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 1099px) {
  .v2-home-split { grid-template-columns: minmax(0, 1fr); }
}

.v2-home-event {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.v2-home-event:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--glass-border)); }
.v2-home-event-hit { position: absolute; inset: 0; z-index: 1; border: 0; background: none; cursor: pointer; border-radius: inherit; }
.v2-home-event-hit:focus-visible { outline: none; box-shadow: inset var(--ring); }
.v2-home-event-media { position: relative; }
.v2-home-event-media .v2-art { aspect-ratio: 16 / 9; }
.v2-home-event-fav { position: absolute; top: 8px; right: 8px; z-index: 2; }
.v2-home-event-fav[aria-pressed="true"] { color: var(--live); background: var(--surface-glass-strong); }
.v2-home-event-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.v2-home-event-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin: 0 0 2px; font-size: .9375rem; font-weight: 600; letter-spacing: -.012em; line-height: 1.3; }
.v2-home-event-name { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.v2-home-event-chev { margin-top: 1px; }
.v2-home-event .v2-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-home-event-chev { color: var(--muted); flex: none; }
.v2-home-event-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 2px; }

.v2-home-apps-section .v2-card { padding: 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.v2-home-apps { display: flex; flex-direction: column; gap: 8px; }
.v2-home-app {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--foreground) 3.5%, transparent);
  transition: border-color .15s, background-color .15s;
}
.v2-home-app:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--glass-border)); background: color-mix(in srgb, var(--foreground) 6%, transparent); }
.v2-home-app .v2-icon-tile.size-lg { width: 52px; height: 52px; border-radius: 16px; }
.v2-home-app-hit { position: absolute; inset: 0; border: 0; background: none; border-radius: inherit; cursor: pointer; }
.v2-home-app-hit:focus-visible { outline: none; box-shadow: var(--ring); }
.v2-home-app > :not(.v2-home-app-hit) { position: relative; }
.v2-home-app-text { flex: 1; min-width: 0; pointer-events: none; }
.v2-home-app-name { font-weight: 600; font-size: 1rem; letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-home-app-sub { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .8125rem; margin-top: 2px; white-space: nowrap; }
.v2-home-app-sub svg { color: var(--green); }
.v2-home-app-people { pointer-events: none; }

@media (max-width: 599px) {
  .v2-home-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .v2-home-apps > :nth-child(n + 4) { display: none; }
  .v2-home-app {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 0;
    padding: 12px 4px;
    text-align: center;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: var(--surface-glass);
  }
  .v2-home-app .v2-icon-tile.size-lg { width: 48px; height: 48px; border-radius: 15px; }
  .v2-home-app-text { width: 100%; }
  .v2-home-app-name { font-size: .78125rem; letter-spacing: -.015em; }
  .v2-home-app-sub { justify-content: center; gap: 3px; font-size: .6875rem; }
  .v2-home-app-sub svg { width: 12px; height: 12px; flex: none; }
  .v2-home-app-sub > span { overflow: hidden; text-overflow: ellipsis; }

  /* Two event cards side by side, as in the phone mockup. */
  .v2-home-nearby .v2-rail > * { flex-basis: calc((100% - 10px) / 2); }
  .v2-home-event { border-radius: 18px; }
  .v2-home-event-media .v2-art { aspect-ratio: 16 / 8.5; }
  .v2-home-event-fav { top: 6px; right: 6px; }
  .v2-home-event-body { gap: 5px; padding: 10px 10px 12px; }
  .v2-home-event-title { font-size: .8125rem; letter-spacing: -.01em; }
  .v2-home-event .v2-meta { font-size: .75rem; gap: 5px; }
  .v2-home-event .v2-meta svg { width: 13px; height: 13px; }
  .v2-home-event-foot { flex-wrap: nowrap; }
  .v2-home-event-foot .v2-tag { min-height: 22px; padding: 1px 8px; font-size: .6875rem; }
  .v2-home-app-join { display: none; }
}
