/* ==========================================================================
   Sports Cricket Live — theme v2  ("Pitch & Seam")
   Palette: outfield green, cricket whites, ball red, pitch straw.
   Type:    Barlow Condensed (headlines, scoreboard feel) + Source Serif 4 (reading).
   Mobile-first. Breakpoints: 700px (2 cols), 900px (desktop nav), 1080px (3 cols).
   ========================================================================== */

/* ---- Fonts (self-hosted, Latin subset) ---- */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/barlow-condensed-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/barlow-condensed-Bold.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: normal; font-display: swap; src: url("/fonts/barlow-condensed-ExtraBold.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400 700; font-style: normal; font-display: swap; src: url("/fonts/source-serif-4.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400 700; font-style: italic; font-display: swap; src: url("/fonts/source-serif-4-italic.woff2") format("woff2"); }

/* ---- Tokens ---- */
:root {
    --pitch: #0f4a38;
    --pitch-deep: #0a3326;
    --pitch-soft: #1d6b52;
    --whites: #fbfaf6;
    --paper: #ffffff;
    --ball: #b3202a;
    --ball-dark: #8f1821;
    --straw: #ece3c4;
    --straw-soft: #f6f1df;
    --ink: #17201c;
    --muted: #5d6a63;
    --line: #dfe3dc;

    --font-head: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
    --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;

    --wrap: 1160px;
    --gutter: 16px;
    --radius: 6px;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }

body {
    margin: 0;
    background: var(--whites);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--ball); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ball-dark); }

:focus-visible { outline: 3px solid var(--pitch-soft); outline-offset: 2px; border-radius: 2px; }

.container {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 24px var(--gutter) 56px;
}

/* ---- Top date bar ---- */
.topbar {
    background: var(--pitch-deep);
    color: #cfe0d8;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
}
.topbar-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 6px var(--gutter);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.topbar-tagline { display: none; }

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--pitch);
    color: #fff;
    border-bottom: 3px dashed var(--straw);
}
.header-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 10px var(--gutter);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    margin-right: auto;
    min-width: 0;
}
.brand:hover { color: #fff; }
.brand-ball { flex: none; width: 34px; height: 34px; }
.brand-name {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 27px;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.header-actions { display: flex; gap: 4px; }
.icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:focus-visible { outline-color: var(--straw); }

.menu-toggle .bars,
.menu-toggle .bars::before,
.menu-toggle .bars::after {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s ease, background .2s ease;
}
.menu-toggle .bars { position: relative; }
.menu-toggle .bars::before,
.menu-toggle .bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle .bars::before { top: -7px; }
.menu-toggle .bars::after { top: 7px; }
.nav-open .menu-toggle .bars { background: transparent; }
.nav-open .menu-toggle .bars::before { transform: translateY(7px) rotate(45deg); }
.nav-open .menu-toggle .bars::after { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav = dropdown panel */
.site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--pitch-deep);
    padding: 6px var(--gutter) 14px;
    box-shadow: 0 14px 24px rgba(0,0,0,.22);
}
.nav-open .site-nav { display: block; }
.site-nav a {
    display: block;
    padding: 13px 4px;
    color: #fff;
    text-decoration: none;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 21px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.site-nav a:last-child { border-bottom: 0; }
.site-nav a:hover { color: var(--straw); }
.site-nav a.is-active { color: var(--straw); }

/* Search panel */
.search-panel { background: var(--pitch-deep); }
.search-panel[hidden] { display: none; }
.search-panel form {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 12px var(--gutter);
    display: flex;
    gap: 8px;
}
.search-panel input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font: 400 17px var(--font-body);
    color: var(--ink);
    background: #fff;
}
.search-panel input[type="text"]:focus { outline: none; border-color: var(--straw); }

/* ---- Buttons ---- */
.search-button,
.read-more,
.comments form button[type="submit"],
.article-body form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 22px;
    background: var(--ball);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
}
.search-button { background: var(--straw); color: var(--pitch-deep); }
.search-button:hover { background: #fff; color: var(--pitch-deep); }
.read-more:hover,
.comments form button[type="submit"]:hover,
.article-body form button[type="submit"]:hover { background: var(--ball-dark); color: #fff; }

/* ---- Badges (Final / Result / Preview / Schedule) ---- */
.badge {
    display: inline-block;
    padding: 1px 9px 2px;
    border-radius: 3px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 16px;
    line-height: 1.4;
    letter-spacing: 0.02em;
    vertical-align: middle;
}
.badge-final    { background: var(--ball); color: #fff; }
.badge-result   { background: var(--pitch); color: #fff; }
.badge-preview  { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.badge-schedule { background: var(--straw); color: #4a3d0b; }

/* ---- Post grid (home + search) ---- */
.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.post-card .thumb { display: block; background: var(--straw-soft); aspect-ratio: 16 / 9; overflow: hidden; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }

/* search page cards that use the old structure (no .thumb wrapper) */
.post-card > a > img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.post-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 20px; }
.post-body .badge { align-self: flex-start; margin-bottom: 8px; }

.post-card h3 {
    margin: 0 0 6px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 26px;
    line-height: 1.12;
}
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { color: var(--ball); }

.post-meta { font-size: 14px; color: var(--muted); margin-bottom: 10px; }

.post-card p {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card .read-more { margin-top: auto; align-self: flex-start; }

/* Lead story (first card on home) */
.has-hero > .post-card:first-child { background: var(--pitch-deep); color: #fff; border-color: var(--pitch-deep); }
.has-hero > .post-card:first-child h3 { font-size: 32px; font-weight: 800; }
.has-hero > .post-card:first-child h3 a { color: #fff; }
.has-hero > .post-card:first-child h3 a:hover { color: var(--straw); }
.has-hero > .post-card:first-child .post-meta { color: #b9cfc5; }
.has-hero > .post-card:first-child p { -webkit-line-clamp: 6; }
.has-hero > .post-card:first-child .badge-final { box-shadow: inset 0 0 0 2px #fff; }
.has-hero > .post-card:first-child .read-more { background: var(--straw); color: var(--pitch-deep); }
.has-hero > .post-card:first-child .read-more:hover { background: #fff; }

/* ---- Article / page body ---- */
.article-body { max-width: 740px; margin: 0 auto; }

.article-head { padding-bottom: 18px; margin-bottom: 22px; border-bottom: 3px dashed var(--line); }
.article-head .post-meta { margin: 8px 0 0; font-size: 15px; }

.article-body h1 {
    margin: 0 0 10px;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 36px;
    line-height: 1.05;
    letter-spacing: 0.005em;
    text-wrap: balance;
}
.article-body h2,
.article-body h3 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.12;
    text-wrap: balance;
}
.article-body h2 { margin: 1.8em 0 .5em; font-size: 30px; }
.article-body h3 { margin: 1.4em 0 .4em; font-size: 24px; color: var(--pitch); }
.article-body p, .article-body li { font-size: 18px; line-height: 1.72; }
.article-body p { margin: 0 0 1.1em; }
.article-body ul, .article-body ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.article-body li { margin-bottom: .35em; }
.article-body li::marker { color: var(--ball); }
.article-body strong { font-weight: 700; }

/* Hero image in articles — same 16:9 crop as the cards, full width of the column */
.featured-image { margin: 0 calc(var(--gutter) * -1) 22px; }
.featured-image img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 40%; }
.featured-image + p { font-size: 19px; line-height: 1.6; }
.featured-image + p strong { font-weight: 600; }

/* About-admin box */
.about-admin {
    margin: 36px 0;
    padding: 16px 20px;
    background: var(--straw-soft);
    border-left: 5px solid var(--pitch);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.about-admin p { margin: 0 0 6px; font-size: 16px; }
.about-admin p:last-child { margin: 0; }

/* Related posts */
.related { margin: 40px 0; padding-top: 4px; border-top: 3px dashed var(--ball); }
.related h2 { margin-top: .8em; }
.related ul { list-style: none; padding: 0; }
.related li { margin: 0; border-bottom: 1px solid var(--line); }
.related li:last-child { border-bottom: 0; }
.related a {
    display: block;
    padding: 12px 0;
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 21px;
    line-height: 1.2;
    text-decoration: none;
}
.related a:hover { color: var(--ball); }

/* Forms (comments + contact) */
.comments { margin: 36px 0 0; }
.article-body form { margin: 0 0 1.4em; }
.article-body form p { margin-bottom: 14px; }
.article-body form label { display: block; font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.article-body form input[type="text"],
.article-body form input[type="email"],
.article-body form input[type="url"],
.article-body form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 11px 13px;
    background: #fff;
    border: 1.5px solid #b9c2bb;
    border-radius: var(--radius);
    font: 400 17px/1.4 var(--font-body);
    color: var(--ink);
}
.article-body form textarea { min-height: 140px; resize: vertical; }
.article-body form input:focus,
.article-body form textarea:focus { outline: none; border-color: var(--pitch-soft); box-shadow: 0 0 0 3px rgba(29,107,82,.22); }

/* Tables (schedules) — scroll sideways on phones instead of breaking the page */
.table-wrap { margin: 16px calc(var(--gutter) * -1); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.schedule-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 16px; line-height: 1.4; }
.schedule-table th,
.schedule-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.schedule-table th { background: var(--pitch); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 18px; white-space: nowrap; }
.schedule-table tr:nth-child(even) td { background: var(--straw-soft); }
.schedule-table td:first-child { font-weight: 600; white-space: nowrap; }

/* Search results page */
.search-results h2 { margin: 0 0 18px; font-family: var(--font-head); font-weight: 800; font-size: 32px; line-height: 1.1; }
.no-results { padding: 24px; background: var(--straw-soft); border-radius: var(--radius); font-size: 18px; }

/* ---- Footer ---- */
.site-footer { background: var(--pitch-deep); color: #d5e3dc; border-top: 3px dashed var(--straw); }
.footer-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 28px var(--gutter) 10px;
    display: grid;
    gap: 6px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 26px; line-height: 1; }
.footer-brand svg { width: 30px; height: 30px; }
.footer-blurb { margin: 0; font-size: 15px; color: #b9cfc5; }
.footer-links { max-width: var(--wrap); margin: 0 auto; padding: 8px var(--gutter) 6px; display: flex; flex-wrap: wrap; gap: 0 22px; }
.footer-links a { padding: 8px 0; color: #fff; text-decoration: none; font-family: var(--font-head); font-weight: 600; font-size: 19px; }
.footer-links a:hover { color: var(--straw); }
.footer-copy { max-width: var(--wrap); margin: 0 auto; padding: 14px var(--gutter) 26px; font-size: 14px; color: #9db8ac; border-top: 1px solid rgba(255,255,255,.12); }

/* ---- Tablet ---- */
@media (min-width: 700px) {
    :root { --gutter: 24px; }
    body { font-size: 18px; }
    .topbar-tagline { display: block; }
    .post-grid { grid-template-columns: repeat(2, 1fr); gap: 26px; }
    .has-hero > .post-card:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; }
    .has-hero > .post-card:first-child .thumb { position: relative; aspect-ratio: auto; min-height: 280px; }
    .has-hero > .post-card:first-child .thumb img { position: absolute; inset: 0; }
    .has-hero > .post-card:first-child .post-body { justify-content: center; padding: 28px 30px; }
    .has-hero > .post-card:first-child h3 { font-size: 38px; }
    .featured-image { margin-left: 0; margin-right: 0; }
    .featured-image img { border-radius: var(--radius); }
    .table-wrap { margin-left: 0; margin-right: 0; }
    .article-body h1 { font-size: 48px; }
    .article-body h2 { font-size: 34px; }
    .featured-image + p { font-size: 21px; }
    .footer-inner { grid-template-columns: auto 1fr; align-items: center; gap: 20px; }
}

/* ---- Desktop nav (6 links fit inline) ---- */
@media (min-width: 900px) {
    .menu-toggle { display: none; }
    .site-nav {
        display: flex;
        position: static;
        background: transparent;
        padding: 0;
        box-shadow: none;
        gap: 2px;
        order: 2;
    }
    .site-nav a { padding: 8px 12px; border: 0; font-size: 20px; border-radius: var(--radius); }
    .site-nav a:hover { background: rgba(255,255,255,.1); }
    .site-nav a.is-active { background: rgba(255,255,255,.14); color: #fff; }
    .brand { margin-right: 18px; }
    .header-inner { gap: 4px; }
    .header-actions { margin-left: auto; order: 3; }
    .brand { order: 1; }
    .brand-name { font-size: 30px; }
}

/* ---- Desktop grid ---- */
@media (min-width: 1080px) {
    .container { padding-top: 34px; }
    .post-grid { grid-template-columns: repeat(3, 1fr); gap: 30px; }
    .has-hero > .post-card:first-child { grid-template-columns: 1.5fr 1fr; }
    .has-hero > .post-card:first-child .post-body { padding: 38px 42px; }
    .has-hero > .post-card:first-child h3 { font-size: 40px; }
    .has-hero > .post-card:first-child p { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}


/* =====================================================================
   ADS  (PubPremier North America banners)
   Which size shows on which screen. Empty/hidden boxes take no space.
   ===================================================================== */
.ad-slot { display: none; margin: 0 auto; max-width: 100%; text-align: center; overflow: hidden; }
.ad-group { margin: 18px auto; text-align: center; clear: both; }
.ad-feed  { grid-column: 1 / -1; text-align: center; }
.ad-feed .ad-slot { margin: 4px auto; }
.pp-hb { margin: 0 auto; max-width: 100%; }

/* phones (< 768px) */
.ad-320x50, .ad-320x100, .ad-300x250, .ad-250x250 { display: block; }

/* tablet / small desktop (768px+) */
@media (min-width: 768px) {
    .ad-320x50, .ad-320x100 { display: none; }
    .ad-728x90, .ad-336x280 { display: block; }
}
/* wide desktop (1100px+) */
@media (min-width: 1100px) {
    .ad-728x90 { display: none; }
    .ad-970x90, .ad-970x250 { display: block; }
    .ad-bottom .ad-250x250 { display: none; }
}
/* side rails - only when the screen is wide AND tall enough (1400px+ x 720px+) */
.ad-rail { display: none; }
@media (min-width: 1400px) and (min-height: 720px) {
    .ad-rail { display: block; position: fixed; top: 96px; z-index: 5; }
    .ad-rail .ad-slot { display: block; }
    .ad-rail-left  { left:  calc(50% - 370px - 160px - 24px); }
    .ad-rail-right { right: calc(50% - 370px - 300px - 24px); }
}
