/*
Theme Name: Support Fremont Schools
Theme URI: https://supportfremontschools.com
Description: Custom theme for Support Fremont Schools - community advocacy for school funding initiatives
Author: Support Fremont Schools
Version: 1.1.0
License: GNU General Public License v2 or later
Text Domain: sfs-theme
*/

/* ============================================
   CSS Custom Properties (Color Palette)
   See brand/brandkit.md for the canonical palette.
   ============================================ */
:root {
    /* Primary — Support Fremont Schools purple (logo frame, YES, Support, Schools) */
    --sfs-primary: #7D1568;
    --sfs-primary-dark: #5A0E4B;
    --sfs-primary-light: #9B3989;

    /* Accent — warm orange (logo pencil, M, swoosh, Fremont) */
    --sfs-accent: #E36D23;
    --sfs-accent-dark: #B8541A;
    --sfs-accent-light: #F4A06A;

    /* Status (use sparingly; not part of the main palette) */
    --sfs-success: #2E7D32;
    --sfs-warning: #F9A825;

    /* Neutrals (warm) */
    --sfs-white: #FFFFFF;
    --sfs-off-white: #FAF7F5;
    --sfs-light-gray: #E5E0E2;
    --sfs-gray: #6B6770;
    --sfs-dark-gray: #3A3640;
    --sfs-text: #1B1820;

    /* Layout */
    --sfs-max-width: 1200px;
    --sfs-header-height: 80px;
    --sfs-border-radius: 6px;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--sfs-text);
    background-color: var(--sfs-white);
    line-height: 1.6;
}

a {
    color: var(--sfs-accent-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--sfs-primary);
}

/* Underline inline links inside long-form content for accessibility */
.single-post__content a,
.page-content a,
.post-card__excerpt a,
.card p a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--sfs-primary);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1em;
}

/* ============================================
   Layout Utilities
   ============================================ */
.container {
    max-width: var(--sfs-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 4rem 0;
}

.section--alt {
    background-color: var(--sfs-off-white);
}

.section--primary {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
}

.section--primary h2,
.section--primary h3 {
    color: var(--sfs-white);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: var(--sfs-border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn--primary {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
}

.btn--primary:hover {
    background-color: var(--sfs-primary-dark);
    color: var(--sfs-white);
}

/* Outlined purple — secondary action on light backgrounds.
   Uses inset box-shadow to avoid layout shift vs. solid buttons. */
.btn--secondary {
    background-color: transparent;
    color: var(--sfs-primary);
    box-shadow: inset 0 0 0 2px var(--sfs-primary);
}

.btn--secondary:hover {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
}

.btn--accent {
    background-color: var(--sfs-accent);
    color: var(--sfs-text);
}

.btn--accent:hover {
    background-color: var(--sfs-accent-dark);
    color: var(--sfs-white);
}

.btn:focus-visible {
    outline: 3px solid var(--sfs-accent);
    outline-offset: 2px;
}

.btn--outline {
    background-color: transparent;
    border: 2px solid var(--sfs-white);
    color: var(--sfs-white);
}

.btn--outline:hover {
    background-color: var(--sfs-white);
    color: var(--sfs-primary);
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--sfs-header-height);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sfs-white);
    font-size: 1.25rem;
    font-weight: 700;
}

.site-logo:hover {
    color: var(--sfs-white);
}

.site-logo img {
    height: 50px;
    width: auto;
}

/* Wordmark fallback when no custom logo is uploaded.
   Renders "Support Fremont Schools" in the brand's
   alternating-color pattern (see brand/brandkit.md). */
.site-logo__wordmark {
    display: inline-flex;
    gap: 0.35em;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.005em;
}

.site-logo__word {
    color: var(--sfs-white);
}

.site-logo__word--accent {
    color: var(--sfs-accent);
}

.site-logo:hover .site-logo__word {
    color: var(--sfs-accent-light);
}

.site-logo:hover .site-logo__word--accent {
    color: var(--sfs-white);
}

/* Main Navigation */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}

.main-nav a {
    color: var(--sfs-white);
    padding: 0.5rem 1rem;
    border-radius: var(--sfs-border-radius);
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.main-nav a:hover,
.main-nav .current-menu-item a {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--sfs-white);
}

/* Submenu (hover dropdown) — desktop default.
   Parent items get a caret; child <ul class="sub-menu"> floats below
   on hover or keyboard focus. Mobile rules below override this. */
.main-nav .menu-item-has-children {
    position: relative;
}

.main-nav .menu-item-has-children > a::after {
    content: "\25BE";
    margin-left: 0.35em;
    font-size: 0.75em;
    opacity: 0.85;
}

.main-nav .sub-menu {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--sfs-white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    border-radius: var(--sfs-border-radius);
    padding: 0.5rem;
    margin: 0;
    flex-direction: column;
    gap: 0.125rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 1001;
}

.main-nav .menu-item-has-children:hover > .sub-menu,
.main-nav .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-nav .sub-menu a {
    color: var(--sfs-text);
    padding: 0.5rem 0.75rem;
    display: block;
    white-space: nowrap;
    font-weight: 500;
}

.main-nav .sub-menu a:hover,
.main-nav .sub-menu a:focus {
    background-color: var(--sfs-off-white);
    color: var(--sfs-primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--sfs-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--sfs-primary) 0%, var(--sfs-primary-dark) 100%);
    color: var(--sfs-white);
    padding: 5rem 0;
    text-align: center;
}

.hero h1 {
    color: var(--sfs-white);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.hero .btn {
    margin: 0.5rem;
}

/* ============================================
   Info Cards Grid
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--sfs-white);
    border-radius: var(--sfs-border-radius);
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card__icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card h3 {
    margin-bottom: 0.75rem;
}

/* ============================================
   Posts / News Section
   ============================================ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.post-card {
    background: var(--sfs-white);
    border-radius: var(--sfs-border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.post-card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card__content {
    padding: 1.5rem;
}

.post-card__meta {
    font-size: 0.85rem;
    color: var(--sfs-gray);
    margin-bottom: 0.5rem;
}

.post-card__title {
    margin-bottom: 0.5rem;
}

.post-card__title a {
    color: var(--sfs-primary);
}

.post-card__title a:hover {
    color: var(--sfs-primary-light);
}

.post-card__excerpt {
    color: var(--sfs-dark-gray);
    font-size: 0.95rem;
}

/* ============================================
   Events
   ============================================ */
.event-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--sfs-light-gray);
}

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

.event-date {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
    border-radius: var(--sfs-border-radius);
    padding: 0.75rem 1rem;
    text-align: center;
    min-width: 80px;
    flex-shrink: 0;
}

.event-date__month {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.event-date__day {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.event-details h3 {
    margin-bottom: 0.25rem;
}

.event-details p {
    color: var(--sfs-gray);
    margin-bottom: 0;
}

/* ============================================
   CTA Section
   ============================================ */
.cta {
    background: linear-gradient(135deg, var(--sfs-primary-dark) 0%, var(--sfs-primary) 100%);
    color: var(--sfs-white);
    text-align: center;
    padding: 4rem 0;
}

.cta h2 {
    color: var(--sfs-white);
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background-color: var(--sfs-primary-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 3rem 0 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    color: var(--sfs-white);
    margin-bottom: 1rem;
}

/* Widget blocks (Archives, Categories, etc.) emit their own headings
   that bypass .footer-col h4. Force every heading inside the footer
   to white and to the column-header size, otherwise they inherit the
   global purple-on-purple-dark color and the oversized h2 default. */
.site-footer :is(h1, h2, h3, h4, h5, h6),
.site-footer .wp-block-heading {
    color: var(--sfs-white);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-col a:hover {
    color: var(--sfs-white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   WordPress Specific
   ============================================ */
.alignleft {
    float: left;
    margin: 0 1.5em 1em 0;
}

.alignright {
    float: right;
    margin: 0 0 1em 1.5em;
}

.aligncenter {
    display: block;
    margin: 0 auto 1em;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.85rem;
    color: var(--sfs-gray);
    text-align: center;
    padding-top: 0.5rem;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Single Post */
.single-post__header {
    padding: 3rem 0 1rem;
}

.single-post__meta {
    color: var(--sfs-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.single-post__content {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 3rem;
}

.single-post__content p {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Page Template */
.page-header {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    color: var(--sfs-white);
}

.page-content {
    padding: 3rem 0;
    max-width: 800px;
    margin: 0 auto;
}

/* Comments */
.comments-area {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0 3rem;
    border-top: 1px solid var(--sfs-light-gray);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--sfs-border-radius);
}

.pagination .current {
    background-color: var(--sfs-primary);
    color: var(--sfs-white);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: var(--sfs-header-height);
        left: 0;
        right: 0;
        background-color: var(--sfs-primary);
        padding: 1rem;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .main-nav.is-open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem 1rem;
    }

    /* On mobile, submenus always render inline (no hover on touch).
       Indent children visually and drop the caret since the dropdown
       affordance no longer applies. */
    .main-nav .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background-color: transparent;
        box-shadow: none;
        padding: 0 0 0 1rem;
        min-width: 0;
    }

    .main-nav .sub-menu a {
        color: var(--sfs-white);
    }

    .main-nav .sub-menu a:hover,
    .main-nav .sub-menu a:focus {
        background-color: rgba(255, 255, 255, 0.15);
        color: var(--sfs-white);
    }

    .main-nav .menu-item-has-children > a::after {
        content: "";
    }

    .hero h1 {
        font-size: 2rem;
    }

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

    .section {
        padding: 2.5rem 0;
    }

    .event-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .event-date {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
}
