/* Color Palette Variables */
:root {
    --deep-navy: #1F3A5F;
    --muted-teak: #4F7C7A;
    --warm-light-gray: #F4F3F0;
    --white: #FFFFFF;
    --charcoal: #2B2B2B;
    --soft-gold: #C9A85C;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--charcoal);
    background-color: var(--warm-light-gray);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background-color: var(--deep-navy);
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-title {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--soft-gold);
    text-decoration: none;
    border-bottom: 2px solid var(--soft-gold);
}

/* Nav Dropdowns (News / Audience / About) */
.nav-menu li.has-dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: '\25BE';
    margin-left: 0.35em;
    font-size: 0.7em;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;
    background-color: var(--deep-navy);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 200;
}

.nav-menu li.has-dropdown:hover .dropdown-menu,
.nav-menu li.has-dropdown.open .dropdown-menu,
.nav-menu li.has-dropdown:focus-within .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    display: block;
    padding: 0.6rem 1.25rem;
    white-space: nowrap;
    border-bottom: none;
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    border-bottom: none;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Mobile hamburger menu toggle + backdrop (sidebar nav lives in the
   max-width: 768px media query below; hidden on desktop here). */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 36px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 310;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background-color: var(--white);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 290;
}

.nav-overlay.open {
    display: block;
}

/* Main Content */
main {
    width: calc(100% - 4in);
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
}

.content-card {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

/* Typography */
h1 {
    color: var(--deep-navy);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.2;
}

h2 {
    color: var(--deep-navy);
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

h3 {
    color: var(--deep-navy);
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

p {
    margin-bottom: 1rem;
    text-align: center;
}

a {
    color: var(--muted-teak);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--deep-navy);
    text-decoration: underline;
}

/* Highlight Box */
.highlight-box {
    background-color: var(--warm-light-gray);
    border-left: 4px solid var(--soft-gold);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.highlight-box h3 {
    margin-top: 0;
    text-align: left;
}

.highlight-box p,
.highlight-box ul {
    text-align: left;
}

.highlight-box ul {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.highlight-box li {
    margin-bottom: 0.5rem;
}

/* Article Previews */
.article-preview {
    border-bottom: 1px solid var(--warm-light-gray);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.article-preview:last-of-type {
    border-bottom: none;
}

.article-preview h2 {
    text-align: left;
    margin-top: 0;
}

.article-preview h2 a {
    color: var(--deep-navy);
    text-decoration: none;
}

.article-preview p {
    text-align: left;
}

.article-meta {
    color: var(--muted-teak);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 0.75rem;
}

.article-subtitle {
    color: var(--charcoal);
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Article Audience Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.article-tag {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.02em;
}

.article-tag-parents {
    background-color: var(--soft-gold);
}

.article-tag-students {
    background-color: var(--muted-teak);
}

.article-tag-teachers {
    background-color: var(--deep-navy);
}

/* Articles Sidebar Directory (collapsible browse-by-audience tag filter) */
.articles-layout {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

/* Extra breathing room around the article list itself, separate from the
   sitewide `main` margin and the sidebar's own width. */
.articles-main {
    flex: 1;
    min-width: 0;
    padding: 0 3in;
}

@media (max-width: 1100px) {
    .articles-main {
        padding: 0 1in;
    }
}

.articles-sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 1.5rem;
    background-color: var(--warm-light-gray);
    border-radius: 8px;
    padding: 1.25rem;
    transition: flex-basis 0.2s ease, padding 0.2s ease;
}

.articles-sidebar.collapsed {
    flex-basis: 48px;
    padding: 1.25rem 0.5rem;
    overflow: hidden;
}

.articles-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.articles-sidebar-title {
    text-align: left;
    font-size: 1.1rem;
    color: var(--deep-navy);
    white-space: nowrap;
}

.articles-sidebar.collapsed .articles-sidebar-title,
.articles-sidebar.collapsed .articles-sidebar-body {
    display: none;
}

.sidebar-collapse-btn {
    flex: 0 0 auto;
    background: none;
    border: 1px solid var(--muted-teak);
    border-radius: 4px;
    color: var(--deep-navy);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.35rem 0.55rem;
}

.sidebar-collapse-btn:hover {
    background-color: var(--white);
}

.tag-directory-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    border-bottom: 1px solid #e0dcd0;
    padding: 0.75rem 0.25rem;
    cursor: pointer;
    text-align: left;
    color: var(--charcoal);
    font-size: 0.95rem;
    border-radius: 4px;
}

.tag-directory-item:last-child {
    border-bottom: none;
}

.tag-directory-item:hover {
    background-color: var(--white);
}

.tag-directory-item.active {
    background-color: var(--deep-navy);
    color: var(--white);
}

.tag-directory-item.active .tag-directory-count {
    color: var(--soft-gold);
}

.tag-directory-count {
    margin-left: auto;
    color: var(--muted-teak);
    font-size: 0.85rem;
    font-weight: 600;
}

.articles-empty-message {
    padding: 1rem 0;
    color: var(--muted-teak);
    font-style: italic;
    text-align: left;
}

.read-more {
    display: inline-block;
    color: var(--muted-teak);
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Article Content Styles */
.article-content {
    margin-top: 2rem;
}

.article-content h2 {
    text-align: left;
    font-size: 1.55rem;
    margin-top: 2.5rem;
}

.article-content h3 {
    text-align: left;
    margin-top: 2rem;
}

.article-content p {
    text-align: left;
    margin-bottom: 1.5rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-content ul,
.article-content ol {
    text-align: left;
    margin: 1rem 0 1.5rem 2rem;
    line-height: 1.8;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--muted-teak);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--charcoal);
}

.article-content code {
    background-color: var(--warm-light-gray);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background-color: var(--warm-light-gray);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content a {
    color: var(--muted-teak);
    text-decoration: underline;
}

.article-content a:hover {
    color: var(--deep-navy);
}

/* Contact Form */
.contact-form {
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--deep-navy);
    font-weight: 600;
    text-align: left;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--warm-light-gray);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--charcoal);
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--muted-teak);
}

.submit-btn {
    background-color: var(--deep-navy);
    color: var(--white);
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.submit-btn:hover {
    background-color: var(--muted-teak);
}

/* Footer */
footer {
    background-color: var(--deep-navy);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: 4rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    .site-title {
        margin-bottom: 0;
        text-align: left;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: min(80vw, 300px);
        height: 100vh;
        margin: 0;
        gap: 0;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        background-color: var(--deep-navy);
        box-shadow: -4px 0 16px rgba(0,0,0,0.35);
        padding: 4.5rem 1.5rem 2rem;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 300;
    }
    
    .nav-menu.open {
        transform: translateX(0);
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        padding: 0.85rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }
    
    .nav-menu a:hover,
    .nav-menu a.active {
        border-bottom: 1px solid var(--soft-gold);
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.15);
        min-width: 0;
        text-align: left;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .content-card {
        padding: 1.5rem;
    }
    
    main {
        width: calc(100% - 0.0625in);
        margin: 1rem auto;
    }
    
    .articles-layout {
        flex-direction: column;
    }
    
    .articles-sidebar {
        flex: 1 1 auto;
        width: 100%;
        position: static;
    }
    
    .articles-main {
        padding: 0;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        width: min(85vw, 280px);
        font-size: 0.95rem;
    }
    
    .site-title {
        font-size: 1.25rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .content-card {
        padding: 1.25rem;
    }
}

/* File Viewers - Images, PDFs, Videos */
.article-content figure {
    margin: 2rem 0;
}

.article-content figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.article-content figure img:hover {
    transform: scale(1.02);
}

.article-content figure figcaption {
    text-align: center;
    margin-top: 0.75rem;
    color: var(--muted-teak);
    font-size: 0.9rem;
    font-style: italic;
}

/* PDF Viewer */
.article-content iframe {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    min-height: 600px;
}

/* Video Player */
.article-content video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Attachment Display (for other files) */
.article-content .section-attachments-display {
    margin: 1.5rem 0;
}

.article-content .attachment-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: background-color 0.2s ease;
}

.article-content .attachment-item:hover {
    background: #f0f0f0;
}

.article-content .attachment-item .attachment-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.article-content .attachment-item .attachment-content {
    flex: 1;
}

.article-content .attachment-item a {
    color: var(--primary-teak);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.article-content .attachment-item a:hover {
    color: var(--deep-navy);
    text-decoration: underline;
}

/* Responsive adjustments for viewers */
@media (max-width: 768px) {
    .article-content iframe {
        min-height: 400px;
    }
}

/* Sources Directory Tree */
.file-tree,
.file-tree ul {
    list-style: none;
    margin: 0;
    padding-left: 1.25rem;
}

.file-tree {
    padding-left: 0;
}

.file-tree li {
    position: relative;
    margin: 0.4rem 0;
}

.file-tree li::before {
    content: "";
    position: absolute;
    top: 0.9rem;
    left: -0.9rem;
    width: 0.7rem;
    border-top: 1px dashed #c9c3b8;
}

.file-tree ul li::after {
    content: "";
    position: absolute;
    top: -0.4rem;
    left: -0.9rem;
    bottom: 0.9rem;
    border-left: 1px dashed #c9c3b8;
}

.file-tree > li::before,
.file-tree > li::after {
    display: none;
}

.file-tree-label {
    font-weight: 600;
    color: var(--deep-navy);
}

.file-tree-label a {
    color: var(--deep-navy);
    text-decoration: none;
}

.file-tree-label a:hover {
    text-decoration: underline;
    color: var(--muted-teak);
}

.file-tree-file a {
    color: var(--primary-teak, var(--muted-teak));
    text-decoration: none;
    font-weight: 500;
}

.file-tree-file a:hover {
    text-decoration: underline;
}

.file-tree-file .file-size {
    color: var(--muted-teak);
    font-size: 0.85rem;
}
