/* ============================================
   Teknologi Tampilan Panel Datar
   Yoga Divayana, PhD — 2026
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0b0e13;
    --bg-secondary: #12161d;
    --bg-tertiary: #1a1f29;
    --bg-card: #161b24;
    --bg-code: #0d1117;
    --border: #252b36;
    --border-light: #1e232d;
    --text-primary: #e2e5ea;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #34d399;
    --accent-dim: #10b981;
    --accent-glow: rgba(52, 211, 153, 0.15);
    --accent-warm: #fbbf24;
    --accent-warm-dim: #d97706;
    --danger: #f87171;
    --info: #60a5fa;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 1320px;
    --sidebar-width: 300px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.75;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4150; }

/* ---------- Top Navigation ---------- */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(11, 14, 19, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #059669);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #000;
    flex-shrink: 0;
}

.nav-brand-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
}

.nav-brand-text span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ---------- Layout ---------- */
.page-wrapper {
    padding-top: 60px;
    min-height: 100vh;
}

.page-with-sidebar {
    display: flex;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px 80px;
    gap: 40px;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    padding-right: 8px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
}

.sidebar-list {
    list-style: none;
    border-left: 2px solid var(--border);
}

.sidebar-list li {
    position: relative;
}

.sidebar-list a {
    display: block;
    padding: 7px 12px 7px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: all 0.2s;
}

.sidebar-list a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}

.sidebar-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-glow);
    font-weight: 600;
}

.sidebar-list .sub-section {
    padding-left: 28px;
    font-size: 12px;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    min-width: 0;
    max-width: 820px;
}

/* ---------- Hero / Landing ---------- */
.hero {
    position: relative;
    padding: 100px 24px 80px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(52,211,153,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-glow);
    border: 1px solid rgba(52,211,153,0.2);
    border-radius: 100px;
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 28px;
    letter-spacing: 0.03em;
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-keywords {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 48px;
}

.hero-keyword {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 5px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.hero-meta-item {
    text-align: center;
}

.hero-meta-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    display: block;
}

.hero-meta-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- Chapter Cards Grid ---------- */
.chapters-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.chapter-card:hover {
    border-color: rgba(52,211,153,0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.chapter-card:hover::before {
    opacity: 1;
}

.chapter-card-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chapter-card-num::before {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.chapter-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}

.chapter-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.chapter-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}

.chapter-card-tag {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---------- Chapter Page Header ---------- */
.chapter-header {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.chapter-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chapter-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.chapter-breadcrumb a:hover {
    color: var(--accent);
}

.chapter-header h1 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.chapter-header .chapter-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- Content Typography ---------- */
.main-content h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 48px 0 16px;
    padding-top: 16px;
    color: var(--text-primary);
    scroll-margin-top: 80px;
}

.main-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 36px 0 12px;
    color: var(--text-primary);
    scroll-margin-top: 80px;
}

.main-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text-primary);
}

.main-content p {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 15px;
}

.main-content ul, .main-content ol {
    margin: 0 0 16px 24px;
    color: var(--text-primary);
    font-size: 15px;
}

.main-content li {
    margin-bottom: 6px;
}

.main-content strong {
    color: #f0f0f0;
    font-weight: 600;
}

.main-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(52,211,153,0.3);
    transition: border-color 0.2s;
}

.main-content a:hover {
    border-bottom-color: var(--accent);
}

/* ---------- Definition / Theorem Boxes ---------- */
.def-box, .thm-box, .ex-box, .note-box {
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 20px 0;
    border-left: 4px solid;
}

.def-box {
    background: rgba(52, 211, 153, 0.05);
    border-color: var(--accent);
}

.thm-box {
    background: rgba(251, 191, 36, 0.05);
    border-color: var(--accent-warm);
}

.ex-box {
    background: rgba(96, 165, 250, 0.05);
    border-color: var(--info);
}

.note-box {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--text-muted);
}

.def-box .box-title,
.thm-box .box-title,
.ex-box .box-title,
.note-box .box-title {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.def-box .box-title { color: var(--accent); }
.thm-box .box-title { color: var(--accent-warm); }
.ex-box .box-title { color: var(--info); }
.note-box .box-title { color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* ---------- MathJax Overrides ---------- */
mjx-container {
    color: var(--text-primary) !important;
    font-size: 105% !important;
}

mjx-container[display="true"] {
    margin: 20px 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
}

/* ---------- Equations ---------- */
.equation-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 20px 0;
    text-align: center;
    overflow-x: auto;
}

.equation-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 8px;
}

/* ---------- Figures ---------- */
.figure {
    margin: 28px 0;
    text-align: center;
}

.figure-placeholder {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.figure-placeholder .fig-icon {
    font-size: 36px;
    opacity: 0.4;
}

.figure-caption {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    font-style: italic;
}

/* ---------- Exercise Section ---------- */
.exercises-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--border);
}

.exercises-section h2 {
    margin-top: 0;
}

.exercise-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 12px;
}

.exercise-item h4 {
    color: var(--accent);
    margin: 0 0 8px;
    font-size: 14px;
}

.exercise-item p {
    margin-bottom: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---------- Chapter Navigation ---------- */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.chapter-nav a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    flex: 1;
    transition: all 0.2s;
    max-width: 50%;
}

.chapter-nav a:hover {
    border-color: rgba(52,211,153,0.3);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.chapter-nav a .nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--text-muted);
}

.chapter-nav a .nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.chapter-nav .nav-next {
    text-align: right;
    margin-left: auto;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.site-footer strong {
    color: var(--text-secondary);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .page-with-sidebar { padding: 24px 16px 60px; }
    .nav-links { display: none; }
    .nav-mobile-toggle { display: block; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        padding: 12px;
    }
    .hero h1 { font-size: 2rem; }
    .chapters-grid { grid-template-columns: 1fr; }
    .chapter-nav { flex-direction: column; }
    .chapter-nav a { max-width: 100%; }
}

/* ---------- MathJax loading indicator ---------- */
.mjx-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin: 0 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.page-break { page-break-before: always; }

/* Inline code */
code:not([class]) {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--accent);
}

/* Comparison list inside content */
.compare-list {
    list-style: none;
    margin-left: 0;
}

.compare-list li {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 14px;
}

.compare-list li strong {
    color: var(--accent-warm);
}

/* ---------- TOC on landing page ---------- */
.landing-toc {
    max-width: var(--max-width);
    margin: 0 auto 80px;
    padding: 0 24px;
}

.toc-list {
    list-style: none;
    max-width: 700px;
    margin: 0 auto;
    counter-reset: toc-counter;
}

.toc-list li {
    counter-increment: toc-counter;
    border-bottom: 1px solid var(--border-light);
}

.toc-list a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.toc-list a:hover {
    color: var(--accent);
}

.toc-list a::before {
    content: counter(toc-counter, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 28px;
}

.toc-list a span {
    font-size: 15px;
    font-weight: 500;
}

/* ---------- Lecturer info ---------- */
.lecturer-card {
    max-width: 480px;
    margin: 0 auto 60px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}

.lecturer-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-dim), #047857);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}

.lecturer-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.lecturer-card .lecturer-title {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 12px;
}

.lecturer-card .lecturer-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}