/* ============================================================
 * Family Kingdom — Base theme / element styling
 *
 * Plain CSS, no preprocessor. Reads from tokens.css.
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top, var(--color-primary-soft), transparent 60%),
    radial-gradient(ellipse at bottom, var(--color-secondary), transparent 60%);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  margin: 0 0 var(--space-3);
  line-height: var(--lh-tight);
  letter-spacing: 0.5px;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--motion-fast) var(--motion-easing);
}
a:hover { color: var(--color-primary); }

img { max-width: 100%; height: auto; }

input, select, textarea, button { font: inherit; color: inherit; }

/* --- Layout --- */
.fk-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fk-main {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

.fk-main--wide { max-width: var(--container-wide); }
.fk-main--narrow { max-width: var(--container-narrow); }

/* --- Header --- */
.fk-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
}
.fk-header__inner {
  width: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.fk-brand {
  font-family: var(--font-heading);
  color: var(--color-primary);
  font-size: var(--fs-md);
  letter-spacing: 1px;
}
.fk-brand__crown { color: var(--color-primary); margin-right: 6px; }
.fk-nav { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.fk-nav a {
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}
.fk-nav a:hover, .fk-nav a[aria-current="page"] {
  background: var(--color-surface);
  color: var(--color-text);
}
.fk-header__spacer { flex: 1; }
.fk-user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--fs-sm);
}

/* --- Footer --- */
.fk-footer {
  padding: var(--space-5) var(--space-4);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-faint);
  font-size: var(--fs-xs);
  text-align: center;
}

/* --- Containers / sections --- */
.fk-section {
  margin-bottom: var(--space-6);
}
.fk-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

/* --- Grid --- */
.fk-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.fk-grid--scores {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* --- Page heading block --- */
.fk-page-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.fk-page-heading h1 { margin: 0; }
.fk-page-heading .fk-page-subtitle { color: var(--color-text-muted); font-size: var(--fs-lg); }

/* --- Two-column dashboard --- */
.fk-dashboard {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 800px) {
  .fk-dashboard { grid-template-columns: 1.4fr 1fr; }
}
