/* ==========================================================================
   Columbia Cascade Section — USPSA Area 1
   Single stylesheet. Visual language ported from the original WordPress site
   (Twenty Sixteen parent theme + "Twenty Sixteen With Slider" child theme):
   Merriweather body / Montserrat headings, a white rounded content card on a
   gravel texture, and the #007acc Twenty Sixteen accent.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400&family=Montserrat:wght@400;500;700&display=swap');

:root {
    --text: #1a1a1a;
    --muted: #595959;
    --accent: #007acc;
    --accent-dark: #005c99;
    --border: #d1d1d1;
    --card: #ffffff;
    --bg: #e8eaed;
    --serif: "Merriweather", Georgia, serif;
    --sans: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background-color: var(--bg);
}

/* Skip to main content — hidden until focused */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1em;
    z-index: 100;
    background: var(--accent);
    color: #fff;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.5em 1em;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    transition: top 0.1s;
}
.skip-link:focus { top: 0; }

/* The centered white "card" */
.site {
    max-width: 1100px;
    margin: 2.5em auto;
    background-color: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* --- Header / branding --------------------------------------------------- */
.site-header {
    padding: 1.5em 5.5% 0;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 1.1em;
    padding-bottom: 0.75em;
}

.site-logo img {
    display: block;
    width: 156px;
    height: auto;
}

.site-title {
    font-family: var(--sans);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.site-title a {
    color: var(--text);
    text-decoration: none;
}

.site-title a:hover { color: var(--accent); }
.site-title a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.site-description {
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--muted);
    margin-top: 0.25em;
}

/* --- Navigation ---------------------------------------------------------- */
.main-navigation {
    border-top: 1px solid #e5e5e5;
    font-family: var(--sans);
}

.primary-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.primary-menu li { position: relative; }

.primary-menu a {
    display: block;
    padding: 0.9em 1.1em;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.primary-menu > li > a:hover,
.primary-menu a.current {
    color: var(--accent);
    box-shadow: inset 0 -3px 0 var(--accent);
}

.primary-menu a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.primary-menu .menu-item-has-children.current > a { color: var(--accent); }

/* Dropdown sub-menus */
.sub-menu {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--card);
    border: 1px solid #e5e5e5;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
}

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

.sub-menu a {
    padding: 0.7em 1.1em;
    font-size: 0.85rem;
    font-weight: 400;
    white-space: nowrap;
}

.sub-menu a:hover { color: var(--accent); box-shadow: none; background: #f7f7f7; }

/* Mobile menu toggle (hidden on desktop) */
.menu-toggle, .menu-toggle-checkbox { display: none; }

/* --- Main content -------------------------------------------------------- */
.site-content {
    padding: 2em 5.5% 1em;
}

.page-title {
    font-family: var(--sans);
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 0.8em;
}

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

.page-content p { margin: 0 0 1.4em; }

.page-content h1, .page-content h2,
.page-content h3, .page-content h4 {
    font-family: var(--sans);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin: 1.6em 0 0.6em;
}

.page-content h2 { font-size: 1.5rem; }
.page-content h3 { font-size: 1.15rem; }
.page-content h4 { font-size: 1.02rem; }

.page-content a { color: var(--accent); text-decoration: none; }
.page-content a:hover { color: var(--accent-dark); text-decoration: underline; }
.page-content a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.page-content ul, .page-content ol { margin: 0 0 1.4em 1.4em; }
.page-content li { margin-bottom: 0.5em; }
.page-content li > ul, .page-content li > ol { margin-top: 0.5em; margin-bottom: 0.5em; }

.page-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 0 0 1.4em;
    padding: 0.4em 0 0.4em 1.2em;
    color: #404040;
    font-style: italic;
}
.page-content blockquote p:last-child { margin-bottom: 0; }

.page-content hr,
.wp-block-separator {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 2em auto;
}

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

figure { margin: 0 0 1.4em; }
figure.alignleft, .wp-block-image.alignleft {
    float: left;
    margin: 0.3em 1.5em 1em 0;
}
.wp-block-image img { border-radius: 4px; }
.wp-element-caption { font-size: 0.85rem; color: var(--muted); }

/* Generic content tables (e.g. the points schedule) */
.page-content table:not(.standings-table) {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.6em;
    font-family: var(--sans);
    font-size: 0.92rem;
}
.page-content table:not(.standings-table) th,
.page-content table:not(.standings-table) td {
    border: 1px solid #e0e0e0;
    padding: 0.6em 0.8em;
    text-align: left;
}
.page-content table:not(.standings-table) thead th {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}
.page-content table:not(.standings-table) tbody tr:nth-child(even) { background: #f7f9fb; }

/* --- Home page ----------------------------------------------------------- */
.home-hero {
    margin-bottom: 1.8em;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
}
.slideshow { position: relative; line-height: 0; }
.slide { display: none; }
.slide.active { display: block; }
.slide img { width: 100%; height: auto; display: block; }
.slideshow-dots {
    position: absolute;
    bottom: 12px;
    left: 0; right: 0;
    text-align: center;
    line-height: 1;
}
.slideshow-dots button {
    width: 44px;
    height: 44px;
    margin: 0 2px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    /* Visible dot via pseudo-element keeps touch target large */
    position: relative;
}
.slideshow-dots button::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.2s;
}
.slideshow-dots button.active::after { background: #fff; }
.slideshow-dots button:focus-visible::after { outline: 2px solid #fff; outline-offset: 3px; }

.home-intro {
    display: flex;
    gap: 1.5em;
    align-items: flex-start;
    margin-bottom: 1.6em;
}
.home-intro-logo {
    flex-shrink: 0;
    width: 130px;
}
.home-intro-logo img { width: 100%; height: auto; border-radius: 4px; }

.home-cta-row {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    margin: 1.6em 0 2em;
}

.lead {
    font-size: 1.1rem;
    color: #333;
}

.club-list { list-style: none; margin-left: 0 !important; }
.club-list li { margin-bottom: 0.6em; }

/* Tinted callout section */
.section-callout {
    background: #f0f6fb;
    border-radius: 8px;
    padding: 1.4em 1.6em;
    margin-bottom: 1.6em;
}
.section-callout h2 { margin-top: 0; }

/* --- Contact ------------------------------------------------------------- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5em;
    margin: 1.5em 0;
}
.contact-card {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1.4em;
}
.contact-card h3 { margin-top: 0; }
.btn-primary {
    display: inline-block;
    font-family: var(--sans);
    font-weight: 700;
    background: var(--accent);
    color: #fff !important;
    padding: 0.7em 1.4em;
    border-radius: 6px;
    text-decoration: none !important;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }

.btn-secondary {
    display: inline-block;
    font-family: var(--sans);
    font-weight: 700;
    background: transparent;
    color: var(--accent) !important;
    padding: 0.65em 1.4em;
    border-radius: 6px;
    border: 2px solid var(--accent);
    text-decoration: none !important;
}
.btn-secondary:hover { background: #f0f6fb; color: var(--accent-dark) !important; border-color: var(--accent-dark); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- Points Standings table ---------------------------------------------- */
.standings-intro { margin-bottom: 1.5em; }
.standings-legend {
    font-family: var(--sans);
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0.4em 0 1.5em;
}
.standings-legend span { margin-right: 1.2em; white-space: nowrap; }
.swatch { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px; vertical-align: middle; margin-right: 0.35em; }

.division-block { margin-bottom: 2.5em; }
.division-block h2 {
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.2em;
}

.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0.8em 0; }
.table-wrapper::-webkit-scrollbar { height: 8px; }
.table-wrapper::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }

.standings-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: 0.82rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}
.standings-table th {
    background: var(--accent);
    color: #fff;
    padding: 0.6em 0.5em;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.standings-table td {
    padding: 0.5em;
    border-bottom: 1px solid #ecf0f1;
    text-align: center;
    white-space: nowrap;
}
.standings-table th.name-col, .standings-table td.name-col {
    text-align: left;
    min-width: 160px;
    position: sticky;
    left: 0;
    z-index: 1;
}
.standings-table th.name-col {
    z-index: 3;
    background: var(--accent);
}
.standings-table td.name-col {
    background: #fff;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.07);
}

.standings-table tbody tr:nth-child(even) { background: #f8f9fa; }
.standings-table tbody tr:nth-child(even) td.name-col { background: #f8f9fa; }
.standings-table tbody tr:hover { background: #e8f4f8; }
.standings-table tbody tr:hover td.name-col { background: #e8f4f8; }
.standings-table .total-col { font-weight: 700; }
.standings-table td.quarter-col { background: rgba(0, 122, 204, 0.05); }

.rank-1 td { background: #fff7d6 !important; font-weight: 700; }
.rank-2 td { background: #eef0f2 !important; font-weight: 700; }
.rank-3 td { background: #f6e6d6 !important; font-weight: 700; }
.rank-1 td.name-col { background: #fff7d6 !important; }
.rank-2 td.name-col { background: #eef0f2 !important; }
.rank-3 td.name-col { background: #f6e6d6 !important; }

.cell-counted { color: var(--text); font-weight: 600; }
.cell-dropped { color: #a0a0a0; }
.cell-missing { color: #c8c8c8; }

/* --- Footer -------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid #e5e5e5;
    padding: 1.6em 5.5% 2em;
    text-align: center;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.footer-links span { margin: 0 0.5em; color: #ccc; }
.footer-tagline { margin-top: 0.6em; }
.footer-copy { margin-top: 0.3em; font-size: 0.8rem; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 768px) {
    .site { margin: 0; border-radius: 0; }
    .site-branding { flex-direction: column; text-align: center; gap: 0.6em; }
    .site-title { font-size: 1.7rem; }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5em;
        font-family: var(--sans);
        font-weight: 700;
        font-size: 0.9rem;
        padding: 0.8em;
        cursor: pointer;
        color: var(--text);
        border: 1px solid var(--border);
        border-radius: 6px;
        margin: 0.5em 0;
        user-select: none;
    }
    .menu-toggle::before {
        content: "";
        display: block;
        width: 18px;
        height: 14px;
        background-image: repeating-linear-gradient(
            to bottom,
            var(--text) 0, var(--text) 2px,
            transparent 2px, transparent 6px
        );
    }
    .menu-toggle-checkbox:checked + .menu-toggle { color: var(--accent); border-color: var(--accent); }

    .primary-menu {
        display: none;
        flex-direction: column;
    }
    .menu-toggle-checkbox:checked ~ .primary-menu { display: flex; }
    .primary-menu a { border-bottom: 1px solid #f0f0f0; }

    /* On mobile, show sub-menus inline rather than as overlays */
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: 0;
        box-shadow: none;
        min-width: 0;
    }
    .sub-menu a { padding-left: 2.2em; background: #fafafa; }

    .home-intro { flex-direction: column; }
    .home-intro-logo { width: 100px; align-self: center; }
    .home-cta-row { justify-content: center; }

    figure.alignleft, .wp-block-image.alignleft {
        float: none;
        margin: 0 0 1.2em;
        text-align: center;
    }

    /* Standings table: show only Rank, Name, Total on mobile */
    .standings-table {
        min-width: 0;
    }
    .standings-table th:nth-child(3),
    .standings-table td:nth-child(3),
    .standings-table th:nth-child(n+5),
    .standings-table td:nth-child(n+5) {
        display: none;
    }
}
