/* Styles for the excerpt page toggles */
.toggle-content {
  max-height: 0;
  overflow: hidden;
    background-color: #f9f9f9;
  transition: max-height 0.4s ease-in-out;
    border: 1px solid #ddd;
    /*padding: 15px;*/
    padding-left: 1em;

}

.arrow {
  border: solid black;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 4px;
  transition: transform 0.2s ease-in-out;
}

.arrow.down {
  transform: rotate(45deg);
}
.arrow.up {
  transform: rotate(-135deg);
}

/* General Body and Typography */
body {
    font-family: 'Georgia', 'Times New Roman', Times, serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #fdfdfd;
    color: #333;
}

main.site-main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
}

em {
    color: #835409;
    font-style: italic; /* Ensures em tags remain italic */
}

.content-section {
    margin-bottom: 40px;
}

.content-item {
    margin-bottom: 40px;
}

h1, h2, h3, h4, h5 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #111;
}

a {
    color: #0056b3;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

hr.style14 {
    border: 0;
    height: 1px;
    /* Fallback for very old browsers */
    background-color: #8c8b8b;
    /* Modern syntax with vendor prefix for older WebKit browsers */
    background-image: -webkit-linear-gradient(to right, #f0f0f0, #8c8b8b, #f0f0f0);
    /* Standard syntax */
    background-image: linear-gradient(to right, #f0f0f0, #8c8b8b, #f0f0f0);
}

/* Site Header */
.site-header {
    background-color: #fff;
    padding: 20px 40px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo-wrapper a {
    /* Ensures the link itself doesn't interfere with vertical alignment */
    display: flex;
    align-items: center;
}

.logo-image {
    width: 60px;
    height: 60px;
    margin-right: 20px;
}

.logo-title {
    font-size: 2em;
    font-weight: bold;
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 0.9em;
    color: #555;
}

/* Main Navigation */
.main-nav, .sub-nav {
    background-color: #333;
    overflow: hidden;
    position: relative;
}

.sub-nav {
    background-color: #f1f1f1;
}

.main-nav a, .sub-nav a {
    float: left;
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
}

.sub-nav a {
    color: black;
}

.main-nav a:hover, .sub-nav a:hover {
    background-color: #ddd;
    color: black;
    text-decoration: none;
}

.main-nav a.active {
    background-color: #555;
    color: white;
}

.sub-nav a.active {
    background-color: #ccc;
    color: black;
}

.main-nav .icon, .sub-nav .icon {
    display: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* Responsive Navigation Styles */
@media screen and (max-width: 768px) {
    /* Ensure nav bars have a minimum height and contain their floated icon.
     * `overflow: auto` creates a new block formatting context, which forces
     * the nav element to expand to contain the floated button inside it.
     * This is a more robust fix for the "collapsing container" issue than
     * min-height alone, especially on mobile browsers like Safari. */
    .main-nav, .sub-nav {
        min-height: 50px; /* A fallback for older browsers */
        overflow: auto;   /* The main fix for the collapsing height */
    }

    /* Adjust header for mobile */
    .site-header {
        padding: 15px; /* Reduce padding */
    }

    .logo-wrapper {
        flex-direction: column; /* Stack logo and text */
        align-items: center; /* Center them */
        width: 100%; /* Take full width */
        text-align: center; /* Center text */
    }

    .logo-image {
        margin-right: 0; /* Remove right margin */
        margin-bottom: 10px; /* Add bottom margin */
    }

    .logo-title {
        font-size: 1.8em; /* Slightly smaller title on mobile */
    }

    /* Adjust main content padding */
    main.site-main {
        padding: 0 15px;
        margin-top: 15px;
    }

    /* Adjust font sizes for readability */
    h2 { font-size: 1.6em; }
    h4 { font-size: 1.2em; }
    h5 { font-size: 1.0em; }

    /* --- RESPONSIVE NAVIGATION --- */

    /* Hide nav links by default */
    .main-nav a, .sub-nav a {
        display: none; /* Hide all links by default on small screens */
    }

    /* Style the hamburger button */
    .main-nav .icon, .sub-nav .icon {
        float: right;
        display: block;
        /* Safari-specific fix to ensure buttons can be styled correctly */
        -webkit-appearance: none;
        appearance: none;
        /* Ensure no default button background is rendered */
        background-color: transparent;
        padding: 10px;
        position: relative;
        width: 50px;
        height: 50px;
        box-sizing: border-box;
    }

    /* Style the new span elements into bars */
    .icon .bar {
        display: block;
        width: 25px;
        height: 3px;
        margin: 6px auto; /* Center the bars */
        transition: 0.4s;
        border-radius: 1px;
    }

    .main-nav .icon .bar {
        background-color: #f1f1f1; /* Light color for dark nav */
    }

    .sub-nav .icon .bar {
        background-color: #333; /* Dark color for light nav */
    }

    /* Styles for the expanded vertical menu */
    .main-nav.responsive, .sub-nav.responsive {
        position: relative;
    }

    .main-nav.responsive a, .sub-nav.responsive a {
        float: none;
        display: block;
        text-align: left;
    }

    .main-nav.responsive .icon, .sub-nav.responsive .icon {
        position: absolute;
        right: 0;
        top: 0;
    }

    /* Animate hamburger to "X" when menu is open */
    .responsive .icon .bar:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 9px);
    }
    .responsive .icon .bar:nth-child(2) {
        opacity: 0;
    }
    .responsive .icon .bar:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -9px);
    }
}

/* Distillments Page Styles */
.distillment-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.distillment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.distillment-header h4 {
    margin: 0;
    font-size: 1.4em;
}

.jump-to-top {
    font-size: 0.9em;
    padding: 3px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f0f0f0;
    color: #333;
}

.jump-to-top:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
    text-decoration: none;
}

.red-background, .green-background {
    border-left: 4px solid;
    padding: 10px 15px;
    margin: 15px 0;
    background-color: #f9f9f9;
}

.red-background {
    border-color: #d9534f; /* Red */
}

.green-background {
    border-color: #5cb85c; /* Green */
}

.red-background ul, .green-background ul {
    padding-left: 20px;
    margin: 0;
}

.display-linebreak p {
    margin-bottom: 1em;
}

/* Table of Contents on Distillments page */
.toc-links {
    line-height: 1.8;
    margin: 20px 0;
    text-align: center;
}

.toc-links a {
    margin: 0 5px;
}

/* Excerpt Page Toggler Styles */
.chapter, .subchapter {
    /*border-bottom: 1px solid #eee;*/
    /*margin-bottom: 10px;*/
    /*padding-bottom: 10px;*/
}

.subchapter {
    margin-left: 30px; /* Indent subchapters */
}

.toggle-header {
    display: flex;
    align-items: center;
    cursor: pointer; /* Makes the whole header area clickable */
    padding: 10px 0;
}

.toggle-header h3, .toggle-header h4 {
    margin: 0;
}


.toggler-btn {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    margin-left: 15px;
}


/* Controls for Expand/Collapse All */
.toggle-all-controls {
    text-align: right;
    margin: 15px 0;
}

.toggle-all-controls button {
    background-color: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 0.9em;
}

.toggle-all-controls button:hover {
    background-color: #e9e9e9;
}

/* Category Page Styles */
.category-container {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.category-container h3 {
    margin-top: 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    font-size: 1.5em;
    color: #333;
}

.allinline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 15px; /* vertical and horizontal gap between items */
}

.very-green-background {
    font-family: "Arial Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: smaller;
    font-weight: bold ;
    background-color: #e1eebb;
    color: #2F1D0977;
    padding: 0.2em 3px;
    height: 20px;
    max-width: 25%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.very-red-background {
    font-family: "Arial Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: smaller;
    font-weight: bold ;
    background-color: #f8d5c6;
    color: #0A070277;
    padding: 0.2em 3px;
    height: 20px;
    max-width: 25%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.discussion-quote {
  background-color: #FAFAF2FF;
  padding: 1px 1em 1px 2em;
  color:#425149;
}

.scrollable-content {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    margin-top: 1em;
}

/* New styles for the book purchase section */
.purchase-section {
    display: flex;
    justify-content: center; /* Center the items horizontally */
    align-items: flex-end;   /* Align items to the bottom */
    gap: 40px;               /* Space between the items */
    text-align: center;
    margin: 2em 0;
}

.purchase-item h5 {
    margin-bottom: 0.5em;
    font-size: 1em;
}

.purchase-item img {
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: transform 0.2s ease-in-out;
}

.purchase-item a:hover img {
    transform: scale(1.05);
}

/* For responsive embedded videos */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1em 0;
    border-radius: 4px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Utility for section footers */
.section-footer {
    text-align: right;
    margin-top: 1.5em;
}

/* For homepage taglines */
.tagline {
    font-size: 1.1em;
    font-weight: 500;
}