/* ============================================
   COMPASSION EDUCATION — DOCUMENT STYLES
   Warm, nature-inspired, readable long-form
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

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

:root {
    --sage: #6B8F71;
    --sage-bright: #7FA885;
    --sage-light: rgba(107, 143, 113, 0.10);
    --sage-glow: rgba(127, 168, 133, 0.20);
    --earth: #8B6F47;
    --earth-light: rgba(139, 111, 71, 0.08);
    --sky: #5B8FA8;
    --sky-light: rgba(91, 143, 168, 0.08);
    --warmth: #C4784A;
    --warmth-light: rgba(196, 120, 74, 0.08);
    --charcoal: #2D2926;
    --cream: #FDFAF5;
    --white: #FFFFFF;
    --text: #2D2926;
    --text-body: #3D3936;
    --muted: #7A7067;
    --border: #E8E0D4;
    --sidebar-width: 280px;
    --toolbar-height: 56px;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    color: var(--text-body);
    background: var(--cream);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* ── LAYOUT ── */
.doc-layout {
    display: flex;
    min-height: 100vh;
}

.doc-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: 1px;
    text-decoration: none;
    display: block;
    margin-bottom: 0.2rem;
}

.sidebar-subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sage);
}

.sidebar-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    margin-top: 0.75rem;
    transition: color 0.2s;
}

.sidebar-back:hover { color: var(--sage); }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-section:first-child { border-top: none; margin-top: 0; }

.sidebar-section {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--charcoal);
    padding: 1.5rem 1.25rem 0.5rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-body);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.sidebar-nav a:hover {
    color: var(--sage);
    background: var(--sage-light);
    border-left-color: var(--sage);
}

.sidebar-nav a.active {
    color: #fff;
    background: var(--sage);
    border-left: 3px solid var(--earth);
    border-radius: 6px;
    margin-right: 8px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(107,143,113,0.3);
}

/* ── MAIN ── */
.doc-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.doc-toolbar {
    position: sticky;
    top: 0;
    z-index: 150;
    height: var(--toolbar-height);
    background: rgba(253, 250, 245, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.toolbar-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--charcoal);
}

/* ── HAMBURGER (mobile) ── */
.doc-hamburger {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 300;
    width: 40px; height: 40px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.doc-hamburger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--charcoal);
    border-radius: 2px;
}

.doc-hamburger span + span { margin-top: 4px; }

.doc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45,41,38,0.4);
    z-index: 190;
    backdrop-filter: blur(4px);
}

.doc-overlay.visible { display: block; }

/* ── TYPOGRAPHY ── */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2.5rem 2rem 5rem;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    color: var(--charcoal);
    line-height: 1.12;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1.18;
    margin-top: 2.75rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--sage-light);
}

h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1.25;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

h4 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-body);
    margin-bottom: 1.15rem;
}

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

a {
    color: var(--sage);
    text-decoration: underline;
    text-decoration-color: rgba(107, 143, 113, 0.3);
    text-underline-offset: 2.5px;
    transition: all 0.2s;
}

a:hover { color: var(--sage-bright); text-decoration-color: var(--sage-bright); }

hr { border: none; height: 1px; background: var(--border); margin: 2.5rem 0; }

ul, ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }

li {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-body);
    margin-bottom: 0.45rem;
}

li::marker { color: var(--sage); }

blockquote {
    background: linear-gradient(135deg, rgba(253,250,245,0.7), rgba(107,143,113,0.06));
    border-left: 4px solid var(--sage);
    border-radius: 0 12px 12px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

blockquote p { font-size: 1rem; color: var(--charcoal); margin-bottom: 0; }

/* ── TABLES ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.92rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

thead { background: var(--charcoal); }

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sage-bright);
    border-bottom: 2px solid var(--sage);
}

tbody tr { background: var(--white); transition: background 0.15s; }
tbody tr:nth-child(even) { background: rgba(253,250,245,0.5); }
tbody tr:hover { background: var(--sage-light); }

tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
}

/* ── CALLOUTS ── */
.executive-callout {
    background: linear-gradient(135deg, var(--cream), rgba(107,143,113,0.04));
    border-left: 4px solid var(--sage);
    padding: 1.25rem 1.75rem;
    margin: 1.75rem 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 1px 6px rgba(107,143,113,0.08);
}

.executive-callout .callout-label {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--sage);
    margin-bottom: 0.4rem;
}

.executive-callout p { font-size: 1.02rem; color: var(--charcoal); margin: 0; font-weight: 500; }

.key-insight {
    background: linear-gradient(135deg, #2D2926, #3D3936);
    color: var(--cream);
    padding: 1.75rem 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    border-left: 4px solid var(--sage);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.key-insight::before {
    content: 'KEY INSIGHT';
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--sage);
    margin-bottom: 0.6rem;
}

.key-insight p { color: var(--cream); margin: 0; font-size: 1.02rem; line-height: 1.7; }

.pull-quote {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--sage);
    border-left: 4px solid var(--sage);
    padding: 1.25rem 1.75rem 1.25rem 2.5rem;
    margin: 2rem 0;
    background: linear-gradient(135deg, rgba(107,143,113,0.05), rgba(127,168,133,0.02));
    border-radius: 0 10px 10px 0;
    line-height: 1.45;
    position: relative;
}

.pull-quote::before {
    content: '\201C';
    font-size: 4.5rem;
    color: rgba(107,143,113,0.22);
    position: absolute;
    top: -0.3rem; left: 0.35rem;
    font-family: var(--font-display);
    line-height: 1;
}

.stat-callout {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    margin: 2rem 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.stat-callout .stat-number {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--sage);
    white-space: nowrap;
    line-height: 1;
}

.stat-callout .stat-label { font-size: 1.05rem; color: var(--muted); line-height: 1.5; }

.framework-box {
    border: 2px solid var(--sage);
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
    background: rgba(107,143,113,0.03);
}

.framework-box h4 {
    font-family: var(--font-display);
    color: var(--charcoal);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(107,143,113,0.3);
}

.key-stat {
    background: linear-gradient(135deg, var(--white), rgba(253,250,245,0.8));
    border: 1px solid rgba(107,143,113,0.2);
    border-left: 4px solid var(--sage);
    border-radius: 0 12px 12px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.key-stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--sage);
    line-height: 1.2;
}

.key-stat .stat-label { font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; }

.reading-progress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--sage), var(--sage-bright));
    z-index: 10000;
    box-shadow: 0 0 8px rgba(107,143,113,0.35);
    transition: width 0.1s linear;
}

.section-divider {
    width: 60px; height: 3px;
    background: linear-gradient(90deg, var(--sage), var(--sage-bright));
    margin: 3rem auto;
    border-radius: 2px;
}

.drop-cap::first-letter {
    font-family: var(--font-display);
    float: left;
    font-size: 3.8rem;
    line-height: 0.78;
    font-weight: 700;
    color: var(--sage);
    margin: 0.06em 0.12em 0 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .doc-sidebar { transform: translateX(-100%); }
    .doc-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
    .doc-main { margin-left: 0; }
    .doc-hamburger { display: flex; }
    .doc-toolbar { padding-left: 3.5rem; }
    .container { padding: 2rem 1.25rem 4rem; }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
}

@media (max-width: 600px) {
    .container { padding: 1.5rem 1rem 3rem; }
    p, li { font-size: 0.95rem; }
    .stat-callout { flex-direction: column; text-align: center; gap: 0.75rem; }
    .pull-quote { font-size: 1.2rem; padding: 1rem 1.5rem; }
}

/* ── PRINT ── */
@media print {
    @page { size: letter; margin: 1in 0.9in 0.85in 0.9in; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .doc-sidebar, .doc-toolbar, .doc-hamburger, .doc-overlay, .reading-progress { display: none !important; }
    .doc-layout { display: block !important; }
    .doc-main { margin-left: 0 !important; }
    .container { max-width: 100% !important; padding: 0 !important; }
    body { background: white !important; font-size: 11pt; }
    h2 { break-before: page; }
    blockquote, .key-insight, .pull-quote, .framework-box, .stat-callout, .executive-callout { break-inside: avoid; }
}
