/*
 * Light CMS Custom Styles
 * Edit this file to customize the appearance of your published site
 */

/* === Font Size Override === */
/* Override Pico CSS responsive font sizing for a smaller base size */
:root {
    --pico-font-size: 87.5%; /* 14px base (87.5% of 16px) */
}

/* Desktop font sizes - gradually increase but stay smaller than default */
@media (min-width: 576px) {
    :root {
        --pico-font-size: 87.5%; /* ~14px */
    }
}

@media (min-width: 768px) {
    :root {
        --pico-font-size: 93.75%; /* ~15px */
    }
}

@media (min-width: 1024px) {
    :root {
        --pico-font-size: 93.75%; /* ~15px */
    }
}

@media (min-width: 1280px) {
    :root {
        --pico-font-size: 100%; /* 16px */
    }
}

@media (min-width: 1536px) {
    :root {
        --pico-font-size: 100%; /* 16px */
    }
}

/* === Header Image (Page Content) === */
.header-image-wrapper {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}

.header-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    object-position: center;
    display: block;
}

@media (max-width: 768px) {
    .header-image-wrapper,
    .header-image {
        max-height: 250px;
    }
}

/* Full-width header image */
.header-image-wrapper.header-image-full {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
}

/* === Layout === */
html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 2rem;
    flex: 1 0 auto;
    background: transparent;
}

/* === Site Header (Sticky) === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--pico-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding: 0 0 1rem 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-header h1 {
    margin-bottom: 0.5rem;
    margin-top: 0;
    text-align: center;
}

/* === Site Logo === */
.site-logo-link {
    display: block;
    line-height: 0;
    margin-bottom: 0.5rem;
    text-align: center;
}

.site-logo {
    max-height: 96px;
    width: auto;
    display: inline-block;
    object-fit: contain;
}

.site-header h1 a {
    text-decoration: none;
    color: inherit;
}

.site-header h1 a:hover {
    color: inherit;
    opacity: 0.8;
}

.site-subtitle {
    margin: 0;
    margin-top: -0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--pico-muted-color);
    font-weight: normal;
    text-align: center;
}

/* === Nav Row (nav + search inline) === */
.nav-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* === Main Navigation === */
.site-header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.site-header nav li {
    margin: 0;
}

/* Capture --pico-color on nav (non-anchor) before Pico redefines it on <a> elements */
.site-header nav {
    --nav-text-color: var(--pico-color);
}

/* Navigation Links - Button Style */
.site-header nav a {
    display: inline-block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0.375rem;
    background: var(--pico-muted-border-color);
    color: var(--nav-text-color) !important;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: normal;
}

.site-header nav a:hover {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    text-decoration: none;
}

/* === Mobile Menu Toggle === */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    width: 40px;
    height: 36px;
    position: relative;
    padding: 0;
}

.menu-toggle-icon {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--pico-color) !important;
    border-radius: 1px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.2s ease;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--pico-color) !important;
    border-radius: 1px;
    position: absolute;
    left: 0;
    transition: transform 0.2s ease, top 0.2s ease;
}

.menu-toggle-icon::before {
    top: -6px;
}

.menu-toggle-icon::after {
    top: 6px;
}

/* Animate to X when open */
.menu-toggle[aria-expanded="true"] .menu-toggle-icon {
    background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

/* === Site Search === */
.search-wrapper {
    position: relative;
    margin-left: auto;
}

.search-input {
    width: 100%;
    max-width: 260px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--theme-accent);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    /* --theme-background is our own variable; Pico cannot override it at the element level */
    background: var(--theme-background) !important;
    color: var(--pico-color);
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: var(--theme-accent);
}

.search-input::placeholder {
    color: var(--pico-muted-color);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    min-width: 320px;
    max-width: 420px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 200;
    margin-top: 0.25rem;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--pico-muted-border-color);
    transition: background 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--pico-muted-border-color);
    text-decoration: none;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--pico-color);
    margin-bottom: 0.2rem;
}

.search-result-excerpt {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    line-height: 1.4;
}

.search-no-results {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

@media (max-width: 768px) {
    .search-input {
        /* stretch to fill remaining space beside the hamburger */
        max-width: 100%;
    }

    .search-results {
        right: 0;
        left: auto;
        min-width: 0;
        max-width: calc(100vw - 2rem);
    }
}

/* === Breadcrumbs === */
.site-header .breadcrumbs {
    margin-top: 0.75rem;
    margin-bottom: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--pico-muted-border-color);
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.breadcrumbs a {
    text-decoration: none;
    color: var(--pico-muted-color);
}

.breadcrumbs a:hover {
    color: var(--pico-primary);
    text-decoration: none;
}

/* === Main Content Layout === */
main.has-sidebar {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 2rem;
    align-items: start;
}

.main-content {
    min-width: 0; /* Prevents grid blowout */
    order: 1;
}

/* === Sidebar === */
.sidebar {
    position: sticky;
    top: 20px;
    order: 2;
}

/* === Section Navigation (in sidebar) === */
.section-nav {
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.section-nav h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 1rem;
    font-weight: 600;
}

.section-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.section-nav li {
    margin: 0;
}

/* Section Navigation Links */
.section-nav a,
.section-nav a:link,
.section-nav a:visited,
.section-nav a:hover,
.section-nav a:active,
.section-nav a:focus {
    display: block;
    padding: 0.4rem 0;
    --pico-text-decoration: none;
    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    text-decoration-line: none !important;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: color 0.2s ease, font-weight 0.2s ease;
}

.section-nav a,
.section-nav a:link,
.section-nav a:visited {
    color: var(--pico-muted-color);
    font-weight: normal;
}

.section-nav a:hover,
.section-nav a:focus,
.section-nav a:active {
    color: var(--pico-color);
    font-weight: 600;
}

/* === Links === */
/* Remove underlines from all links, use color change on hover */
a {
    text-decoration: none;
    color: var(--pico-primary);
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--pico-primary-hover);
    text-decoration: none;
}

/* Content area links should be distinguishable */
.content a {
    color: var(--pico-primary);
    font-weight: 500;
}

.content a:hover {
    color: var(--pico-primary-hover);
}

/* === Article Content === */
article {
    margin-bottom: 3rem;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.content {
    background: transparent;
}

.main-content {
    background: transparent;
}

/* === Code Blocks === */
pre {
    background: var(--pico-code-background-color);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

code {
    background: var(--pico-code-background-color);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

pre code {
    background: none;
    padding: 0;
}

/* === Content Sections === */
/* Use these classes with <div> in markdown for colored backgrounds */
.section {
    padding: 2rem;
    margin-left: -1rem;
    margin-right: -1rem;
    overflow: auto;
}

.section > *:first-child {
    margin-top: 0;
}

.section > *:last-child {
    margin-bottom: 0;
}

/* Dark backgrounds - light text */
.section-primary {
    background: var(--pico-primary-background);
}

.section-primary,
.section-primary h1, .section-primary h2, .section-primary h3,
.section-primary h4, .section-primary h5, .section-primary h6,
.section-primary p, .section-primary li, .section-primary span,
.section-primary strong, .section-primary em, .section-primary blockquote,
.section-primary td, .section-primary th, .section-primary label,
.section-primary small, .section-primary code {
    color: #fff !important;
}

.section-primary a {
    color: #fff !important;
    text-decoration: underline;
}

.section-secondary {
    background: var(--pico-secondary-background);
}

.section-secondary,
.section-secondary h1, .section-secondary h2, .section-secondary h3,
.section-secondary h4, .section-secondary h5, .section-secondary h6,
.section-secondary p, .section-secondary li, .section-secondary span,
.section-secondary strong, .section-secondary em, .section-secondary blockquote,
.section-secondary td, .section-secondary th, .section-secondary label,
.section-secondary small, .section-secondary code {
    color: #fff !important;
}

.section-secondary a {
    color: #fff !important;
    text-decoration: underline;
}

.section-dark {
    background: #1a1a2e;
}

.section-dark,
.section-dark h1, .section-dark h2, .section-dark h3,
.section-dark h4, .section-dark h5, .section-dark h6,
.section-dark p, .section-dark li, .section-dark span,
.section-dark strong, .section-dark em, .section-dark blockquote,
.section-dark td, .section-dark th, .section-dark label,
.section-dark small, .section-dark code {
    color: #f0f0f0;
}

.section-dark a {
    color: #8ab4f8;
}

.section-accent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.section-accent,
.section-accent h1, .section-accent h2, .section-accent h3,
.section-accent h4, .section-accent h5, .section-accent h6,
.section-accent p, .section-accent li, .section-accent span,
.section-accent strong, .section-accent em, .section-accent blockquote,
.section-accent td, .section-accent th, .section-accent label,
.section-accent small, .section-accent code {
    color: #ffffff;
}

.section-accent a {
    color: #ffffff;
    text-decoration: underline;
}

/* Light backgrounds - dark text */
.section-light {
    background: #f8f9fa;
}

.section-light,
.section-light h1, .section-light h2, .section-light h3,
.section-light h4, .section-light h5, .section-light h6,
.section-light p, .section-light li, .section-light span,
.section-light strong, .section-light em, .section-light blockquote,
.section-light td, .section-light th, .section-light label,
.section-light small, .section-light code {
    color: #1a1a1a;
}

.section-light a {
    color: var(--pico-primary);
}

.section-muted {
    background: var(--pico-muted-border-color);
}

.section-muted,
.section-muted h1, .section-muted h2, .section-muted h3,
.section-muted h4, .section-muted h5, .section-muted h6,
.section-muted p, .section-muted li, .section-muted span,
.section-muted strong, .section-muted em, .section-muted blockquote,
.section-muted td, .section-muted th, .section-muted label,
.section-muted small, .section-muted code {
    color: var(--pico-color);
}
.section-muted h1, .section-muted h2, .section-muted h3,
.section-muted h4, .section-muted h5, .section-muted h6 {
    color: var(--pico-h1-color);
}

.section-muted a {
    color: var(--pico-primary);
}

/* Full-width sections (break out of container) */
.section-full {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50% + 1rem);
    padding-right: calc(50vw - 50% + 1rem);
}

@media (max-width: 768px) {
    .section {
        padding: 1.5rem 1rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .section-full {
        padding-left: calc(50vw - 50% + 0.5rem);
        padding-right: calc(50vw - 50% + 0.5rem);
    }
}

/* === Landing Page Utilities === */

/* Hero section - large centered text area */
.hero {
    text-align: center;
    padding: 3rem 1rem;
}

.hero h1,
.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .hero h1,
    .hero h2 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1.1rem;
    }
}

/* Large CTA button */
.btn-large {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    background: var(--pico-primary-background);
    color: #fff !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
    color: #fff !important;
    text-decoration: none;
}

/* Secondary button variant */
.btn-secondary {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    background: transparent;
    color: var(--pico-primary) !important;
    border: 2px solid var(--pico-primary);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--pico-primary-background);
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Card grid - responsive auto-fill */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Individual card */
.card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    background: var(--pico-background-color);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card h3,
.card h4 {
    margin-top: 0;
}

.card > *:last-child {
    margin-bottom: 0;
}

/* Text utilities */
.text-center {
    text-align: center;
}

.text-large {
    font-size: 1.25rem;
}

/* Image utilities */
.img-circle {
    border-radius: 50%;
    object-fit: cover;
}

.img-shadow {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* === Video Embed === */
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
}

.video-embed iframe,
.video-embed video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-embed-4x3 {
    aspect-ratio: 4 / 3;
}

/* === Footer === */
footer {
    width: 100%;
    flex-shrink: 0;
    border-top: 1px solid var(--pico-muted-border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--pico-muted-color);
    font-size: 0.85rem;
    background: var(--pico-background-color);
}

footer .footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

footer p {
    margin: 0;
}

/* === Responsive Design === */
@media (max-width: 1024px) {
    /* Stack sidebar below content on tablets and mobile */
    main.has-sidebar {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
    }

    .section-nav h2 {
        font-size: 0.95rem;
    }

    .section-nav a {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 10px;
    }

    .container {
        max-width: 100%;
        padding: 10px;
        padding-top: 1.5rem;
    }

    /* Mobile hamburger button */
    .menu-toggle {
        display: block;
    }

    /* Mobile side drawer overlay */
    .site-header nav {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: var(--pico-background-color);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    .site-header nav.menu-open {
        left: 0;
    }

    /* Drawer header area */
    .site-header nav::before {
        content: 'Menu';
        display: block;
        padding: 1.25rem 1.25rem 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--pico-muted-color);
        border-bottom: 1px solid var(--pico-muted-border-color);
        margin-bottom: 0.5rem;
    }

    .site-header nav ul {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 0;
        margin: 0;
    }

    .site-header nav li {
        margin: 0;
    }

    .site-header nav a {
        display: block !important;
        padding: 0.75rem 1.25rem !important;
        font-size: 0.95rem;
        background: none !important;
        border-radius: 0 !important;
        color: var(--nav-text-color) !important;
        border-left: 3px solid transparent;
        transition: background 0.15s ease, border-color 0.15s ease;
        text-align: left;
    }

    .site-header nav a:hover,
    .site-header nav a:focus {
        background: var(--pico-muted-border-color) !important;
        border-left-color: var(--pico-primary);
        color: var(--pico-primary) !important;
    }

    /* Backdrop overlay when menu is open */
    .menu-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .menu-backdrop.visible {
        display: block;
    }

    .site-header .breadcrumbs {
        font-size: 0.8rem;
    }

    footer {
        padding: 1.5rem 10px;
        font-size: 0.8rem;
    }
}
