/* ==========================================
   DIH BOOK STYLES - ELEGANT & MINIMALIST
   ========================================== */

/* Book-like color palette */
:root {
    --book-bg: #fdfdf8;          /* Cream paper */
    --book-text: #2a2a2a;        /* Soft black */
    --book-accent: #8b7355;      /* Leather brown */
    --book-border: #d4c5b9;      /* Subtle tan */
    --book-heading: #1a1a1a;     /* Deep charcoal */
    --book-light: #f9f8f3;       /* Light cream */
}

/* Base Typography - Book-like */
body {
    background-color: var(--book-bg);
    color: var(--book-text);
    font-family: 'EB Garamond', 'Garamond', 'Georgia', serif;
    font-size: 19px;
    line-height: 1.7;
}

/* Optimal reading measure (line length) */
main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Hero Banner - Elegant and Understated */
.hero-banner {
    background: linear-gradient(to bottom, var(--book-bg) 0%, var(--book-light) 100%);
    padding: 5rem 2rem 4rem 2rem;
    margin: -2rem -2rem 3rem -2rem;
    text-align: center;
    border-bottom: 1px solid var(--book-border);
}

.hero-banner h2 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: var(--book-heading);
    letter-spacing: -0.02em;
    font-family: 'Crimson Text', 'Baskerville', 'Georgia', serif;
}

.hero-banner p {
    font-size: 1.15rem;
    margin-bottom: 2rem;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
    color: var(--book-text);
}

/* Buttons - Understated */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    margin: 0.5rem;
    font-weight: 500;
    border-width: 1px;
    border-radius: 2px;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.btn-primary {
    background-color: var(--book-heading);
    border-color: var(--book-heading);
    color: var(--book-bg);
}

.btn-primary:hover {
    background-color: var(--book-accent);
    border-color: var(--book-accent);
    transform: translateY(-1px);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--book-heading);
    color: var(--book-heading);
}

.btn-outline-primary:hover {
    background-color: var(--book-heading);
    color: var(--book-bg);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--book-border);
    color: var(--book-text);
}

.btn-outline-secondary:hover {
    background-color: var(--book-light);
    border-color: var(--book-accent);
    color: var(--book-heading);
}

/* Cards - Minimal and Elegant */
.card {
    background-color: #fff;
    border: 1px solid var(--book-border);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--book-accent);
    box-shadow: 0 2px 12px rgba(139, 115, 85, 0.08);
}

.card h3 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--book-heading);
    border-bottom: 1px solid var(--book-border);
    padding-bottom: 0.75rem;
    font-family: 'Crimson Text', 'Baskerville', 'Georgia', serif;
}

/* Grid System Enhancement */
.grid {
    display: grid;
    gap: 2rem;
    margin: 2.5rem 0;
}

.g-col-12 {
    grid-column: span 12;
}

@media (min-width: 768px) {
    .g-col-md-4 {
        grid-column: span 4;
    }
    .g-col-md-6 {
        grid-column: span 6;
    }
}

/* ==========================================
   CALLOUTS - ELEGANT BOOK ANNOTATIONS
   ========================================== */

/* Base callout - minimal and elegant */
.callout {
    margin: 2.5rem 0;
    padding: 0;
    background-color: transparent;
    border: none;
    border-left: 3px solid var(--book-border);
    padding-left: 1.75rem;
    padding-right: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-radius: 0;
}

/* Callout header - minimal title styling */
.callout-header {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    margin-bottom: 0.75rem;
}

/* Hide the icon container completely */
.callout-icon-container {
    display: none;
}

/* Hide screen reader text */
.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Callout title - elegant typography */
.callout-title-container {
    font-family: 'Crimson Text', 'Baskerville', 'Georgia', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--book-heading);
    letter-spacing: -0.01em;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* Callout body - clean content area */
.callout-body-container,
.callout-body {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--book-text);
    line-height: 1.7;
}

/* Remove Bootstrap flex utilities styling */
.callout-header.d-flex {
    display: block !important;
}

.callout-header.align-content-center {
    align-content: normal !important;
}

.callout-title-container.flex-fill {
    flex: none !important;
}

/* Note callout - subtle monochrome gray */
div.callout-note.callout {
    border-left-color: #9a8a7a;
    background-color: transparent;
}

div.callout-note.callout .callout-title-container {
    color: #6b5d4f;
}

/* Warning callout - warm leather brown accent */
div.callout-warning.callout {
    border-left-color: var(--book-accent);
    background-color: transparent;
}

div.callout-warning.callout .callout-title-container {
    color: var(--book-accent);
}

/* Important callout - deeper brown accent */
div.callout-important.callout {
    border-left-color: #7a5a3a;
    background-color: transparent;
}

div.callout-important.callout .callout-title-container {
    color: #6b4e2e;
}

/* Tip/Info callout - medium monochrome gray */
div.callout-tip.callout,
div.callout.callout-style-default.callout-tip {
    border-left-color: #a89a8a;
    background-color: transparent;
}

div.callout-tip.callout .callout-title-container,
div.callout.callout-style-default.callout-tip .callout-title-container {
    color: #7a6d5f;
}

/* Override Bootstrap background colors on callout headers - keep transparent */
div.callout-tip.callout-style-default > .callout-header,
div.callout-note.callout > .callout-header,
div.callout-warning.callout > .callout-header,
div.callout-important.callout > .callout-header,
div.callout-caution.callout > .callout-header,
div.callout.callout-style-default > .callout-header {
    background-color: transparent !important;
}

/* Override Bootstrap background colors on callout bodies - keep transparent */
div.callout-tip.callout-style-default > .callout-body,
div.callout-note.callout > .callout-body,
div.callout-warning.callout > .callout-body,
div.callout-important.callout > .callout-body,
div.callout-caution.callout > .callout-body,
div.callout.callout-style-default > .callout-body {
    background-color: transparent !important;
}

/* Caution callout - darker monochrome */
div.callout-caution.callout {
    border-left-color: #6b5d4f;
    background-color: transparent;
}

div.callout-caution.callout .callout-title-container {
    color: #5a4d3f;
}

/* Default callout style - subtle tan */
div.callout-style-default.callout {
    border-left-color: var(--book-border);
}

div.callout-style-default.callout .callout-title-container {
    color: var(--book-heading);
}

/* Titled callouts - add subtle spacing */
.callout-titled .callout-body-container {
    margin-top: 0.5rem;
}

/* Remove any Bootstrap card-like styling */
.callout.callout-titled {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

/* Ensure lists inside callouts are properly styled */
.callout-body ol,
.callout-body ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.callout-body li {
    margin-bottom: 0.75rem;
}

.callout-body p {
    margin-bottom: 1rem;
}

.callout-body p:last-child {
    margin-bottom: 0;
}

/* Section Dividers - Minimal */
hr {
    border: none;
    border-top: 1px solid var(--book-border);
    margin: 3rem 0;
    opacity: 0.6;
}

/* Typography Enhancement - Book-like */
h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--book-heading);
    font-family: 'Crimson Text', 'Baskerville', 'Georgia', serif;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 400;
}

h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--book-border);
    padding-bottom: 0.5rem;
    margin-top: 3rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

/* Ensure bold text renders properly */
strong, b {
    font-weight: 600;
    color: var(--book-heading);
}

/* Paragraphs - Proper book spacing */
p {
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

/* Links - Understated */
a {
    color: var(--book-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--book-heading);
    border-bottom-color: var(--book-accent);
}

/* Navigation menu links - no underline on hover */
nav a,
nav a:hover,
.sidebar nav a,
.sidebar nav a:hover,
.quarto-sidebar nav a,
.quarto-sidebar nav a:hover,
.navbar-nav a,
.navbar-nav a:hover,
.nav-link,
.nav-link:hover {
    border-bottom: none !important;
}

/* Panel Tabset Enhancement - Minimal */
.panel-tabset .nav-tabs {
    border-bottom: 1px solid var(--book-border);
}

.panel-tabset .nav-link {
    border: 1px solid transparent;
    font-weight: 500;
    color: var(--book-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.panel-tabset .nav-link.active {
    background-color: var(--book-heading);
    color: var(--book-bg);
    border-color: var(--book-heading);
}

.panel-tabset .nav-link:hover:not(.active) {
    border-color: var(--book-border);
    background-color: var(--book-light);
    color: var(--book-heading);
}

/* Mermaid Diagram Enhancement */
.mermaid {
    text-align: center;
    margin: 3rem 0;
    padding: 2rem 0;
    background-color: #fff;
    border: 1px solid var(--book-border);
    border-radius: 2px;
}

/* Stats/Numbers Highlighting - Elegant */
.stat-number {
    font-size: 3rem;
    font-weight: 300;
    color: var(--book-heading);
    display: block;
    line-height: 1;
    font-family: 'Crimson Text', 'Baskerville', 'Georgia', serif;
}

.stat-label {
    font-size: 1rem;
    color: var(--book-accent);
    display: block;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Hero numbers - extra large impact numbers */
.stat-number-hero {
    font-size: 5rem;
    line-height: 1;
    display: block;
    margin: 2rem 0 0.5rem 0;
}

.stat-label-hero {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 2rem;
}

/* Mobile responsive hero numbers */
@media (max-width: 767px) {
    .stat-number-hero {
        font-size: 3rem;
    }

    .stat-label-hero {
        font-size: 1.2rem;
    }
}

/* Lists - Better spacing */
ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

/* Blockquotes - Classic book style */
blockquote {
    margin: 2rem 0;
    padding-left: 2rem;
    border-left: 3px solid var(--book-accent);
    font-style: italic;
    color: var(--book-text);
    opacity: 0.9;
}

/* Code blocks - Minimal */
pre, code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.9rem;
}

pre {
    background-color: var(--book-light);
    border: 1px solid var(--book-border);
    border-radius: 2px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
}

code {
    background-color: var(--book-light);
    padding: 0.2em 0.4em;
    border-radius: 2px;
    font-size: 0.9em;
}

/* Tables - Clean and readable */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 2rem 0;
    font-size: 0.95rem;
}

table thead {
    border-bottom: 2px solid var(--book-border);
}

table th {
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--book-heading);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--book-border);
}

table tbody tr:hover {
    background-color: var(--book-light);
}

/* ==========================================
   RESPONSIVE IMAGES
   ========================================== */

/* Responsive figure sizing */
.figure-img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
}

figure {
    max-width: 100%;
    overflow: hidden;
    margin: 2.5rem 0;
}

figcaption {
    font-size: 0.9rem;
    color: var(--book-accent);
    font-style: italic;
    margin-top: 0.75rem;
    text-align: center;
}

/* Quarto cell output images */
.cell-output-display img {
    max-width: 100%;
    height: auto;
}

/* Ensure all Quarto-generated content respects max-width */
.cell-output-display,
.cell-output-display > *,
.quarto-figure,
.quarto-figure > figure,
.column-page,
.column-body {
    max-width: 100%;
    overflow-x: auto;
}

/* Mobile-specific image constraints */
@media (max-width: 767px) {
    img,
    figure,
    .figure-img,
    .cell-output-display img,
    .quarto-figure img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Ensure containers don't force horizontal scroll */
    .cell-output-display,
    .quarto-figure,
    figure {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Reduce margins on mobile for better space usage */
    figure {
        margin: 1.5rem 0;
    }

    main {
        padding: 0 0.75rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure parent containers don't cause overflow */
    .quarto-container,
    .quarto-container > * {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Prevent horizontal scroll on body/html */
    body,
    html {
        overflow-x: hidden;
        max-width: 100%;
    }
}

/* ==========================================
   RESPONSIVE TABLES
   ========================================== */

@media (max-width: 767px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1.5rem 0;
    }

    table thead {
        display: table-header-group;
    }

    table tbody {
        display: table-row-group;
    }

    table tr {
        display: table-row;
    }

    table td,
    table th {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        min-width: 0;
        max-width: 100%;
        padding: 0.5rem 0.75rem;
    }
}

@media (min-width: 768px) {
    table {
        width: 100%;
        table-layout: auto;
        display: table;
    }

    table td,
    table th {
        white-space: normal;
    }
}

/* ==========================================
   BREADCRUMB NAVIGATION
   ========================================== */

/* Add space above breadcrumb navigation */
nav.quarto-page-breadcrumbs {
    margin-top: 10px;
}

/* Truncate breadcrumb items with ellipses */
nav.quarto-page-breadcrumbs ol.breadcrumb li a {
    display: inline-block;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive adjustment for smaller screens */
@media (max-width: 767px) {
    nav.quarto-page-breadcrumbs ol.breadcrumb li a {
        max-width: 150px;
    }
}

/* ==========================================
   HIDE ABSTRACT AND KEYWORDS
   ========================================== */

/* Hide abstract section */
.abstract {
    display: none;
}

/* Hide keywords section */
.keywords {
    display: none;
}


/* ==========================================
   MERMAID DIAGRAMS - BOOK AESTHETIC
   ========================================== */

:root {
    --mermaid-bg-color: #ffffff;
    --mermaid-node-bg-color: #fdfdf8;
    --mermaid-edge-color: #8b7355;
    --mermaid-border-color: #d4c5b9;
    --mermaid-node-fg-color: #2a2a2a;
    --mermaid-label-color: #2a2a2a;
    --mermaid-alt-bg-color: #f9f8f3;
    --mermaid-cluster-bg-color: #f5f4ef;
}



/* ==========================================
   PARAMETER LINKS - ACADEMIC PRESTIGE
   ========================================== */

/* All parameter values - sophisticated styling */
.parameter-link,
.parameter-definition {
    transition: all 0.2s ease;
    cursor: help;
}

/* Linked parameters (external sources and calculations) */
.parameter-link {
    text-decoration: none;
    position: relative;
}

.parameter-link:hover {
    color: #0d3a6b;
    border-bottom-color: #0d3a6b;
    border-bottom-style: solid;
}

/* Core definitions (no external source) */
.parameter-definition {
    color: #2c3e50;
    font-weight: 600;
    cursor: default;
}

.parameter-definition:hover {
    color: #1a1a1a;
    border-bottom-color: #8b7355;
    border-bottom-style: solid;
}

/* Peer-reviewed indicator (when shown inline) */
.parameter-link[title*="📊"],
.parameter-link[title*="Peer-reviewed"] {
    font-weight: 600;
}

/* Conservative estimate styling */
.parameter-link[title*="Conservative"],
.parameter-definition[title*="Conservative"] {
    font-style: normal;
}

/* Tooltip enhancement - make it more visible */
.parameter-link[title],
.parameter-definition[title] {
    position: relative;
}

/* Print styles - ensure parameters are clear */
@media print {
    .parameter-link,
    .parameter-definition {
        color: #000;
        border-bottom: none;
        font-weight: 600;
    }

    .parameter-link::after {
        content: " [" attr(href) "]";
        font-size: 0.8em;
        font-weight: normal;
    }
}