:root {
    --body-bg: #222222;
    --text-color: #afafaf;
    --other-color: #bca25c;
}

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

body {
    font-family: 'Noto Serif', serif;
    font-size: 18px;
    background-color: var(--body-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

header {
    padding: 2rem;
    position: relative;
    text-align: center;
}

.theme-switcher {
    position: absolute;
    left: 2rem;
    top: 2rem;
    width: 30px;
    height: 30px;
    overflow: hidden;
    cursor: pointer;
}

.theme-switcher img {
    width: 30px;
    height: 60px;
    transition: transform 0.3s ease;
}

.header-image {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.header-image img {
    max-width: 100%;  /* Will prevent image from overflowing on small screens */
    height: auto;     /* Maintains aspect ratio */
    width: auto;      /* Allow image to be its natural width */
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

nav ul li {
    position: relative; /* For positioning the dots */
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.4rem;
    transition: opacity 0.3s ease;
    font-family: 'Manjari', sans-serif;
}

/* Dots container */
.nav-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -0.2rem;
    height: 4px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-dot {
    width: 4px;
    height: 4px;
    background-color: var(--text-color);
    border-radius: 50%;
    opacity: 0;
}

nav ul li.active .nav-dots {
    opacity: 1; /* Keep dots visible for active item */
}

/* Optional: you might want to style the active link differently */
nav ul li.active a {
    color: #a4a878; /* Using your existing accent color */
}

/* Animation keyframes for each dot */
@keyframes dotFade1 {
    0%, 100% { opacity: 1; }
    33%, 66% { opacity: 0; }
}

@keyframes dotFade2 {
    0%, 100% { opacity: 0; }
    33% { opacity: 1; }
    66% { opacity: 0; }
}

@keyframes dotFade3 {
    0%, 100% { opacity: 0; }
    33% { opacity: 0; }
    66% { opacity: 1; }
}

nav a:hover {
    opacity: 0.7;
}

nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.4rem;
    transition: opacity 0.3s ease;
    font-family: 'Manjari', sans-serif;
}

/* Main and blocks */

main {
    flex: 1;
    padding: 2rem;
}

.blocks-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Top edge */
.blocks-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    border-left: 1px solid var(--box-border);
    border-right: 1px solid var(--box-border);
    border-top: 1px solid var(--box-border);
}

/* Bottom edge */
.blocks-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    border-left: 1px solid var(--box-border);
    border-right: 1px solid var(--box-border);
    border-bottom: 1px solid var(--box-border);
}

.block {
    margin-bottom: 3rem;
    padding: 1rem;
}

.block h2 {
    font-size: 44px;
    font-weight: 300;
    margin-bottom: 1rem;  /* Space between title and subtitle */
    line-height: 1.2;     /* Better readability for large text */
}

.block h3 {
    font-size: 28px;
    font-weight: 300;
    color: var(--sub-color);
    margin-bottom: 2rem;
    line-height: 1.3;
    position: relative;
    overflow: hidden;
}

.block h3 .date {
    color: #807356;
    float: right;
    font-size: 0.6em;
    font-style: italic;
    margin-left: 1rem;
    margin-top: 0.5rem;
}

.block .article-text {
    line-height: 1.5em;
    font-weight: 400;
    word-break: break-word;
  hyphens: auto;
}

.block img {
    max-width: 100%;
    height: auto;
}

.block .img-small {
    width: 25%;
}

.block .img-medium {
    width: 50%;
}

.block .img-large {
    width: 100%;
}

.block .float-left {
    float: left;
    margin: 0 1rem 1rem 0;
}

.block .float-right {
    float: right;
    margin: 0 0 1rem 1rem;
}

.block .align-center {
    display: block;
    margin: 1rem auto;
}

/* Clearfix for floated images */
.block::after {
    content: '';
    display: table;
    clear: both;
}
.block video {
    max-width: 100%;
    margin: 1rem 0;
}

.block audio {
    width: 100%;
    margin: 1rem 0;
}

footer {
    padding: 2rem;
    text-align: center;
}

.footer-content {
    display: flex;
    font-size: 0.8em;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: #5b7043;
}

a {
    color: #7b9163;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #c6ff84;
    text-decoration: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 3px solid var(--scrollbar-track);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Comments */

.comments-section {
    margin-top: 2rem;
    border-top: 1px solid var(--text-color);
    padding-top: 1rem;
}

.comments-toggle {
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    margin-bottom: 1rem;
}

.comments-toggle:hover {
    opacity: 1;
}

.comments-container {
    display: none;
}

.comments-container.active {
    display: block;
}

.comment {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--div-background);
    border-radius: 10px;
}

.comment-author {
    font-weight: 400;
    margin-bottom: 0.25rem;
    color: var(--other-color);
}

.comment-date {
    font-size: 0.8em;
    color: #807356;
    margin-bottom: 0.5rem;
}

.comment-content {
    line-height: 1.4;
}

.comment-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-form input,
.comment-form textarea {
    padding: 0.5rem;
    background: var(--body-bg);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: inherit;
}

.comment-form textarea {
    min-height: 100px;
    resize: vertical;
}

.comment-form button {
    align-self: flex-start;
    padding: 0.5rem 1rem;
    background: var(--div-background);
    color: var(--other-color);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.comment-form button:hover {
    opacity: 0.9;
    background: var(--element-bg);
}

/* Custom Bullet Lists */
.article-text ul {
    list-style: none;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.article-text ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-text ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 5px;
    height: 5px;
    background-color: var(--bullet-color);
    border-radius: 50%;
}

/* Into text*/

.intro-text {
    font-size: 16px;
}

/* Custom Video Player Styles */
.custom-video-player {
    position: relative;
    width: 100%;
    border-radius: 12px;
    background-color: #000;
}

.custom-video-player video {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.custom-video-player .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    padding: 10px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.custom-video-player .play-pause-btn,
.custom-video-player .fullscreen-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    fill: #acbeb4;
}

.custom-video-player .play-pause-btn {
    margin-right: 10px;
}

.custom-video-player .fullscreen-btn {
    margin-left: 10px;
}

.custom-video-player .progress-bar {
    flex-grow: 1;
    height: 5px;
    background-color: #5d524f;
    cursor: pointer;
    margin-right: 10px;
    position: relative;
}

.custom-video-player .progress {
    height: 100%;
    background-color: #629a94;
    width: 0;
    position: absolute;
    left: 0;
    top: 0;
}

.custom-video-player .time {
    font-size: 14px;
    color: #acbeb4;
    min-width: 100px;
    text-align: center;
}

.custom-video-player .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    z-index: 2;
    border-radius: 12px;
}

/* Fullscreen styles */
.custom-video-player:-webkit-full-screen {
    width: 100%;
    height: 100%;
}

.custom-video-player:-moz-full-screen {
    width: 100%;
    height: 100%;
}

.custom-video-player:-ms-fullscreen {
    width: 100%;
    height: 100%;
}

.custom-video-player:fullscreen {
    width: 100%;
    height: 100%;
}

.custom-video-player:fullscreen video {
    height: 100%;
}

/* Custom Audio Player Styles */
.custom-audio-player {
    display: flex;
    align-items: center;
    background-color: #222724;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    width: 100%;
}

.play-pause-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s ease;
}

.play-pause-btn:hover {
    transform: scale(1.1);
}

.play-pause-btn svg {
    width: 24px;
    height: 24px;
    fill: #acbeb4;
    transition: fill 0.3s ease;
}

.play-pause-btn:hover svg {
    fill: #629a94;
}

.progress-bar {
    flex-grow: 1;
    height: 5px;
    background-color: #4f5d55;
    border-radius: 5px;
    margin-right: 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden; /* Ensure progress stays within the bar */
}

.aprogress {
    height: 5px;
    background-color: #629a94;
    border-radius: 5px;
    width: 0;
    position: absolute;
    left: 0;
    top: 0;
}

.time {
    font-size: 12px;
    color: #acbeb4;
    min-width: 70px; /* Ensure consistent width for time display */
    text-align: right;
}

blockquote {
    position: relative;
    margin: 4rem 0;
    padding: 3rem 0;
    /* background: rgba(164, 168, 120, 0.05); */
    border-radius: 26px;
    font-style: italic;
}

blockquote .quote-content {
    position: relative;
    margin: 0 4rem;
    padding: 0 2rem;
}

/* Left bracket */
blockquote .quote-content::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: -0.5rem;
    bottom: -0.5rem;
    width: 2rem;
    border-left: 1px solid #a4a878;
    border-radius: 2rem 0 0 2rem;
}

/* Right bracket */
blockquote .quote-content::after {
    content: '';
    position: absolute;
    right: -2rem;
    top: -0.5rem;
    bottom: -0.5rem;
    width: 2rem;
    border-right: 1px solid #a4a878;
    border-radius: 0 2rem 2rem 0;
}

blockquote p {
    font-size: 1.1rem;
    line-height: 1.3;
    font-weight: 300;
    /* margin: 0; */
    padding-top: 1.6rem;
}

blockquote footer {
    font-size: 1rem;
    color: #a4a878;
    font-style: normal;
    text-align: right;
    font-style: italic;
}

/* Gallery */

/* Default (3x3) grid */
.gallery-container.gallery-grid-3 {
    display: grid;
    gap: 20px;
    margin: 2rem 0;
    grid-template-columns: repeat(3, 1fr);
}

/* 2x2 grid */
.gallery-container.gallery-grid-2 {
    display: grid;
    gap: 20px;
    margin: 2rem 0;
    grid-template-columns: repeat(2, 1fr);
}

.gallery-item {
    position: relative;
}

.image-wrapper {
    position: relative;
    padding-top: 133.33%; /* This creates a 3:4 aspect ratio */
    overflow: hidden;
    background: #0f0f0f; /* Dark background for letterboxing */
}

.image-wrapperw {
position: relative;
    overflow: hidden;
    background: var(--element-bg);
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* This ensures image fills the space without distortion */
}

.gallery-description {
    background: var(--element-bg);
    padding: 10px;
    overflow-y: auto;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
}

.gallery-description p {
    margin: 0;
    padding: 0;
}

.gallery-description p:first-child {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-color);
}

.gallery-description p:not(:first-child) {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--sub-color);
    line-height: 1.1;
}

/* Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border: 6px solid var(--modal-border);
    transform: scale(0.7);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Add clickable class to images that can be enlarged */
.block img:not(.non-modal) {
    cursor: pointer;
    transition: opacity 0.2s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.block img:not(.non-modal):hover {
    opacity: 0.9;
}

/* Add animation classes */
.zoom-in {
    animation: zoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.zoom-out {
    animation: zoomOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Full-Width Element Styles in Frontend */
.full-width {
    width: 100vw;
    background: var(--element-bg);
    margin: 0;
    margin-right: 0px;
    margin-left: 0px;
    padding: 0;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.full-width h1 {
    margin: 0;
    padding: 12px;
    color: var(--text-color);
    font-size: 2.4rem;
    text-align: center;
    font-weight: 300;
    margin-bottom: -1em;
  }


@keyframes zoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.7);
        opacity: 0;
    }
}

.audio-selection-block {
    margin: -2rem 0;
}

audioselection-div {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    width: 100%;
}

.audio-category {
    flex: 1;
    min-width: 120px; /* Minimum width for buttons */
    padding: 0.75rem 1rem;
    background: var(--element-bg);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.audio-category:hover,
.audio-category.active {
    background: var(--text-color);
    color: var(--body-bg);
}

.audioplaylist-div {
    margin-top: 1rem;
}

.audioplaylist-div p {
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-bottom: 1px solid var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Your existing player styles */
.play-button, .stop-button {
    display: inline-block;
    cursor: pointer;
    font-size: 16px;
}

.play-button::before {
    content: '▶';
}

.stop-button::before {
    content: '■';
}

@keyframes flashColor {
    0%, 100% { color: var(--text-color); }
    50% { color: #09E7FA; }
}

.flashing {
    animation: flashColor 1s infinite;
}

/* Scrollable image styles */
.scroll-image-wrapper {
    max-width: 800px;
    margin: 2rem auto;
}

.scroll-image-wrapper input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 800px;
    max-width: 100%;
    height: 2px;
    background: #000000;
    outline: none;
    border: none;
    padding: 0;
    margin: 20px 0;
}

/* Webkit (Chrome, Safari) */
.scroll-image-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}

/* Firefox */
.scroll-image-wrapper input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}

.scroll-image-wrapper input[type="range"]::-moz-range-track {
    background: #000000;
    height: 2px;
}

/* Edge/IE */
.scroll-image-wrapper input[type="range"]::-ms-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
}

.scroll-image-wrapper input[type="range"]::-ms-track {
    background: #000000;
    height: 2px;
}

.ai-ui-container {
    width: 800px;
    height: 700px;
    max-width: 100%;
    margin: 2rem auto;
    position: relative;
    background: var(--aiui-bgn);
    border: 1px solid var(--box-border);
    border-radius: 8px;
}

.ai-ui-container .reasoning-tree {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ai-ui-container .controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--aiui-cnt);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
    border: 1px solid var(--box-border);
}

.ai-ui-container .controls button {
    background: var(--aiui-btn);
    color: var(--body-bg);
    border: 1px solid #000000;
    padding: 5px 10px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.ai-ui-container .controls button:hover {
    opacity: 0.8;
}

/* Node styles */
.ai-ui-container .node {
    padding: 12px;
    background: var(--aiui-box);
    border: 1px solid var(--box-border);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 250px;
    transition: all 0.2s ease;
}

.ai-ui-container .node-main { 
    background: var(--div-background);
    border-color: var(--other-color);
}

.ai-ui-container .node-evidence { 
    background: var(--div-background);
    border-color: var(--sub-color);
}

.ai-ui-container .node-conclusion { 
    background: var(--div-background);
    border-color: var(--other-color);
}

.ai-ui-container .node-child { 
    background: var(--div-background);
    border-color: var(--box-border);
}

.ai-ui-container .node text {
    fill: var(--aiui-txt);
    font-family: inherit;
    font-size: 14px;
}

.ai-ui-container .edge {
    stroke: var(--box-border);
    stroke-width: 1.5px;
    transition: stroke 0.2s ease;
}

.ai-ui-container .confidence-label {
    fill: var(--text-color);
    font-size: 12px;
    font-family: inherit;
}

.ai-ui-container .node-main,
.ai-ui-container .node-evidence,
.ai-ui-container .node-conclusion,
.ai-ui-container .node-child,
.ai-ui-container .node-process { 
    background: var(--aiui-box);
}

/* Arrow marker style */
.ai-ui-container marker path {
    fill: var(--box-border);
    transition: fill 0.2s ease;
}

@media (max-width: 840px) {
    .ai-ui-container {
        width: 100%;
        height: 500px;
    }
    
    .ai-ui-container .controls {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 40px);
    }

    .ai-ui-container .controls button {
        flex: 1;
        min-width: calc(50% - 10px);
        margin: 0;
        text-align: center;
        white-space: nowrap;
    }
}


@media (max-width: 480px) {
    .ai-ui-container {
        height: 400px;
    }

    .ai-ui-container .controls {
        max-width: 160px;
    }

    .ai-ui-container .controls button {
        padding: 3px 6px;
        font-size: 11px;
    }
}


/* Responsive breakpoints */
@media (max-width: 1024px) {
    .gallery-container.gallery-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .gallery-container.gallery-grid-3,
    .gallery-container.gallery-grid-2 {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 768px) {

    body {
        font-family: 'Noto Serif', serif;
        font-size: 16px;
        background-color: var(--body-bg);
        color: var(--text-color);
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .block h2 {
        font-size: 32px;  /* Smaller title on mobile */
    }

    .block h3 {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .block h3 .date {
        color: #807356;
        float: right;
        font-size: 0.6em;  /* Made smaller from 0.8em */
        font-style: italic;
        margin-left: 0rem;
        margin-top: 0.5rem;  /* Added to vertically align with subtitle */
    }
    
    blockquote {
        margin: 3rem 0;
        padding: 2rem 0;
    }
    
    blockquote .quote-content {
        margin: 0 2.5rem;
        padding: 0 1rem;
    }
    
    blockquote .quote-content::before,
    blockquote .quote-content::after {
        width: 1.5rem;
    }
    
    blockquote p {
        font-size: 1.2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
}