/* The app preview in the hero: Huddle's Home on a computer (the app's wide layout:
   Sidebar + TodayView) with a phone (the narrow layout: tab bar) in front of it,
   showing the same family and day. Drawn in the Huddle design system, the same
   tokens as styles.css. The markup is generated by scripts/build_preview.py.
   The stage is drawn at a fixed size and scaled to fit (site.js sets --s); on
   narrow screens only the phone is shown (data-compact). */

.app-preview {
  --a-bg: var(--bg);
  --a-surface: var(--card);
  --a-track: var(--chip);
  --a-text: var(--ink);
  --a-muted: var(--muted);
  --a-secondary: var(--muted);
  --a-faint: var(--faint);
  --a-primary: var(--coral);
  --a-primary-text: var(--coral-dark);
  --a-star: var(--gold);
  --a-star-badge: var(--gold-tint);
  --a-star-text: var(--gold-ink);
  --a-hair: var(--line);
  --a-hair-2: var(--border);
  --a-shadow: var(--shadow-card);
  --a-display: var(--font-display);
  --a-body: var(--font-body);

  --w: 1120px;
  --h: 880px;
  --s: 1;

  margin-top: 56px;
  width: 100%;
  height: calc(var(--h) * var(--s));
  text-align: left;
}
.app-preview[data-compact] { --w: 300px; --h: 626px; margin-top: 44px; }

.ap-stage {
  position: relative;
  left: 50%;
  width: var(--w);
  height: var(--h);
  transform: translateX(-50%) scale(var(--s));
  transform-origin: top center;
  font-family: var(--a-body);
  color: var(--a-text);
  user-select: none;
}

.ap {
  width: 1120px;
  height: 820px;
  display: flex;
  background: var(--a-bg);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-float);
}
.app-preview[data-compact] .ap { display: none; }

.ap-stage svg.i { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ap-stage svg.i-star { fill: var(--a-star); stroke: none; }
.ap-stage svg.i-fill { fill: currentColor; stroke: none; }

/* Avatar: solid member color, white initial */
.ap-av {
  --size: 34px;
  width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0;
  background: var(--c); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--a-display); font-weight: 600; font-size: calc(var(--size) * 0.4); line-height: 1;
}

.ap-badge {
  display: inline-flex; align-items: center; gap: 3px; align-self: flex-start;
  background: var(--a-star-badge); border-radius: 100px; padding: 1px 6px;
  font-size: 10.5px; font-weight: 700; color: var(--a-star-text);
}
.ap-badge svg { width: 9px; height: 9px; }

/* ---------- Sidebar ---------- */
.ap-side {
  width: 230px; flex-shrink: 0; background: var(--a-surface);
  border-right: 1px solid var(--a-hair);
  padding: 28px 20px 20px; display: flex; flex-direction: column;
}
.ap-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; font-family: var(--a-display); font-size: 20px; font-weight: 600; }
.ap-logo .mark { width: 30px; height: 30px; border-radius: 10px; }
.ap-nav { display: flex; flex-direction: column; gap: 2px; }
.ap-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--a-muted);
}
.ap-link.is-active { color: var(--a-primary-text); font-weight: 700; }
.ap-rule { height: 1px; background: var(--a-hair-2); margin: 16px 10px 12px; }
.ap-label { margin: 0 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.66px; color: var(--a-faint); }
.ap-viewing {
  flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 4px;
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}
.ap-viewing .ap-link { padding: 7px 10px; }
.ap-viewing .ap-link.is-selected { background: var(--a-track); }
.ap-family {
  width: 34px; height: 34px; border-radius: 11px; background: var(--a-text); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ap-family svg.i { width: 17px; height: 17px; }
.ap-family-name { font-family: var(--a-display); font-size: 15px; font-weight: 600; color: var(--a-text); }
.ap-member { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; color: var(--a-text); }

.ap-weather { border-top: 1px solid var(--a-hair-2); margin-top: 12px; padding: 12px 10px 0; }
.ap-weather .ap-label { margin: 0; letter-spacing: 0.44px; }
.ap-place { font-size: 12.5px; font-weight: 600; color: var(--a-muted); margin-top: 2px; }
.ap-temp { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.ap-temp span:first-child { font-size: 20px; }
.ap-temp strong { font-family: var(--a-display); font-size: 20px; font-weight: 600; }
.ap-temp em { font-style: normal; font-size: 13.5px; font-weight: 600; color: var(--a-muted); }
.ap-hilo { font-size: 12px; color: var(--a-muted); }

/* ---------- Main column ---------- */
.ap-main { position: relative; flex-grow: 1; min-width: 0; padding: 40px 48px 0; display: flex; flex-direction: column; gap: 20px; overflow: hidden; }

.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ap-greet { font-family: var(--a-display); font-size: 26px; line-height: 34px; font-weight: 600; }
.ap-date { font-size: 14px; font-weight: 500; color: var(--a-muted); margin-top: 2px; }
.ap-head-right { display: flex; align-items: center; gap: 10px; }
.ap-bell {
  position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--a-surface);
  border: 1px solid var(--a-hair-2); display: flex; align-items: center; justify-content: center; color: var(--a-text);
}
.ap-bell b {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--a-primary); border: 2px solid var(--a-bg); color: #FFFFFF;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-sizing: content-box;
}

.ap-card { background: var(--a-surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--a-shadow); }

.ap-kids { padding: 16px 20px; display: flex; justify-content: space-between; gap: 14px; }
.ap-kid { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ap-kid .ap-ring { padding: 3px; border-radius: 30px; border: 2px solid transparent; }
.ap-kid-name { font-size: 11.5px; font-weight: 600; max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-kid .ap-badge { align-self: center; }

.ap-tiles { display: flex; gap: 12px; }
.ap-tile {
  position: relative; flex: 1; min-height: 110px; border-radius: 20px; padding: 16px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; box-shadow: var(--a-shadow);
}
.ap-tile strong { font-family: var(--a-display); font-size: 32px; line-height: 36px; font-weight: 600; }
.ap-tile span { font-size: 12px; line-height: 16px; font-weight: 600; margin-top: 2px; }
.ap-tile svg.ap-art { position: absolute; right: -16px; bottom: -16px; opacity: 0.22; width: 104px; height: 104px; }
.ap-tile .ap-art-emoji { position: absolute; right: -12px; bottom: -22px; opacity: 0.22; font-size: 92px; line-height: 1; }
.ap-tile--stars { background: var(--a-star-badge); color: var(--a-star-text); }
.ap-tile--count { background: var(--coral-tint); color: var(--coral-dark); }

.ap-stats { display: flex; gap: 12px; }
.ap-stat { flex: 1 1 96px; background: var(--a-surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; box-shadow: var(--a-shadow); }
.ap-stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--a-muted); }
.ap-stat-label svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.ap-stat-value { font-family: var(--a-display); font-size: 19px; line-height: 26px; font-weight: 600; }
.ap-stat-value { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

.ap-sched-head { display: flex; align-items: center; justify-content: space-between; }
.ap-sched-head h4 { margin: 0; font-family: var(--a-display); font-size: 18px; font-weight: 600; }
.ap-count { background: var(--a-track); border-radius: 100px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--a-muted); }

.ap-day {
  flex: 1 1 0; min-height: 0; padding: 18px 14px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
  mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
.ap-grid { position: relative; height: 600px; margin-left: 58px; }
.ap-hour { position: absolute; left: 0; right: 0; height: 1px; background: var(--a-hair); }
.ap-hour span { position: absolute; right: calc(100% + 10px); top: -8px; font-size: 11.5px; font-weight: 600; color: var(--a-muted); white-space: nowrap; }
.ap-ev {
  position: absolute; left: 2px; right: 2px; padding: 4px 8px; border-radius: 10px; overflow: hidden;
  border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 16%, #FFFFFF);
}
.ap-ev-title { font-size: 13px; line-height: 17px; font-weight: 700; }
.ap-ev-time, .ap-ev-place { font-size: 11.5px; font-weight: 500; color: var(--a-secondary); }
.ap-ev-place { color: var(--a-muted); }
.ap-ev-who { position: absolute; top: 5px; right: 6px; display: flex; }
.ap-flag { font-size: 11px; }
.ap-alert {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 9px 2px 6px; border-radius: 100px;
  background: #FFFFFF; border: 1px solid rgba(255, 182, 41, 0.55); color: var(--gold-ink); font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ap-emoji { font-size: 13px; line-height: 1; }
.ap-ev-who .ap-av { --size: 18px; box-shadow: 0 0 0 1.5px #FFFFFF; }
.ap-ev-who .ap-av + .ap-av { margin-left: -5px; }
.ap-now { position: absolute; left: -4px; right: 0; height: 2px; background: var(--a-primary); }
.ap-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--a-primary); }

.ap-fab {
  position: absolute; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--a-primary); color: var(--a-text); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(255, 107, 74, 0.35);
}
.ap-fab svg.i { width: 22px; height: 22px; stroke-width: 2.6; }

/* ---------- Phone ---------- */
.ph {
  position: absolute; right: 16px; bottom: 0;
  width: 300px; height: 626px; padding: 11px; border-radius: 50px;
  background: #2A2420;
  box-shadow: 0 30px 70px rgba(42, 32, 20, 0.28), inset 0 0 0 2px #4A403A;
}
.app-preview[data-compact] .ph { right: 0; }
.ph-screen { position: relative; width: 278px; height: 604px; border-radius: 40px; overflow: hidden; background: var(--a-bg); }
/* A 375px-wide phone viewport, scaled into the 278px screen. */
.ph-ui { position: absolute; top: 0; left: 0; width: 375px; height: 815px; transform: scale(0.74133); transform-origin: top left; }
.ph-status {
  height: 54px; padding: 0 30px 0 36px; display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 700;
}
.ph-island { width: 112px; height: 32px; border-radius: 20px; background: #000; }
.ph-icons { display: flex; align-items: flex-end; gap: 2px; }
.ph-icons i { width: 4px; border-radius: 1px; background: var(--a-text); }
.ph-icons i:nth-child(1) { height: 6px; }
.ph-icons i:nth-child(2) { height: 9px; }
.ph-icons i:nth-child(3) { height: 12px; margin-right: 6px; }
.ph-icons b { width: 25px; height: 12px; border: 1.5px solid var(--a-text); border-radius: 4px; box-shadow: inset 0 0 0 2px var(--a-bg), inset 18px 0 0 var(--a-text); }
.ph-scroll { height: 761px; padding: 6px 22px 0; display: flex; flex-direction: column; gap: 18px; overflow: hidden; }
.ph .ap-kids { justify-content: flex-start; overflow: hidden; }
.ph .ap-stats { flex-wrap: wrap; }
.ph .ap-day { flex: 1 1 0; }
.ph-tabs {
  position: absolute; left: 0; right: 0; bottom: 0; height: 88px; padding-bottom: 30px;
  display: flex; background: var(--a-surface); border-top: 1px solid var(--a-hair-2);
}
.ph-tabs::after { content: ''; position: absolute; left: 50%; bottom: 9px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--a-text); }
.ph-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--a-muted); }
.ph-tab.is-active { color: var(--a-primary-text); }
.ap-stage .ph-tab svg.i { width: 21px; height: 21px; }
