/* ==========================================================
   derby.css — Derby Match (ธีมสนามกลางคืน)
   หน้าแรกโหลดไฟล์นี้ไฟล์เดียว (ไม่ต้องพึ่ง style.css / style-additions.css)
   ตัวแปร --font-* / --color-* ด้านล่างคงชื่อเดิมไว้ให้ _map.php และ _footer_address.php ใช้ได้
   ========================================================== */

:root {
    --night: #0E1A2E;
    --stand: #16253D;
    --stand-2: #1E3150;
    --chalk: #EEF1EA;
    --mist: #9DAAC0;
    --flood: #E9C46A;
    --rule: rgba(238, 241, 234, 0.14);

    --font-display: "Chakra Petch", "Noto Sans Thai", Tahoma, sans-serif;
    --font-body: "IBM Plex Sans Thai Looped", "Noto Sans Thai Looped", "Sarabun", Tahoma, sans-serif;
    --font-accent: var(--font-display);

    /* ชื่อเดิมที่ _map.php / _footer_address.php ใช้ */
    --color-ink: var(--chalk);
    --color-ink-light: #D3D9E3;
    --color-ink-muted: var(--mist);
    --color-accent: var(--flood);
    --color-accent-light: #F2D58E;
    --color-rule-light: var(--rule);
    --color-paper: var(--night);
    --color-paper-dark: var(--stand);

    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    background: var(--night);
    color: var(--chalk);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--flood); }
p, h1, h2, h3, dl, dd, ol, ul, figure { margin: 0; }

:focus-visible { outline: 2px solid var(--flood); outline-offset: 3px; }

.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 100;
    background: var(--flood); color: var(--night);
    padding: 8px 14px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- หัวเว็บ ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(14, 26, 46, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule);
}
.site-header-inner {
    max-width: 1100px; margin: 0 auto; padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--chalk); }
.site-brand-mark {
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(90deg, #DA291C 50%, #034694 50%);
    box-shadow: 0 0 0 2px var(--night), 0 0 0 3px var(--chalk);
}
.site-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.02em; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
    font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
    color: var(--mist); text-decoration: none; padding: 6px 12px; border-radius: 4px;
}
.site-nav a:hover { color: var(--chalk); background: var(--stand); }

/* ---------- Hero ---------- */
.hero {
    border-bottom: 1px solid var(--rule);
    background:
        radial-gradient(ellipse 60% 70% at 15% 0%, rgba(233, 196, 106, 0.16), transparent 70%),
        radial-gradient(ellipse 60% 70% at 85% 0%, rgba(233, 196, 106, 0.10), transparent 70%),
        var(--night);
}
.hero-inner { max-width: 1100px; margin: 0 auto; padding: 64px 20px 56px; }
.hero-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.15;
    max-width: 14ch;
}
.hero-lead { margin-top: 18px; max-width: 60ch; color: #D3D9E3; font-size: 1.1rem; }

/* กระดานคู่แข่งขัน (ลายเซ็นของหน้า) */
.fixture-board { margin-top: 40px; display: grid; gap: 10px; max-width: 760px; }
.fixture {
    position: relative;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    column-gap: 18px; row-gap: 2px;
    padding: 16px 22px;
    background: var(--stand);
    border-radius: 6px;
    text-decoration: none; color: var(--chalk);
    overflow: hidden;
    transition: background 0.2s ease;
}
.fixture::before, .fixture::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 6px;
}
.fixture::before { left: 0; background: var(--home); }
.fixture::after  { right: 0; background: var(--away); }
.fixture:hover { background: var(--stand-2); }
.fixture-team { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 3vw, 1.6rem); }
.fixture-team:first-child { text-align: right; }
.fixture-vs {
    font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
    color: var(--night); background: var(--flood);
    padding: 2px 10px; border-radius: 3px;
}
.fixture-name { grid-column: 1 / -1; text-align: center; font-size: 0.85rem; color: var(--mist); }

/* ---------- บทความดาร์บี้ ---------- */
.site-main { display: block; }
.derby { max-width: 760px; margin: 0 auto; padding: 72px 20px 24px; }
.derby + .derby { border-top: 1px solid var(--rule); }
.derby-split {
    height: 6px; border-radius: 3px; margin-bottom: 22px;
    background: linear-gradient(90deg, var(--home) 0 49%, transparent 49% 51%, var(--away) 51% 100%);
}
.derby-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(1.6rem, 4.2vw, 2.4rem); line-height: 1.25;
}
.derby-en { margin-top: 6px; color: var(--mist); font-family: var(--font-display); font-weight: 500; letter-spacing: 0.02em; }

.derby-banner { margin: 26px 0 0; border-radius: 6px; overflow: hidden; background: var(--stand); }
.derby-banner img { width: 100%; aspect-ratio: 600 / 338; object-fit: cover; }

.derby-facts {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 6px 6px;
}
.derby-facts > div { padding: 12px 14px; border-left: 1px solid var(--rule); }
.derby-facts > div:first-child { border-left: 0; }
.derby-facts dt { font-size: 0.78rem; color: var(--mist); }
.derby-facts dd { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; line-height: 1.4; margin-top: 2px; }

.derby-body { margin-top: 36px; }
.derby-body p { max-width: 68ch; margin-bottom: 1.15em; color: #DCE1E9; }
.derby-body .derby-lead { font-size: 1.2rem; line-height: 1.8; color: var(--chalk); margin-bottom: 1.6em; }
.derby-body h3 {
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.35rem; line-height: 1.35;
    margin: 2em 0 0.6em; padding-left: 14px;
    border-left: 4px solid var(--home);
}

/* ---------- กระดานผลการแข่งขัน ---------- */
.results-board { margin: 40px 0 0; background: var(--stand); border-radius: 6px; padding: 22px 22px 10px; }
.results-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; margin-bottom: 12px; }
.results-list { list-style: none; padding: 0; }
.result-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas: "year comp" "year match" "year note";
    column-gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
}
.result-year {
    grid-area: year; align-self: start;
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--flood);
    font-variant-numeric: tabular-nums;
}
.result-comp { grid-area: comp; font-size: 0.85rem; color: var(--mist); line-height: 1.5; }
.result-match {
    grid-area: match;
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center; gap: 12px; margin: 4px 0;
    font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
}
.result-home { text-align: right; }
.result-score {
    min-width: 72px; text-align: center;
    background: var(--night); color: var(--chalk);
    border-radius: 4px; padding: 3px 10px;
    font-weight: 700; font-variant-numeric: tabular-nums;
    border: 1px solid var(--rule);
}
.result-note { grid-area: note; font-size: 0.85rem; color: var(--mist); line-height: 1.5; }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; padding: 72px 20px 24px; border-top: 1px solid var(--rule); }
.faq-title, .sources-title { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; margin-bottom: 18px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
    cursor: pointer; list-style: none;
    font-family: var(--font-display); font-weight: 600; font-size: 1.08rem;
    padding: 16px 32px 16px 0; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    color: var(--flood); font-size: 1.4rem; font-weight: 500;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 0 18px; color: #DCE1E9; max-width: 68ch; }

/* ---------- แหล่งอ้างอิง ---------- */
.sources { max-width: 760px; margin: 0 auto; padding: 40px 20px 8px; }
.sources-title { font-size: 1.15rem; }
.sources-list { padding-left: 1.1em; color: var(--mist); font-size: 0.92rem; }
.sources-list li { margin: 4px 0; }

/* ---------- กล่องแผนที่ (_map.php) ปรับเข้าธีมมืด ---------- */
#location .office-map-card { background: var(--stand); border-top-color: var(--flood); box-shadow: none; border-radius: 6px; overflow: hidden; }
#location .office-map-floor { color: var(--night); box-shadow: 0 0 0 4px var(--stand), 0 0 0 5px var(--flood); }
#location .om-btn-primary, #location .om-btn-primary:hover { color: var(--night); }
#location .office-map-frame iframe { filter: grayscale(0.4) brightness(0.9); }
#location .office-map-pin { background: var(--flood); color: var(--night); }
#location .office-map-list { padding: 0; margin: 0; }

/* ---------- ท้ายเว็บ (_signature.php) ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 48px; padding: 36px 20px 48px; text-align: center; }
.footer-container { max-width: 760px; margin: 0 auto; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 12px; }
.footer-nav a { color: var(--chalk); text-decoration: none; font-size: 0.92rem; }
.footer-nav a:hover { color: var(--flood); }
.footer-nav-sep { color: var(--mist); }
.footer-copyright { font-family: var(--font-display); font-weight: 600; margin-bottom: 8px; }
.footer-signature { color: var(--mist); font-size: 0.85rem; }
.footer-ornament, .footer-border { display: none; }

/* ---------- Cookie ---------- */
.cookie-consent {
    position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90;
    max-width: 720px; margin: 0 auto;
    background: var(--stand-2); border: 1px solid var(--rule); border-radius: 8px;
    padding: 16px 18px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.cookie-consent.hidden { display: none; }
.cookie-content { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cookie-content p { flex: 1 1 320px; font-size: 0.88rem; line-height: 1.6; color: #DCE1E9; }
.cookie-buttons { display: flex; gap: 8px; }
.cookie-btn {
    font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
    padding: 8px 16px; border-radius: 4px; cursor: pointer; border: 1px solid var(--flood);
}
.cookie-accept { background: var(--flood); color: var(--night); }
.cookie-decline { background: transparent; color: var(--chalk); border-color: var(--rule); }

/* ---------- หน้า นโยบาย / ข้อกำหนด / ติดต่อ ---------- */
.legal-main { display: block; max-width: 760px; margin: 0 auto; padding: 28px 20px 24px; }
.breadcrumb { font-size: 0.88rem; color: var(--mist); margin-bottom: 28px; }
.breadcrumb a { color: var(--mist); text-decoration: none; }
.breadcrumb a:hover { color: var(--flood); }
.breadcrumb-sep { margin: 0 8px; }
.breadcrumb-current { color: var(--chalk); }
.legal-section { padding-bottom: 8px; }
.legal-section::before {
    content: ""; display: block; height: 6px; border-radius: 3px; margin-bottom: 22px; width: 120px;
    background: linear-gradient(90deg, #DA291C 0 49%, transparent 49% 51%, #034694 51% 100%);
}
.legal-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4.4vw, 2.4rem); line-height: 1.25; }
.legal-updated { margin-top: 8px; color: var(--mist); font-size: 0.9rem; }
.legal-section > p, .legal-section li { max-width: 68ch; color: #DCE1E9; }
.legal-section > p { margin-top: 1.1em; }
.legal-section .legal-updated { margin-top: 8px; color: var(--mist); }
.legal-intro { font-size: 1.12rem; }
.legal-section h2 {
    font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1.35;
    margin: 2.2em 0 0.2em; padding-left: 12px; border-left: 4px solid var(--flood);
}
.legal-section ul { margin: 0.8em 0 0; padding-left: 1.2em; }
.legal-section li { margin: 0.45em 0; }
.legal-section li::marker { color: var(--flood); }
.legal-section strong { color: var(--chalk); font-weight: 600; }

.contact-content { margin-top: 28px; }
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.contact-card { background: var(--stand); border-radius: 6px; padding: 18px 16px; }
.contact-icon { font-size: 1.4rem; }
.contact-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin: 6px 0 4px; }
.contact-card p { font-size: 0.92rem; line-height: 1.6; color: #DCE1E9; overflow-wrap: anywhere; }
.contact-card a { color: var(--flood); text-decoration: none; }
@media (max-width: 720px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- มือถือ ---------- */
@media (max-width: 480px) { .site-brand-name { display: none; } }
@media (max-width: 720px) {
    .site-header-inner { padding: 10px 14px; gap: 10px; }
    .site-nav { overflow-x: auto; scrollbar-width: none; }
    .site-nav a { font-size: 0.85rem; padding: 6px 8px; white-space: nowrap; }
    .hero-inner { padding: 40px 18px 40px; }
    .fixture { padding: 14px 16px; column-gap: 10px; }
    .derby { padding-top: 52px; }
    .derby-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .derby-facts > div:nth-child(3) { border-left: 0; }
    .derby-facts > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
    .results-board { padding: 18px 14px 6px; }
    .result-row { grid-template-columns: 44px minmax(0, 1fr); column-gap: 10px; }
    .result-match { font-size: 0.95rem; gap: 8px; }
    .result-score { min-width: 58px; padding: 3px 6px; }
}
