/* PKD Forum shared theme: typography, warm accent, category chips, avatars, motion, dark mode.
   Loaded by index.html, guidelines.html and 404.html. Tailwind (CDN) supplies utilities. */
:root {
  --accent: #b84a32;        /* warm terracotta/coral: 5.2:1 with white text (WCAG AA) */
  --accent-hover: #9a3d27;  /* 6.8:1 */
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e2;
  --sand: #f6efe4;
  --ring: #14b8a6;
  color-scheme: light;
  line-height: 1.65; /* :root beats Tailwind preflight's html{line-height:1.5}; body inherits */
}
html.dark {
  --accent: #f0a58a;        /* soft coral on dark: 8.7:1 with --accent-ink */
  --accent-hover: #f5bba6;
  --accent-ink: #2a130b;
  --accent-soft: #3a2018;
  --sand: #142a28;
  color-scheme: dark;
}

/* ---------- Typography ---------- */
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.65; -webkit-font-smoothing: antialiased; }
.font-display, h1, h2, h3, .section-header, .heading-serif {
  font-family: 'Fraunces', 'Source Serif 4', Georgia, serif;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
}
.section-header { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1.15; font-weight: 600; color: #134e4b; }
.reading { max-width: 65ch; }
.prose-body { font-size: 1.0625rem; line-height: 1.8; }

/* ---------- Warm accent buttons ---------- */
.btn-accent {
  background-color: var(--accent); color: var(--accent-ink);
  transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 4px 14px -6px rgb(184 74 50 / .55);
}
.btn-accent:hover { background-color: var(--accent-hover); }
.btn-accent:active { transform: scale(.985); }
.btn-accent:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- Category chips (all pairs >= 6:1) ---------- */
.chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 600; line-height: 1.2; padding: .25rem .7rem; border-radius: 9999px; white-space: nowrap; }
.chip::before { content: ''; width: .45rem; height: .45rem; border-radius: 9999px; background: currentColor; opacity: .7; }
.chip-daily    { background: #e0f2fe; color: #075985; }
.chip-treat    { background: #ccfbf1; color: #115e59; }
.chip-diet     { background: #ecfccb; color: #3f6212; }
.chip-research { background: #ede9fe; color: #5b21b6; }
.chip-family   { background: #fef3c7; color: #92400e; }
.chip-emotion  { background: #ffe4e6; color: #9f1239; }
.chip-general  { background: #f1f5f9; color: #334155; }
html.dark .chip-daily    { background: #0c2a3a; color: #bae6fd; }
html.dark .chip-treat    { background: #0d2f2c; color: #99f6e4; }
html.dark .chip-diet     { background: #1c2a0e; color: #d9f99d; }
html.dark .chip-research { background: #251b3d; color: #ddd6fe; }
html.dark .chip-family   { background: #33240b; color: #fde68a; }
html.dark .chip-emotion  { background: #3a1520; color: #fecdd3; }
html.dark .chip-general  { background: #1e293b; color: #e2e8f0; }
/* matching colour strip on the top edge of a card */
.card-accent-daily{--strip:#38bdf8}.card-accent-treat{--strip:#14b8a6}.card-accent-diet{--strip:#84cc16}
.card-accent-research{--strip:#8b5cf6}.card-accent-family{--strip:#f59e0b}.card-accent-emotion{--strip:#fb7185}.card-accent-general{--strip:#94a3b8}

/* ---------- Avatars (dark ink on soft fills, >= 7:1) ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.25rem; height: 2.25rem; border-radius: 9999px; font-weight: 700; font-size: .9rem; font-family: 'Fraunces', Georgia, serif; }
.avatar-sm { width: 1.9rem; height: 1.9rem; font-size: .8rem; }
.avatar-0 { background: #a7d7c5; color: #1f3a37; }
.avatar-1 { background: #f3d9b1; color: #3b2a1a; }
.avatar-2 { background: #f4b8a1; color: #4a1f14; }
.avatar-3 { background: #cfe8df; color: #163330; }
.avatar-4 { background: #99f6e4; color: #134e4a; }

/* ---------- Post cards ---------- */
.post-card { position: relative; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.post-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--strip, #14b8a6); opacity: .85; }
.post-card:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -18px rgb(15 23 42 / .25); }
.count-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 9999px; background: #f1f5f9; color: #475569; font-weight: 600; }
html.dark .count-pill { background: #0f201f; color: #cbd5e1; }
.post-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tag { font-size: .75rem; padding: 2px 10px; border-radius: 9999px; background: var(--sand); color: #6b4f2a; font-weight: 500; }
html.dark .tag { color: #f3d9b1; }

/* fade-in + skeleton shimmer */
.fade-in { opacity: 0; animation: fadeUp .45s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.skeleton { position: relative; overflow: hidden; background: #e2e8f0; border-radius: .5rem; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgb(255 255 255 / .6), transparent); animation: shimmer 1.4s infinite; }
html.dark .skeleton { background: #1f3a37; }
html.dark .skeleton::after { background: linear-gradient(90deg, transparent, rgb(255 255 255 / .06), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Modals: backdrop fade + dialog rise, reverse on close ---------- */
.modal-backdrop { animation: fadeIn .22s ease forwards; }
.modal-backdrop .modal { animation: modalIn .32s cubic-bezier(.16,1,.3,1) forwards; }
.modal-backdrop.closing { animation: fadeOut .18s ease forwards; }
.modal-backdrop.closing .modal { animation: modalOut .18s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modalOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.98); } }
.drawer { animation: drawerIn .28s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: none; } }
.toast { animation: fadeUp .3s ease forwards; }

.accordion-content { max-height: 0; overflow: hidden; padding-bottom: 0; transition: max-height .3s ease-out, padding .3s ease-out; }
.accordion-content.open { padding-bottom: 1.25rem; }
.soft-shadow { box-shadow: 0 4px 6px -1px rgb(15 23 42 / .07), 0 2px 4px -2px rgb(15 23 42 / .07); }
.hero-art { border-radius: 2rem; box-shadow: 0 30px 60px -30px rgb(19 78 75 / .45); }
.path-card img { transition: transform .5s ease; }
.path-card:hover img { transform: scale(1.04); }
.quote-mark { font-family: 'Fraunces', Georgia, serif; font-size: 3.5rem; line-height: 1; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .fade-in { opacity: 1; }
}

/* ---------- Dark mode: remap the Tailwind utilities this site uses ---------- */
html.dark body, html.dark body.bg-slate-50 { background-color: #0b1716; color: #e2ece9; }
html.dark *, html.dark ::before, html.dark ::after { border-color: #1f3a37; }
html.dark .bg-white { background-color: #122826; }
html.dark .bg-white\/80 { background-color: rgb(18 40 38 / .8); }
html.dark .bg-slate-50 { background-color: #0f201f; }
html.dark .bg-slate-100 { background-color: #1a3331; }
html.dark .bg-teal-50 { background-color: #113532; }
html.dark .bg-emerald-50 { background-color: #12332a; }
html.dark .bg-red-50 { background-color: #3a1517; }
html.dark .bg-teal-900 { background-color: #0d2e2b; }
html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-slate-100:hover { background-color: #1a3331; }
html.dark .border-teal-100, html.dark .border-teal-200 { border-color: #1f4a45; }
html.dark .border-red-200 { border-color: #7f1d1d; }
html.dark .text-slate-800, html.dark .text-slate-700 { color: #e2ece9; }
html.dark .text-slate-600 { color: #c3d2d0; }
html.dark .text-slate-500 { color: #b6c6c4; }
html.dark .text-slate-400 { color: #9fb3b1; }
html.dark .text-teal-950, html.dark .text-teal-900, html.dark .section-header { color: #ccfbf1; }
html.dark .text-teal-800, html.dark .text-teal-700, html.dark .text-teal-600 { color: #5eead4; }
html.dark .text-emerald-700 { color: #6ee7b7; }
html.dark .text-red-600, html.dark .text-red-700 { color: #fca5a5; }
html.dark .hover\:text-teal-700:hover, html.dark .hover\:text-teal-800:hover, html.dark .hover\:text-teal-900:hover, html.dark .hover\:text-teal-600:hover { color: #99f6e4; }
html.dark .hover\:text-slate-600:hover, html.dark .hover\:text-slate-800:hover { color: #f1f5f9; }
html.dark input, html.dark select, html.dark textarea { background-color: #0f201f; color: #e2ece9; }
html.dark input::placeholder, html.dark textarea::placeholder { color: #8aa19e; }
html.dark .illus { filter: brightness(.88) saturate(.95); }
html.dark .hero-art { box-shadow: 0 30px 60px -30px rgb(0 0 0 / .7); }
html.dark .bg-sand { background-color: var(--sand); }
.bg-sand { background-color: var(--sand); }
html.dark .bg-rose-50 { background-color: #3a1520; }
html.dark .border-rose-200, html.dark .hover\:border-rose-200:hover { border-color: #7f2a3c; }
html.dark .text-rose-600, html.dark .hover\:text-rose-600:hover { color: #fda4af; }
html.dark .border-slate-300 { border-color: #2c4f4b; }
html.dark .bg-slate-950\/55, html.dark .bg-slate-950\/50 { background-color: rgb(0 0 0 / .65); }
html.dark .bg-white\/90 { background-color: rgb(18 40 38 / .9); }
