/* ==========================================================================
   APPA Body of Knowledge — Master Stylesheet
   ==========================================================================

   HOW TO CUSTOMIZE:
   Don't edit this file directly. Use bok-custom.css instead.
   That file loads AFTER this one and overrides anything here.

   All major design values (colors, fonts, spacing, sizes) are defined as
   CSS custom properties in the :root block below. To change them site-wide,
   copy the :root block into bok-custom.css and adjust values there.
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS (Brand Colors, Fonts, Spacing)
   ==========================================================================
   Change these in bok-custom.css to rebrand the entire site at once.
   ========================================================================== */

:root {
    /* ── Brand Colors ── */
    --blue:         #2D83FE;
    --navy:         #3252A7;
    --orange:       #FD7E01;
    --dark-orange:  #DB5311;
    --charcoal:     #3A3838;
    --white:        #FFFFFF;
    --light-gray:   #F5F6F8;
    --mid-gray:     #E8EAED;

    /* ── Text Colors ── */
    --text-primary:    var(--charcoal);
    --text-secondary:  #4B5563;
    --text-muted:      #6B7280;
    --text-faint:      #9CA3AF;

    /* ── Typography ── */
    --font-family:     'Roboto', sans-serif;
    --font-size-body:  16px;
    --line-height:     1.6;

    /* ── Header ── */
    --header-bg:       var(--navy);
    --header-height:   72px;
    --header-padding:  0 48px;

    /* ── Hero Section ── */
    --hero-gradient:   linear-gradient(135deg, var(--navy) 0%, #1a3680 40%, var(--blue) 100%);
    --hero-padding:    96px 48px 88px;
    --hero-title-size: 48px;

    /* ── Parts Grid ── */
    --card-radius:     12px;
    --card-border:     var(--mid-gray);
    --card-hover-shadow: 0 8px 32px rgba(50,82,167,0.1);

    /* ── Chapter Page ── */
    --sidebar-width:       280px;
    --sidebar-bg:          var(--light-gray);
    --content-max-width:   820px;
    --content-padding:     48px 64px 80px;
    --chapter-title-size:  36px;
    --chapter-body-size:   16px;
    --chapter-line-height: 1.8;

    /* ── Member Gate Card ── */
    --gate-bg:          linear-gradient(135deg, #F0F4FF 0%, #FFF7ED 100%);
    --gate-border:      var(--mid-gray);
    --gate-radius:      12px;
    --gate-btn-bg:      var(--blue);
    --gate-btn-color:   var(--white);
    --gate-btn-radius:  8px;

    /* ── Footer ── */
    --footer-bg:        var(--charcoal);
    --footer-padding:   48px;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    color: var(--text-primary);
    background: var(--white);
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
}


/* ==========================================================================
   2. HEADER
   ========================================================================== */

header.bok-header {
    background: var(--header-bg);
    padding: var(--header-padding);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-area img {
    height: 40px;
}

.logo-text {
    color: var(--white);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.logo-text span {
    font-weight: 300;
    opacity: 0.8;
    margin-left: 8px;
}

.header-nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

.header-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: color 0.2s;
}

.header-nav a:hover { color: var(--white); }


/* ==========================================================================
   3. HERO SECTION (Landing Page)
   ========================================================================== */

.hero {
    background: var(--hero-gradient);
    padding: var(--hero-padding);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(253,126,1,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(45,131,254,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero h1 {
    color: var(--white);
    font-size: var(--hero-title-size);
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.hero h1 .accent {
    color: var(--orange);
}

.hero p {
    color: rgba(255,255,255,0.8);
    font-size: 19px;
    font-weight: 300;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.hero .stat-bar {
    display: flex;
    justify-content: center;
    gap: 64px;
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

.hero .stat {
    text-align: center;
}

.hero .stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--white);
}

.hero .stat-label {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}


/* ==========================================================================
   4. PARTS GRID (Landing Page)
   ========================================================================== */

.parts-section {
    padding: 80px 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 56px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.section-header p {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.5;
}

.parts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.part-card {
    background: var(--white);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 36px 32px;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.part-card:hover {
    border-color: var(--blue);
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
}

.part-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 12px 0 0 12px;
}

.part-card:nth-child(1)::before { background: var(--navy); }
.part-card:nth-child(2)::before { background: var(--blue); }
.part-card:nth-child(3)::before { background: var(--orange); }
.part-card:nth-child(4)::before { background: var(--dark-orange); }

.part-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.part-card:nth-child(1) .part-label { color: var(--navy); }
.part-card:nth-child(2) .part-label { color: var(--blue); }
.part-card:nth-child(3) .part-label { color: var(--orange); }
.part-card:nth-child(4) .part-label { color: var(--dark-orange); }

.part-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.part-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.part-chapters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.part-chapters .chapter-tag {
    background: var(--light-gray);
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.part-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.part-count {
    font-size: 13px;
    color: var(--text-faint);
    font-weight: 500;
}

.part-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.part-card:nth-child(1) .part-arrow { background: rgba(50,82,167,0.08); color: var(--navy); }
.part-card:nth-child(2) .part-arrow { background: rgba(45,131,254,0.08); color: var(--blue); }
.part-card:nth-child(3) .part-arrow { background: rgba(253,126,1,0.08); color: var(--orange); }
.part-card:nth-child(4) .part-arrow { background: rgba(219,83,17,0.08); color: var(--dark-orange); }

.part-card:hover .part-arrow { transform: translateX(4px); }


/* ==========================================================================
   5. CHAPTER PAGE — Layout
   ========================================================================== */

.chapter-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height) - 120px);
}


/* ==========================================================================
   6. CHAPTER PAGE — Sidebar / Table of Contents
   ========================================================================== */

.chapter-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--mid-gray);
    padding: 32px 24px;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.chapter-sidebar .part-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    transition: opacity 0.15s;
}

.chapter-sidebar a.part-badge:hover {
    opacity: 0.8;
}

.chapter-sidebar .chapter-title-small {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.4;
}

.toc-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    margin-bottom: 12px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 2px;
}

.toc-list a {
    display: block;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    line-height: 1.4;
    transition: all 0.15s;
}

.toc-list a:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

.toc-list a.active {
    background: rgba(0,0,0,0.06);
    color: var(--text-primary);
    font-weight: 500;
}


/* ==========================================================================
   7. CHAPTER PAGE — Main Content Area
   ========================================================================== */

.chapter-content {
    padding: var(--content-padding);
    max-width: var(--content-max-width);
}

.chapter-breadcrumb {
    font-size: 13px;
    color: var(--text-faint);
    margin-bottom: 24px;
}

.chapter-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.chapter-breadcrumb a:hover {
    text-decoration: underline;
}

.chapter-content h1 {
    font-size: var(--chapter-title-size);
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.chapter-meta {
    font-size: 13px;
    color: var(--text-faint);
    margin-bottom: 40px;
}


/* ==========================================================================
   8. CHAPTER PAGE — Body Content (prose, headings, tables, images)
   ========================================================================== */

.chapter-body {
    font-size: var(--chapter-body-size);
    line-height: var(--chapter-line-height);
    color: var(--text-primary);
}

.chapter-body .bok-section {
    margin-bottom: 48px;
}

.chapter-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-top: 16px;
}

.chapter-body h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 12px;
}

.chapter-body h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 8px;
}

.chapter-body p {
    margin: 0 0 16px;
}

.chapter-body ul, .chapter-body ol {
    margin: 0 0 16px 24px;
}

.chapter-body li {
    margin-bottom: 6px;
}

.chapter-body blockquote {
    border-left: 4px solid var(--mid-gray);
    margin: 24px 0;
    padding: 16px 24px;
    color: var(--text-secondary);
    font-style: italic;
}

.chapter-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.chapter-body th, .chapter-body td {
    border: 1px solid var(--mid-gray);
    padding: 10px 14px;
    text-align: left;
}

.chapter-body th {
    background: var(--light-gray);
    font-weight: 600;
}

.chapter-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.chapter-body a {
    color: var(--blue);
    text-decoration: none;
}

.chapter-body a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   9. MEMBER GATE CARD
   ==========================================================================
   This is the "Sign In to Read" card shown to non-members below the abstract.
   ========================================================================== */

.bok-member-gate {
    margin-top: 40px;
    padding: 32px;
    background: var(--gate-bg);
    border-radius: var(--gate-radius);
    border: 1px solid var(--gate-border);
    text-align: center;
}

.bok-member-gate .gate-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.bok-member-gate h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.bok-member-gate .gate-description {
    color: var(--text-muted);
    margin: 0 0 20px;
    font-size: 15px;
}

.bok-member-gate .gate-btn {
    display: inline-block;
    background: var(--gate-btn-bg);
    color: var(--gate-btn-color);
    padding: 12px 32px;
    border-radius: var(--gate-btn-radius);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.bok-member-gate .gate-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.bok-member-gate .gate-join {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-faint);
}

.bok-member-gate .gate-join a {
    color: var(--blue);
    text-decoration: none;
}

.bok-member-gate .gate-join a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   10. CHAPTER NAVIGATION (Prev / Next)
   ========================================================================== */

.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--mid-gray);
}

.chapter-nav a {
    display: block;
    padding: 16px 20px;
    border: 1px solid var(--mid-gray);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    max-width: 50%;
}

.chapter-nav a:hover {
    border-color: var(--blue);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chapter-nav .nav-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    margin-bottom: 4px;
}

.chapter-nav .nav-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.chapter-nav .nav-next { text-align: right; margin-left: auto; }


/* ==========================================================================
   11. FOOTER
   ========================================================================== */

footer.bok-footer {
    background: var(--footer-bg);
    padding: var(--footer-padding);
    text-align: center;
}

footer.bok-footer p {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

footer.bok-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

footer.bok-footer a:hover { color: var(--white); }


/* ==========================================================================
   12. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .chapter-layout {
        grid-template-columns: 1fr;
    }

    .chapter-sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--mid-gray);
        padding: 24px;
    }

    .chapter-content {
        padding: 32px 24px 64px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    header.bok-header { padding: 0 24px; }
    .header-nav { display: none; }
    .hero { padding: 64px 24px 56px; }
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 16px; }
    .hero .stat-bar { gap: 32px; }
    .hero .stat-number { font-size: 28px; }
    .parts-section { padding: 48px 24px; }
    .parts-grid { grid-template-columns: 1fr; }
    .chapter-content h1 { font-size: 28px; }
    .chapter-body { font-size: 15px; }
    footer.bok-footer { padding: 32px 24px; }
}

/* Smooth scroll for anchor links */
html { scroll-behavior: smooth; }
