/* ---- Brand tokens ------------------------------------------------------- */
:root{
  /* Colors */
  --bg-app: #F6F7FB;
  --bg-surface: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --border: #E3E3EA;

  --pri: #4F46E5;          /* indigo 600 */
  --pri-weak: #EEF2FF;     /* indigo 50 */
  --pri-weak-2: #E0E7FF;   /* indigo 100 */

  --success: #10B981;
  --warn: #F59E0B;

  /* Shape & elevation */
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;

  --shadow-sm: 0 6px 14px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
  --shadow-md: 0 14px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.08);
  --shadow-lg: 0 24px 48px rgba(0,0,0,.18), 0 8px 20px rgba(0,0,0,.12);

  /* Type & rhythm */
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans";
  --font-head: "Spectral", ui-serif, Georgia, Cambria, "Times New Roman", serif;

  /* Family wheel sizes (adjusted by page JS responsively) */
  --node-w: 200px;
  --node-h: 120px;
  --center-w: 280px;
  --center-h: 170px;

  /* Warble amplitude (px) — app-wide dial */
  --warble-base-amp: 4px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  * { animation: none !important; transition: none !important; }
}

/* ---- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,h2,h3 { font-family: var(--font-head); margin: 0 0 8px; color: var(--text); }
p { margin: 0 0 12px; color: var(--text-muted); }
.lead { font-size: 1.125rem; color: var(--text); }

/* Layout helpers */
.container { width: min(1100px, 92vw); margin-inline: auto; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }
.grid-3 {
  display: grid; gap: 20px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
@media (max-width: 900px){ .grid-3 { grid-template-columns: 1fr; } }

/* Card */
.k-card{
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px;
}
.k-card--tight { padding: 12px; }

/* Buttons */
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{ outline: 3px solid #6ea8fe; outline-offset: 2px; }

.btn--primary{
  background: var(--pri);
  color: #fff;
  border-color: transparent;
}
.btn--primary:hover{ filter: brightness(1.03); }
.btn--ghost{
  background: var(--pri-weak);
  color: var(--pri);
  border-color: #dfe3ff;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246,247,251,.75);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid #eceef6;
}
.nav__bar{
  display:flex; align-items:center; justify-content:space-between;
  height: 62px;
}
.brand{ display:flex; align-items:center; gap:10px; font-weight:800; }
.brand__mark{
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--pri) 0%, #7C3AED 100%);
  box-shadow: var(--shadow-sm);
}
.nav a { color: var(--text); text-decoration: none; font-weight: 600; }
.nav__links { display:flex; gap: 14px; }

/* Hero */
.hero{
  padding: 64px 0 28px;
}
.hero .cta-row{ display:flex; gap:12px; flex-wrap:wrap; }

/* Feed preview */
.feed-item{
  display:flex; gap:14px; align-items:flex-start;
}
.feed-item__avatar{
  width:42px; height:42px; border-radius: 12px; background: var(--pri-weak);
  display:grid; place-items:center; color: var(--pri); font-weight:700;
}

/* Family wheel cards adopt brand tokens */
.family-stage { position: relative; width:100%; height: 70vh; min-height:520px; overflow:hidden; }
.family-card{
  position:absolute; left:50%; top:50%; transform: translate(-50%, -50%);
  display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:flex-start;
  width: var(--node-w); height: var(--node-h);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px;
  user-select:none;
}
.family-card--center{
  width: var(--center-w); height: var(--center-h);
  justify-content: center; font-weight:700;
}
.family-name{ font-weight:600; color: var(--text); }

/* Inner "Make Post" CTA inside cards */
.card-cta{
  width: calc(100% - 12px);
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--pri-weak);
  color: var(--pri);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.card-cta:hover{ background: var(--pri-weak-2); }

/* Warble animation hooks (cards add inline CSS vars via JS) */
@keyframes warble {
  0%   { transform: translate(-50%, -50%) translate(var(--wx,0px), var(--wy,0px)); }
  50%  { transform: translate(-50%, -50%) translate(var(--wxN,0px), var(--wyN,0px)); }
  100% { transform: translate(-50%, -50%) translate(var(--wx,0px), var(--wy,0px)); }
}
