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

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-app);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 90px; /* leave room for floating navbar */
  min-height: 100vh;
  background:
    radial-gradient(720px circle at 12% 0%, rgba(57, 211, 83, 0.08), transparent 55%),
    radial-gradient(640px circle at 88% 18%, rgba(250, 122, 24, 0.07), transparent 55%),
    radial-gradient(800px circle at 50% 95%, rgba(163, 113, 247, 0.07), transparent 60%),
    var(--color-bg);
  background-attachment: fixed;
}

h1, h2, h3 {
  margin: 0 0 var(--space-2) 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

p { margin: 0; }

button {
  font-family: var(--font-app);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: var(--font-app);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-5);
  animation: page-fade-in 0.4s ease-out;
}

@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.app-header h1 {
  font-size: 1.5rem;
  margin: 0;
  background: linear-gradient(90deg, #1C9FD4, #0d6a94);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.header-logout:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.header-logout [data-lucide] {
  width: 14px;
  height: 14px;
}

.today-chip {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--shadow-card-inset);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.section-eyebrow {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.muted { color: var(--color-text-muted); font-size: 0.875rem; }

[data-lucide] { width: 20px; height: 20px; }

/* Lightweight entrance animation — opacity + transform only (compositor-
   friendly, no layout cost), staggered per section. */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card,
.summary-card,
.graph-month-block {
  animation: fade-in-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.summary-card-row > *:nth-child(1) { animation-delay: 0s; }
.summary-card-row > *:nth-child(2) { animation-delay: 0.08s; }
.summary-card-row > *:nth-child(3) { animation-delay: 0.16s; }

/* Each #graphs-root child is a plain wrapper div (set via
   document.createElement in app.js); the animated `.card` lives one level
   deeper inside it, so the stagger targets that descendant directly. */
#graphs-root > *:nth-child(1) .card { animation-delay: 0.1s; }
#graphs-root > *:nth-child(2) .card { animation-delay: 0.22s; }
#graphs-root > *:nth-child(3) .card { animation-delay: 0.34s; }

#stats-root > *:nth-child(1) { animation-delay: 0.1s; }
#stats-root > *:nth-child(2) { animation-delay: 0.22s; }
#stats-root > *:nth-child(3) { animation-delay: 0.34s; }

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-3);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  opacity: 0.5;
}

.footer-heart { color: var(--sholat-4); }
.footer-dot { opacity: 0.4; }

@keyframes view-exit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-exit {
  animation: view-exit 0.16s ease-in forwards;
  pointer-events: none;
}

.view-enter {
  animation: view-enter 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .page, .card, .summary-card, .graph-month-block, .modal-sheet, #navbar-root,
  .view-exit, .view-enter {
    animation: none !important;
  }
}
