/* =====================================================================
   Chagrin Valley Bocce League — site styles
   Palette (bocce-ball colors): forest green, white, and burgundy.
       --green     #0B3D2E   primary / headers / footer
       --white     #FFFFFF   background & cards
       --burgundy  #800020   buttons, links, accents
   Swap the whole site's look by editing the :root variables below.
   ===================================================================== */

:root {
    --green:         #0B3D2E;
    --green-dark:    #07291F;      /* derived: hover on green */
    --green-tint:    #E8F0EC;      /* derived: pale fill (alerts, announcements) */
    --white:         #FFFFFF;
    --off-white:     #FAFAFA;      /* derived: alt rows, subtle fills */
    --burgundy:      #800020;
    --burgundy-dark: #5A0017;      /* derived: hover on burgundy */
    --burgundy-tint: #F4E5E8;      /* derived: pale burgundy (callouts, highlights) */
    --ink:           #1A1A1A;      /* body text */
    --muted:         #6B6B6B;      /* secondary text */
    --line:          #E5E5E5;      /* borders */
    --paper:         #FFFFFF;      /* cards */
    --shadow:        0 1px 2px rgba(11, 61, 46, 0.06), 0 6px 18px rgba(11, 61, 46, 0.08);
    --radius:        10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--white);
    line-height: 1.58;
    font-size: 16px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---- Header ---------------------------------------------------------- */
.site-header {
    background: var(--green);
    color: var(--white);
    border-bottom: 4px solid var(--burgundy);
}
.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 16px;
}
.brand { color: var(--white); text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 28px; color: var(--burgundy); line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.2px; }
.brand-season { font-size: 0.8rem; color: var(--burgundy); opacity: 0.95; }
.site-nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.site-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.site-nav a:hover, .site-nav a.active { border-bottom-color: var(--burgundy); color: var(--burgundy); }
.site-nav a.nav-secondary { color: var(--line); font-size: 0.85rem; }
.site-nav a.nav-secondary:hover { color: var(--burgundy); }

/* ---- Hero banner ----------------------------------------------------- */
.hero { background: var(--green); margin-bottom: 28px; overflow: hidden; border-radius: var(--radius); }
.hero-image {
    width: 100%;
    height: 280px;
    background-color: var(--green);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
}

/* ---- Main ------------------------------------------------------------ */
.site-main { padding: 32px 0 56px; min-height: calc(100vh - 220px); }

h1, h2, h3 { color: var(--green); margin-top: 0; }
h1 { font-size: 1.95rem; margin-bottom: 0.5rem; font-weight: 700; }
h2 { font-size: 1.35rem; margin: 1.7rem 0 0.6rem; font-weight: 700; }
h3 { font-size: 1.07rem; margin: 1.3rem 0 0.4rem; font-weight: 700; }

a { color: var(--burgundy); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--burgundy-dark); }

.subtitle { color: var(--muted); margin-top: -0.2rem; margin-bottom: 1.8rem; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }

/* ---- Cards & layout ------------------------------------------------- */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.announcement {
    background: var(--green-tint);
    border-left: 4px solid var(--green);
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 22px;
}
.announcement p { margin: 0; }

.callout {
    background: var(--burgundy-tint);
    border: 1px solid var(--burgundy);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 22px;
}
.callout h2, .callout h3 { margin-top: 0; }
.reg-notice {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--burgundy-dark);
    font-weight: 700;
    color: var(--ink);
}

/* prose blocks rendered from admin-editable text */
.prose h2 { border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.prose p { margin: 0.7rem 0; }
.prose { max-width: 760px; }

/* ---- Photo gallery --------------------------------------------------- */
.photo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.photo-tile {
    aspect-ratio: 4 / 3;
    background-color: var(--off-white);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow: hidden;
    position: relative;
}
.photo-tile-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(11, 61, 46, 0.92), rgba(11, 61, 46, 0));
    color: var(--white);
    padding: 16px 14px 10px;
    font-size: 0.88rem;
    font-weight: 500;
}
@media (max-width: 640px) { .photo-strip { grid-template-columns: 1fr; } }

/* ---- Tables ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border-radius: var(--radius);
    overflow: hidden;
}
table.data thead th {
    background: var(--green);
    color: var(--white);
    text-align: left;
    padding: 11px 14px;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
table.data tbody td {
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    font-size: 0.97rem;
}
table.data tbody tr:nth-child(even) { background: var(--off-white); }
table.data .rank { font-weight: 700; color: var(--green); width: 3.5em; }
table.data .team { font-weight: 600; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.standings-top tr:first-child td { background: var(--burgundy-tint); }
.standings-top tr:first-child .rank::before { content: "\1F3C6  "; font-size: 0.9em; }

.tag {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
}
.tag-win      { background: var(--green); color: var(--white); }
.tag-loss     { background: var(--off-white); color: var(--muted); border: 1px solid var(--line); }
.tag-final    { background: var(--green-tint); color: var(--green); border: 1px solid var(--green); }
.tag-upcoming { background: var(--burgundy-tint); color: var(--burgundy-dark); border: 1px solid var(--burgundy); }

/* ---- Schedule -------------------------------------------------------- */
.day-group { margin-bottom: 26px; }
.day-heading {
    color: var(--green);
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 2px solid var(--line);
    padding-bottom: 6px;
    margin-bottom: 10px;
}
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 22px;
}
.filter-bar .field { flex: 1 1 180px; }
.filter-bar label { margin-bottom: 4px; }

.calendar-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--paper);
    border: 1px solid var(--burgundy);
    border-left: 6px solid var(--burgundy);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

/* ---- View toggle + print actions ------------------------------------ */
.schedule-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: var(--off-white);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
}
.view-toggle-label {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
    margin: 0 10px 0 12px;
}
.view-toggle a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    font-size: .88rem;
    padding: 6px 14px;
    border-radius: 999px;
    transition: background-color .15s ease, color .15s ease;
}
.view-toggle a:hover { background: var(--white); color: var(--burgundy); }
.view-toggle a.active { background: var(--green); color: var(--white); }

/* ---- By-team grouping ----------------------------------------------- */
.team-group { margin-bottom: 28px; scroll-margin-top: 80px; }
.team-heading {
    color: var(--green);
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 2px solid var(--line);
    padding-bottom: 6px;
    margin: 0 0 10px;
}
.team-game-count {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 400;
    margin-left: 6px;
}

/* ---- Buttons & forms ------------------------------------------------- */
.btn {
    display: inline-block;
    background: var(--burgundy);
    color: var(--white);
    border: 0;
    padding: 9px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.04s ease;
    font-family: inherit;
    line-height: 1.3;
}
.btn:hover { background: var(--burgundy-dark); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn.btn-ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.btn-ghost:hover { background: var(--green); color: var(--white); }
.btn.btn-danger { background: transparent; color: var(--burgundy); border: 1px solid var(--burgundy); }
.btn.btn-danger:hover { background: var(--burgundy); color: var(--white); }
.btn.btn-sm { padding: 5px 12px; font-size: 0.85rem; }

label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--green); font-size: 0.95rem; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=time], input[type=file], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    color: var(--ink);
}
textarea { line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--burgundy);
    outline-offset: 1px;
    border-color: var(--burgundy);
}
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.help { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }

/* ---- Status messages ------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; border: 1px solid var(--line); }
.alert-success { background: var(--green-tint); color: var(--green); border-color: var(--green); }
.alert-error   { background: var(--burgundy-tint); color: var(--burgundy-dark); border-color: var(--burgundy); }
.alert-warn    { background: var(--off-white); color: var(--ink); border-color: var(--muted); }

/* ---- Score entry / game rows ---------------------------------------- */
.game-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    margin-bottom: 12px;
}
.game-meta { font-size: 0.85rem; color: var(--muted); }
.game-meta strong { color: var(--green); display: block; font-size: 1rem; }
.team-matchup { font-size: 1.05rem; font-weight: 600; }
.team-matchup .vs { color: var(--muted); font-weight: 400; margin: 0 8px; }
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.game-actions form { display: inline; }
.game-actions .recorded { font-size: 0.85rem; color: var(--green); font-weight: 600; }

/* ---- Admin ----------------------------------------------------------- */
.admin-tools { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.admin-tool {
    display: block;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease;
}
.admin-tool:hover { border-color: var(--burgundy); color: var(--ink); }
.admin-tool .tool-name { color: var(--green); font-weight: 700; font-size: 1.05rem; }
.admin-tool .tool-desc { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 26px; margin-bottom: 8px; }
.stat { text-align: center; }
.stat .stat-num { font-size: 1.8rem; font-weight: 700; color: var(--green); line-height: 1; }
.stat .stat-label { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs { font-size: 0.9rem; margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

/* ---- Footer ---------------------------------------------------------- */
.site-footer {
    background: var(--green);
    color: var(--white);
    padding: 22px 0;
    font-size: 0.9rem;
    border-top: 4px solid var(--burgundy);
}
.site-footer .wrap { text-align: center; }
.site-footer p { margin: 4px 0; }
.footer-name { font-weight: 700; color: var(--burgundy); }
.site-footer a { color: var(--white); }
.site-footer a:hover { color: var(--burgundy); }
.footer-links .dot { margin: 0 8px; color: var(--line); }
.footer-fine { color: var(--line); font-size: 0.82rem; }

/* ---- Utilities & responsive ----------------------------------------- */
.stack-sm > * + * { margin-top: 10px; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

@media (max-width: 640px) {
    .site-header .wrap { flex-direction: column; align-items: flex-start; }
    .game-row { grid-template-columns: 1fr; }
    .game-actions { justify-content: flex-start; }
    h1 { font-size: 1.5rem; }
    .hero-image { height: 190px; }
    .calendar-cta { align-items: flex-start; }
}

/* ---- Print styles --------------------------------------------------- */
.print-header { display: none; }

@media print {
    /* Hide everything that isn't the content you came to print */
    .site-header, .site-footer, .calendar-cta, .schedule-tools,
    .filter-bar, .no-print, .subtitle { display: none !important; }

    /* Show the league-name print header at the top of the page */
    .print-header {
        display: block;
        font-size: .9rem;
        color: #000;
        border-bottom: 1px solid #999;
        padding-bottom: 6px;
        margin-bottom: 10px;
    }

    /* Strip styling that wastes ink */
    body { background: #fff; color: #000; font-size: 11pt; line-height: 1.45; }
    .wrap { max-width: none; padding: 0; }
    .site-main { padding: 0; min-height: 0; }
    h1 { color: #000; font-size: 16pt; margin-bottom: 6pt; }
    h2, h3, .team-heading, .day-heading { color: #000; }

    .card, .day-group, .team-group {
        box-shadow: none;
        border: 0;
        padding: 0;
        margin-bottom: 14pt;
        page-break-inside: avoid;
    }
    .team-group { page-break-after: auto; }

    table.data { border: 1px solid #999; }
    table.data thead th {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    table.data tbody tr:nth-child(even) {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    table.data tbody td { border-top: 1px solid #ccc; }

    .tag { border: 1px solid #666 !important; color: #000 !important; background: #fff !important; }
    .tag-win { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    a { color: #000; text-decoration: none; }

    /* Force a clean line break before the schedule starts */
    h1 + p, .print-header + h1 { page-break-after: avoid; }
}
