/* =============================================================================
   Tribal Hearts — Policy Site
   Modern, readable, brand-consistent stylesheet.
   - Warm sunset palette (matches the app's #FFF3E9 brand background)
   - Reader-first typography with generous vertical rhythm
   - Card-based components, subtle motion, polished tables & callouts
   - Mobile-first, dark-mode aware, print-friendly
   ============================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Brand */
  --rose-50:  #fff5f7;
  --rose-100: #ffe4ea;
  --rose-200: #ffc7d2;
  --rose-400: #f06484;
  --rose-500: #d94864;   /* primary accent  */
  --rose-600: #c43f5f;   /* used for links  */
  --rose-700: #a02d4a;
  --rose-800: #8b2841;

  --sunset-50:  #fff8f1;
  --sunset-100: #fff3e9;   /* app brand-sunset hue */
  --sunset-200: #ffe2c8;
  --sunset-300: #ffc99a;

  /* Surfaces */
  --bg:           #fffaf6;
  --bg-elev:     #ffffff;
  --bg-tint:     #fff5ec;
  --bg-code:     #fbeee3;

  /* Ink */
  --ink:          #221820;
  --ink-soft:     #4d3d47;
  --ink-faint:    #8a7882;
  --hairline:     #f0e1e3;
  --hairline-2:   #e4d2d6;

  /* Layout */
  --maxw:         760px;
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    22px;
  --shadow-soft:  0 1px 2px rgba(34, 24, 32, 0.04), 0 6px 22px -10px rgba(196, 63, 95, 0.18);
  --shadow-card:  0 1px 3px rgba(34, 24, 32, 0.06), 0 12px 30px -16px rgba(196, 63, 95, 0.22);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji",
               "Segoe UI Emoji", sans-serif;
  --font-serif: "Iowan Old Style", "Source Serif Pro", "Charter", Georgia,
                "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono",
               monospace;

  --easing: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14101a;
    --bg-elev:   #1d1822;
    --bg-tint:   #221a28;
    --bg-code:   #2a1f2c;

    --ink:       #f3e8ee;
    --ink-soft:  #ccb6c0;
    --ink-faint: #8f7a87;
    --hairline:  #2e2532;
    --hairline-2:#3b303f;

    --rose-600:  #ff7d99;   /* link colour brightened for dark bg */
    --rose-700:  #ff5a7d;
    --shadow-soft:  0 1px 2px rgba(0,0,0,0.4), 0 6px 22px -10px rgba(255,125,153,0.16);
    --shadow-card:  0 1px 3px rgba(0,0,0,0.5), 0 12px 30px -16px rgba(255,125,153,0.20);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -200px, var(--sunset-200) 0%, transparent 55%),
    radial-gradient(1000px 500px at -10% 110%, var(--rose-100)   0%, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 36px 0;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 36px);
  background: rgba(255, 250, 246, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 50;
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(20, 16, 26, 0.82); }
}
.site-header .brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--rose-700);
  text-decoration: none;
  border-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.site-header .brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--sunset-100);
  box-shadow: 0 2px 8px rgba(196, 63, 95, 0.18);
}
.site-header nav { display: inline-flex; gap: 10px; align-items: center; }
.site-header nav a {
  color: var(--rose-700);
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--rose-200);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  transition: transform 0.18s var(--easing), border-color 0.18s, background 0.18s;
}
.site-header nav a:hover {
  background: var(--rose-50);
  border-color: var(--rose-500);
  transform: translateY(-1px);
}
@media (prefers-color-scheme: dark) {
  .site-header nav a { border-color: var(--hairline-2); }
  .site-header nav a:hover { background: var(--bg-tint); }
}

/* ---------- Container & main reading column ---------- */
.container {
  max-width: var(--maxw);
  margin: 40px auto 80px;
  padding: 0 clamp(18px, 4vw, 28px);
}

/* ---------- Hero (index page only) ---------- */
.hero {
  text-align: center;
  padding: 32px 0 8px;
  margin-bottom: 16px;
}
.hero img {
  width: clamp(140px, 22vw, 180px);
  height: auto;
  border-radius: clamp(24px, 4vw, 32px);
  box-shadow:
    0 4px 14px rgba(196, 63, 95, 0.14),
    0 18px 40px -16px rgba(196, 63, 95, 0.28);
  margin: 0 auto 24px;
  display: block;
  background: var(--sunset-100);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  color: var(--ink);
  letter-spacing: -0.018em;
  line-height: 1.2;
  font-weight: 800;
}
h1 {
  font-size: clamp(28px, 4vw, 38px);
  margin: 8px 0 18px;
  background: linear-gradient(135deg, var(--rose-700), var(--rose-500) 60%, #e98358);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 {
  font-size: clamp(20px, 2.4vw, 24px);
  margin: 44px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
h2:first-of-type { border-top: 0; padding-top: 0; }
h3 {
  font-size: 19px;
  margin: 28px 0 8px;
  color: var(--rose-700);
}
h4 {
  font-size: 16px;
  margin: 22px 0 6px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p { margin: 0 0 14px; }
.lede {
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1.55;
  margin-bottom: 28px;
}

strong { color: var(--ink); font-weight: 700; }

a {
  color: var(--rose-600);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--rose-600) 30%, transparent);
  transition: color 0.15s, border-color 0.15s;
}
a:hover {
  color: var(--rose-700);
  border-bottom-color: currentColor;
}

/* Anchor target highlight (when arriving via #id) */
:target {
  scroll-margin-top: 90px;
  animation: anchor-flash 1.6s ease 0.1s;
}
@keyframes anchor-flash {
  0%   { background: var(--sunset-100); }
  100% { background: transparent; }
}

/* ---------- Lists ---------- */
ul, ol { padding-left: 22px; margin: 4px 0 20px; }
li { margin-bottom: 8px; }
li > p { margin-bottom: 6px; }
li::marker { color: var(--rose-500); }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0 24px;
  font-size: 15.5px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
th {
  background: var(--bg-tint);
  color: var(--rose-700);
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--rose-100);
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 243, 233, 0.5); }
@media (prefers-color-scheme: dark) {
  tr:hover td { background: rgba(255, 125, 153, 0.06); }
}

/* ---------- Code ---------- */
code, kbd {
  background: var(--bg-code);
  border-radius: 6px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--rose-800);
}
@media (prefers-color-scheme: dark) {
  code, kbd { color: var(--rose-200); }
}
pre {
  background: var(--bg-code);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 14px 0 22px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.55;
  border: 1px solid var(--hairline);
}
pre code { background: transparent; padding: 0; color: inherit; }

/* ---------- Blockquote / Callout ---------- */
blockquote {
  margin: 22px 0;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--sunset-100), var(--bg-elev));
  border-left: 4px solid var(--rose-500);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
}
blockquote p:last-child { margin-bottom: 0; }
blockquote strong { color: var(--rose-700); }
@media (prefers-color-scheme: dark) {
  blockquote {
    background: linear-gradient(180deg, var(--bg-tint), var(--bg-elev));
  }
}

/* ---------- Index page: list of policies ---------- */
.policy-list {
  list-style: none;
  padding: 0;
  margin: 28px 0;
  display: grid;
  gap: 12px;
}
.policy-list li {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: transform 0.18s var(--easing), box-shadow 0.18s, border-color 0.18s;
}
.policy-list li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--rose-200);
}
.policy-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 0;
}
.policy-list li a::after {
  content: "→";
  color: var(--rose-500);
  font-weight: 800;
  font-size: 20px;
  transition: transform 0.2s var(--easing);
}
.policy-list li:hover a::after { transform: translateX(4px); }

/* ---------- Contact / company info sections (index page) ---------- */
.quick-contact, .company-info {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-top: 32px;
  box-shadow: var(--shadow-soft);
}
.quick-contact h2, .company-info h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 18px;
  color: var(--rose-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top: 0;
  padding-top: 0;
}
.quick-contact p, .company-info p { margin-bottom: 0; }
.company-info {
  background:
    linear-gradient(135deg, var(--sunset-100), var(--bg-elev) 60%);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 32px 20px 44px;
  color: var(--ink-faint);
  font-size: 14px;
  border-top: 1px solid var(--hairline);
  background: var(--bg-elev);
}
.site-footer p { margin: 0; }

/* ---------- Mobile fine-tuning ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.65; }
  .lede { font-size: 17px; }
  .container { margin: 24px auto 56px; }
  h2 { margin-top: 32px; padding-top: 14px; }
  .site-header { padding: 12px 16px; }
  .site-header .brand { font-size: 17px; }
  .site-header nav a { padding: 7px 12px; font-size: 13px; }
  table { font-size: 14.5px; }
  th, td { padding: 10px 12px; }
}

/* ---------- Print ---------- */
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body { font-size: 11pt; line-height: 1.5; }
  .site-header, .site-footer, nav { display: none !important; }
  .container { max-width: 100%; margin: 0; padding: 0; }
  h1 { color: #000 !important; background: none !important; -webkit-text-fill-color: #000 !important; }
  a {
    color: #000 !important;
    text-decoration: underline !important;
    border-bottom: 0 !important;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
  table, blockquote, pre, .policy-list li, .quick-contact, .company-info {
    box-shadow: none !important;
    border-color: #ccc !important;
    background: #fff !important;
  }
  tr { page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}
