/* Family Command Centers — elderly-first shared styles.
 *
 * Design principles, per Paul V4's plan:
 *   - 28px body type minimum.
 *   - High contrast. Warm dark palette. Soft glow, not neon.
 *   - One primary action per screen. Large tap targets.
 *   - Icons always paired with text labels. Never icon-alone.
 *   - Animations slow and subtle. No surprise motion.
 */

:root {
  --bg: #1a1814;
  --bg-raised: #23201a;
  --surface: #2a2620;
  --surface-soft: #332d25;
  --text: #f5ede0;
  --text-muted: #c4b8a5;
  --text-faint: #8a8173;
  --accent: #e8b87a;
  --accent-glow: rgba(232, 184, 122, 0.22);
  --accent-strong: #f2c98e;
  --ok: #8fb87a;
  --warn: #d67555;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(232, 184, 122, 0.08);
  --shadow-glow: 0 0 0 1px rgba(232, 184, 122, 0.35), 0 0 40px var(--accent-glow);
  --font-body: "Charter", "Georgia", "Iowan Old Style", "Palatino Linotype", ui-serif, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(232, 184, 122, 0.06), transparent 60%),
    radial-gradient(1000px 500px at 80% 90%, rgba(232, 184, 122, 0.04), transparent 60%),
    var(--bg);
}

h1, h2, h3 {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 { font-size: 2.4em; line-height: 1.15; }
h2 { font-size: 1.7em; line-height: 1.2; }
h3 { font-size: 1.25em; line-height: 1.3; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid rgba(232, 184, 122, 0.3);
  transition: border-color 0.25s ease;
}
a:hover, a:focus { border-bottom-color: var(--accent); }

button, .btn {
  font-family: var(--font-ui);
  font-size: 1em;
  font-weight: 500;
  padding: 0.9em 1.5em;
  border-radius: 14px;
  border: 1px solid rgba(232, 184, 122, 0.2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
  min-height: 64px;
  min-width: 64px;
}
button:hover, .btn:hover {
  background: var(--surface-soft);
  box-shadow: var(--shadow-glow);
}
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary {
  background: linear-gradient(180deg, #e8b87a 0%, #c89855 100%);
  color: #2a1f10;
  border: none;
  font-weight: 600;
}
button.primary:hover, .btn.primary:hover {
  box-shadow: 0 0 0 1px var(--accent-strong), 0 0 45px var(--accent-glow);
}
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--text-muted);
}
button:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

input[type="text"], textarea {
  font-family: var(--font-body);
  font-size: 1em;
  padding: 0.9em 1.2em;
  border-radius: 14px;
  border: 1px solid rgba(232, 184, 122, 0.2);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  line-height: 1.45;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid rgba(232, 184, 122, 0.08);
  background: rgba(26, 24, 20, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title {
  font-size: 1em;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.topbar-nav {
  display: flex;
  gap: 0.75rem;
}
.topbar-nav a {
  padding: 0.55em 1.1em;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: 0.8em;
  border: 1px solid rgba(232, 184, 122, 0.18);
  color: var(--text);
  text-decoration: none;
}
.topbar-nav a.active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- PICKER LANDING ---------- */

.picker {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.picker-header {
  max-width: 900px;
  margin-bottom: 3rem;
}
.picker-header .eyebrow {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 0.55em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.picker-header h1 {
  font-size: 2.8em;
  margin-bottom: 0.75rem;
}
.picker-header p {
  color: var(--text-muted);
  font-size: 1.1em;
  margin: 0;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2.5rem;
  width: 100%;
  max-width: 900px;
}
.picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border: 1px solid rgba(232, 184, 122, 0.12);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.4s ease, border-color 0.3s ease;
}
.picker-card:hover, .picker-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--accent);
}
.picker-photo {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--bg-raised);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4em;
  color: var(--accent);
  border: 3px solid rgba(232, 184, 122, 0.25);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.picker-photo img { width: 100%; height: 100%; object-fit: cover; }
.picker-name {
  font-family: var(--font-body);
  font-size: 1.8em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.picker-rel {
  color: var(--text-muted);
  font-size: 0.85em;
  font-family: var(--font-ui);
}
.picker-footer {
  margin-top: 4rem;
  color: var(--text-faint);
  font-size: 0.7em;
  font-family: var(--font-ui);
}

/* ---------- CHAT LAYOUT ---------- */

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
  width: 100%;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: msg-in 0.35s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-paul { align-self: flex-start; }
.msg-user { align-self: flex-end; }
.msg-bubble {
  padding: 1.2rem 1.5rem;
  border-radius: 22px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg-paul .msg-bubble {
  background: var(--surface);
  border: 1px solid rgba(232, 184, 122, 0.1);
  border-bottom-left-radius: 6px;
}
.msg-user .msg-bubble {
  background: linear-gradient(180deg, #e8b87a 0%, #c89855 100%);
  color: #2a1f10;
  border-bottom-right-radius: 6px;
}
.msg-label {
  font-family: var(--font-ui);
  font-size: 0.55em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0.5rem 0.4rem;
}
.msg-user .msg-label { text-align: right; color: var(--text-muted); }
.msg-thinking {
  display: inline-flex;
  gap: 6px;
  padding: 0.5rem 0;
}
.msg-thinking span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: pulse 1.2s ease-in-out infinite;
}
.msg-thinking span:nth-child(2) { animation-delay: 0.2s; }
.msg-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.9); }
  40% { opacity: 1; transform: scale(1.15); }
}

.chat-composer {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 1.25rem 0 1.75rem;
  border-top: 1px solid rgba(232, 184, 122, 0.1);
  background: var(--bg);
  position: sticky;
  bottom: 0;
}
.chat-input {
  flex: 1;
  resize: none;
  min-height: 70px;
  max-height: 220px;
}
.btn-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 96px;
  font-size: 0.8em;
  padding: 0.75rem 1rem;
}
.btn-icon .icon { font-size: 1.8em; line-height: 1; }
.btn-icon.active {
  background: linear-gradient(180deg, #e8b87a 0%, #c89855 100%);
  color: #2a1f10;
}

/* ---------- JOURNEY ---------- */

.journey-page {
  padding: 2rem 0 5rem;
}
.journey-intro {
  max-width: 720px;
  margin: 0 auto 2.5rem;
  text-align: center;
  padding: 0 1.5rem;
}
.journey-intro h1 { font-size: 2.6em; margin-bottom: 0.75rem; }
.journey-intro p { color: var(--text-muted); font-size: 1em; }

.journey-grid {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.card {
  background: var(--surface);
  border: 1px solid rgba(232, 184, 122, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}
.card:hover, .card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.card.done { opacity: 0.7; }
.card-order {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.65em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}
.card-order.done::after { content: "  ✓"; color: var(--ok); }
.card-headline { font-size: 1.35em; margin-bottom: 0.2rem; }
.card-subtitle {
  color: var(--text-muted);
  font-size: 0.8em;
  margin-bottom: 0.9rem;
  font-family: var(--font-ui);
}
.card-teaser { color: var(--text); font-size: 0.95em; }

.journey-reader {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.journey-reader h1 { font-size: 2.2em; margin-bottom: 0.3rem; }
.journey-reader .subtitle {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.9em;
  margin-bottom: 2rem;
}
.journey-reader p { margin: 0 0 1.5rem; font-size: 1.05em; line-height: 1.65; }
.journey-reader .photo {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-soft);
}
.journey-reader audio {
  width: 100%;
  margin: 1rem 0;
}
.journey-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(232, 184, 122, 0.1);
}

/* ---------- PHOTOS (stub) ---------- */

.photos-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.drop-zone {
  border: 2px dashed rgba(232, 184, 122, 0.35);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  background: var(--surface);
  transition: border-color 0.3s ease, background 0.3s ease;
}
.drop-zone.over { border-color: var(--accent); background: var(--surface-soft); }

/* ---------- ADMIN ---------- */

.admin-page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.admin-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr 120px;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 1rem;
  align-items: start;
  font-size: 0.75em;
}
.admin-row textarea { min-height: 80px; font-size: 0.9em; }
.admin-row input { font-size: 0.9em; }

/* ---------- ACCESSIBILITY ---------- */

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

/* Narrower screens still readable, but elderly-first target is laptop. */
@media (max-width: 600px) {
  html, body { font-size: 22px; }
  .picker-photo { width: 180px; height: 180px; }
  .chat-main { padding: 1rem; }
}
