/* =====================================================================
   SONGKHLA FC — DESIGN SYSTEM "SOUTHERN STEEL"
   นิตยสารกีฬา: สันหลังดำมีเนื้อฟิล์ม / เวทีกระดาษอุ่น / แดงคือใบมีด
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */
:root {
    /* --- สีหลัก --- */
    --ink-900: #0A0A0C;
    --ink-800: #141418;
    --ink-700: #1F1F25;
    --ink-600: #2E2E36;
    --ink-500: #4A4A55;
    --ink-400: #6E6E7A;
    --ink-300: #9A9AA5;

    --paper: #F5F2ED;
    --paper-2: #FFFFFF;
    --paper-3: #EAE5DC;

    --red: #D7000F;
    --red-deep: #7E0009;
    --red-hot: #FF3B21;
    --red-wash: rgba(215, 0, 15, .08);

    --bone: #E6DFD3;
    --gold: #C9A227;
    --gold-soft: #E3C766;

    /* --- นามแฝงของโทเคนเดิม (ไม่ให้ CSS หน้าอื่นพัง) --- */
    --red-dark: var(--red-deep);
    --black: var(--ink-900);
    --ink: var(--ink-800);
    --white: var(--paper-2);
    --gray-900: var(--ink-700);
    --gray-700: var(--ink-600);
    --gray-500: var(--ink-400);
    --gray-300: var(--paper-3);
    --gray-100: var(--paper);

    /* --- ตัวอักษร: Noto Sans Thai ใช้ทั้งระบบ (หัวข้อ/เนื้อหา/ตัวเลข) --- */
    --font-head: 'Noto Sans Thai', sans-serif;
    --font-body: 'Noto Sans Thai', sans-serif;
    --font-num: 'Noto Sans Thai', sans-serif;

    --fs-display: clamp(2.75rem, 6vw, 5.5rem);
    --fs-h1: clamp(2rem, 4vw, 3.25rem);
    --fs-h2: clamp(1.5rem, 2.6vw, 2.25rem);
    --fs-h3: 1.125rem;
    --fs-body: 1rem;
    --fs-sm: .875rem;
    --fs-xs: .8125rem;
    --fs-label: .6875rem;

    --track-label: .14em;
    --track-tight: -.02em;

    /* --- ระยะห่าง --- */
    --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
    --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 64px;
    --sp-9: 96px;  --sp-10: 128px;

    /* --- โครง --- */
    --container: 1280px;
    --header-h: 76px;
    --radius: 2px;
    --radius-lg: 3px;
    --rule: 1px solid rgba(10, 10, 12, .12);
    --rule-dark: 1px solid rgba(255, 255, 255, .10);

    --shadow-sm: 0 1px 2px rgba(10, 10, 12, .06);
    --shadow: 0 12px 32px -12px rgba(10, 10, 12, .28);
    --shadow-lift: 0 28px 60px -22px rgba(10, 10, 12, .45);

    /* ค่าสีแบบ r g b สำหรับใช้กับ alpha (เงา/ขอบ/แสงเรือง) ให้ตรงกับโทเคนจริง */
    --red-rgb: 215, 0, 15;
    --gold-rgb: 201, 162, 39;
    --ink-rgb: 10, 10, 12;

    --ease: cubic-bezier(.22, .61, .36, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --transition: all .28s cubic-bezier(.22, .61, .36, 1);
}

/* ---------------------------------------------------------------------
   2. RESET / BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.7;
    color: var(--ink-800);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* กันหน้าเลื่อนซ้าย-ขวาบนมือถือ */
}

/* เนื้อฟิล์มบาง ๆ ทั่วหน้า — สร้างบรรยากาศแทนสีทึบแบน */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: var(--track-tight);
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; }

::selection { background: var(--red); color: #fff; }

/* ลิงก์ข้ามไปยังเนื้อหาหลัก — ซ่อนไว้จนกว่าจะได้รับโฟกัส (WCAG 2.4.1) */
.skip-link {
    position: absolute; left: 0; top: -100%; z-index: 9999;
    background: var(--red); color: #fff; padding: 12px 24px;
    font-family: var(--font-head); font-weight: 600; font-size: var(--fs-sm);
    transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ตัวบ่งชี้โฟกัสคีย์บอร์ดทั่วเว็บ (WCAG 2.4.7 / 1.4.11) */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--red-hot);
    outline-offset: 2px;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 40px);
    width: 100%;
}

/* ตัวเลขแบบสกอร์บอร์ด — ใช้กับสกอร์ อันดับ เบอร์เสื้อ จำนวนถ้วย */
.num, .numeral {
    font-family: var(--font-num);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

/* ป้ายกำกับตัวเล็ก — ภาษาของนิตยสารกีฬา */
.label, .eyebrow {
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    line-height: 1;
}

/* ---------------------------------------------------------------------
   3. SECTIONS — จังหวะไม่เท่ากัน (หัวใจของการแก้ "ดูเหมือน AI")
   --------------------------------------------------------------------- */
.section { padding: var(--sp-9) 0; }
.section-tight { padding: var(--sp-7) 0; }
.section-loose { padding: var(--sp-10) 0; }

.section-dark {
    background: var(--ink-900);
    color: var(--bone);
    position: relative;
}
/* รัศมีแดงจาง ๆ ให้พื้นดำมีมิติ ไม่แบน */
.section-dark::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(70% 55% at 12% 0%, rgba(215, 0, 15, .16) 0%, transparent 62%),
        radial-gradient(60% 60% at 100% 100%, rgba(126, 0, 9, .22) 0%, transparent 60%);
}
.section-dark > * { position: relative; z-index: 1; }
.section-dark h1, .section-dark h2, .section-dark h3 { color: var(--paper-2); }

/* หัวข้อ section — ป้ายเล็กบน + ชื่อใหญ่ + เส้นคั่นทอดยาว */
.section-title {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-4);
    margin-bottom: var(--sp-7);
    font-family: var(--font-head);
    font-size: var(--fs-h2);
    font-weight: 700;
    letter-spacing: var(--track-tight);
    line-height: 1;
    position: relative;
    padding-bottom: var(--sp-4);
    border-bottom: var(--rule);
}
.section-dark .section-title { border-bottom: var(--rule-dark); }

/* ใบมีดแดงใต้หัวข้อ */
.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 68px;
    height: 3px;
    background: var(--red);
}

.section-title .title-link {
    margin-left: auto;
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--red);
    white-space: nowrap;
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}
.section-dark .section-title .title-link { color: var(--gold-soft); }
.section-title .title-link:hover { border-bottom-color: currentColor; }

/* ---------------------------------------------------------------------
   4. BUTTONS — คม มีการกวาดสีตอน hover
   --------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    font-family: var(--font-head);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: .04em;
    padding: 13px 28px;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: color .25s var(--ease), background-color .25s var(--ease), border-color .25s var(--ease);
    isolation: isolate;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--ink-900);
    transform: translateY(101%);
    transition: transform .38s var(--ease-out);
}
.btn:hover::before { transform: translateY(0); }

.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { color: #fff; }

.btn-dark { background: var(--ink-900); color: #fff; }
.btn-dark::before { background: var(--red); }

.btn-outline-light { border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn-outline-light::before { background: var(--red); }
.btn-outline-light:hover { border-color: var(--red); }

.btn-outline-dark { border-color: var(--ink-900); color: var(--ink-900); }
.btn-outline-dark:hover { color: #fff; }

.btn-sm { padding: 9px 18px; font-size: var(--fs-xs); }

/* ---------------------------------------------------------------------
   5. HEADER
   --------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--ink-900);
    border-bottom: var(--rule-dark);
}
/* ใบมีดแดงเส้นบางใต้ header */
.site-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    background: linear-gradient(90deg, var(--red) 0%, var(--red-deep) 42%, transparent 78%);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    height: var(--header-h);
}

.header-brand { display: flex; align-items: center; gap: var(--sp-3); }
.header-brand img {
    height: 48px;
    width: auto;
    transition: transform .4s var(--ease-out);
}
.header-brand:hover img { transform: scale(1.06) rotate(-3deg); }

.brand-text { display: flex; flex-direction: column; color: #fff; }
.brand-text strong {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .1em;
    line-height: 1.1;
}
.brand-text small {
    font-family: var(--font-head);
    font-size: .625rem;
    font-weight: 400;
    letter-spacing: .1em;
    color: var(--ink-300);
    text-transform: uppercase;
}

.main-nav { margin-left: auto; }
.main-nav > ul { display: flex; align-items: center; }
.main-nav > ul > li { position: relative; }

.main-nav > ul > li > a,
.main-nav > ul > li > button {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--header-h);
    padding: 0 var(--sp-3);
    font-family: var(--font-head);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--ink-300);
    transition: color .22s var(--ease);
}
/* ตัวกระตุ้น dropdown เป็น <button> จริงเพื่อให้ใช้คีย์บอร์ดได้ — ล้างสไตล์ปุ่มเริ่มต้น */
.main-nav > ul > li > button {
    background: none;
    border: 0;
    cursor: pointer;
    line-height: inherit;
}
/* ขีดแดงกวาดขึ้นจากล่าง */
.main-nav > ul > li > a::after,
.main-nav > ul > li > button::after {
    content: '';
    position: absolute;
    left: var(--sp-3);
    right: var(--sp-3);
    bottom: 18px;
    height: 2px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease-out);
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li > button:hover { color: #fff; }
.main-nav > ul > li > a:hover::after,
.main-nav > ul > li > button:hover::after { transform: scaleX(1); }
.main-nav > ul > li > a.active,
.main-nav > ul > li > button.active { color: #fff; }
.main-nav > ul > li > a.active::after,
.main-nav > ul > li > button.active::after { transform: scaleX(1); }

.caret {
    display: inline-block;
    width: 5px; height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    margin-left: 5px;
    opacity: .7;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 216px;
    background: var(--ink-800);
    border: var(--rule-dark);
    border-top: 2px solid var(--red);
    box-shadow: var(--shadow-lift);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .26s var(--ease), transform .26s var(--ease-out), visibility .26s;
    z-index: 50;
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown li a {
    display: block;
    padding: 12px 18px;
    font-size: var(--fs-sm);
    color: var(--ink-300);
    border-bottom: var(--rule-dark);
    transition: var(--transition);
    /* ห้าม transition `visibility` ที่สืบทอดมา ไม่งั้นลิงก์ยังโฟกัสได้หลังเมนูปิดไปแล้ว */
    transition-property: color, background-color, padding-left;
}
.dropdown li:last-child a { border-bottom: 0; }
.dropdown li a:hover { background: var(--red); color: #fff; padding-left: 24px; }

.menu-toggle {
    display: none;
    background: none;
    border: 0;
    cursor: pointer;
    margin-left: auto;
    padding: 10px; /* เข้าใกล้ 44px best practice */
}
.menu-toggle span {
    display: block;
    width: 24px; height: 2px;
    background: #fff;
    margin: 5px 0;
    transition: transform .3s var(--ease), opacity .2s;
}
body.nav-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------------------------------------------------------------
   6. PAGE HERO — ตัดเฉียง ตัวอักษรใหญ่ ลายน้ำ
   --------------------------------------------------------------------- */
.page-hero {
    position: relative;
    background: var(--ink-900);
    color: #fff;
    padding: clamp(48px, 8vw, 92px) 0 clamp(56px, 9vw, 104px);
    overflow: hidden;
}
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(58% 70% at 8% 0%, rgba(215, 0, 15, .30) 0%, transparent 60%),
        radial-gradient(50% 60% at 96% 108%, rgba(126, 0, 9, .40) 0%, transparent 58%);
}
/* ลายน้ำชื่อสโมสร — ย่อตามจอ ไม่ล้น */
.page-hero::after {
    content: 'SONGKHLA FC';
    position: absolute;
    right: -.04em;
    bottom: -.30em;
    font-family: var(--font-head);
    font-size: clamp(3.5rem, 13vw, 11rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1;
    color: rgba(255, 255, 255, .045);
    white-space: nowrap;
    pointer-events: none;
}
.page-hero > .container { position: relative; z-index: 2; }

.page-hero h1 {
    font-size: var(--fs-h1);
    font-weight: 700;
    color: #fff;
}
.page-hero .breadcrumb {
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--ink-300);
    margin-top: var(--sp-3);
}
.page-hero .breadcrumb a {
    display: inline-block;
    padding: 6px 4px; /* เป้าแตะ ≥24px (WCAG 2.5.8) */
    color: var(--ink-300);
    transition: color .2s;
}
.page-hero .breadcrumb a:hover { color: var(--red-hot); }

/* ---------------------------------------------------------------------
   7. CARDS
   --------------------------------------------------------------------- */
.card {
    position: relative;
    background: var(--paper-2);
    border: var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lift);
    border-color: rgba(10, 10, 12, .2);
}

.news-card { display: flex; flex-direction: column; }
.news-card .news-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--ink-800);
}
.news-card .news-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .7s var(--ease-out), filter .5s;
}
.news-card:hover .news-thumb img { transform: scale(1.07); }

/* ใบมีดแดงกวาดตอน hover */
.news-card .news-thumb::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .45s var(--ease-out);
}
.news-card:hover .news-thumb::after { transform: scaleX(1); }

.news-card .news-body {
    padding: var(--sp-4) var(--sp-5) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex: 1;
}
.news-card .news-date {
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--red);
}
.news-card h3 {
    font-size: var(--fs-h3);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .25s;
}
.news-card:hover h3 { color: var(--red); }

.badge-cat {
    position: absolute;
    top: var(--sp-3);
    left: var(--sp-3);
    z-index: 2;
    background: var(--red);
    color: #fff;
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    padding: 5px 11px;
    border-radius: var(--radius);
}

/* ---------------------------------------------------------------------
   8. TABLES — ตารางคะแนนแบบสกอร์บอร์ด
   --------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    max-width: 100%;
    /* กรอบย้ายมาไว้ที่ container นี้แทนตัว <table> — border-collapse บวกพื้นหลังทึบ
       ของหัวตารางเคยบังเส้นขอบบนจนกรอบดูไม่เท่ากันทั้ง 4 ด้าน ห่อด้วยกรอบเดียว
       ตรงนี้แทนจึงสม่ำเสมอแน่นอนไม่ว่าเนื้อในจะเป็นอะไร */
    border: var(--rule);
    border-radius: var(--radius);
}

/* สำคัญ: grid/flex item ที่ห่อตารางต้องตั้ง min-width:0
   ค่า default ของ grid item คือ min-width:auto ทำให้ไม่ยอมหดเล็กกว่าเนื้อหา
   ผลคือ overflow-x ของ .table-wrap ข้างในไม่ทำงาน แล้วตารางดันหน้าเว็บกว้างเกินจอ */
.table-wrap,
.standings-col,
.standings-comp-panel,
.standings-panel { min-width: 0; }

table.standings {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    background: var(--paper-2);
    font-size: var(--fs-sm);
}
table.standings th {
    background: var(--ink-900);
    color: var(--bone);
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    padding: 13px 10px;
    text-align: center;
    white-space: nowrap;
}
table.standings td {
    padding: 11px 10px;
    text-align: center;
    border-bottom: var(--rule);
    font-family: var(--font-num);
    font-size: 1.0625rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink-700);
}
table.standings td:first-child { color: var(--ink-400); }
/* สำคัญ: <td> ต้องคงความเป็น table-cell ไว้
   ถ้าตั้ง display:flex ที่ตัว <td> มันจะหลุดจากอัลกอริทึมของตาราง
   ทำให้ border-bottom วาดตามความสูงของกล่อง flex (49px) แทนความสูงของแถว (60px)
   เส้นขอบจึงเหลื่อมกับช่องอื่น — จัด flex ที่ .tc-inner ข้างในแทน */
table.standings td.team-cell {
    display: table-cell;
    vertical-align: middle;
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--ink-800);
    white-space: nowrap;
}
table.standings .tc-inner {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    vertical-align: middle;
}
table.standings .tc-inner img,
table.standings .tc-inner .st-crest {
    flex-shrink: 0;
}
table.standings .tc-inner img {
    height: 26px; width: 26px;
    object-fit: contain;
}
table.standings tbody tr { transition: background .2s; }
table.standings tbody tr:hover { background: var(--paper); }
table.standings tbody tr:last-child td { border-bottom: 0; }

table.standings tr.is-club {
    background: var(--red-wash);
    box-shadow: inset 3px 0 0 var(--red);
}
table.standings tr.is-club td { font-weight: 700; color: var(--ink-900); }
table.standings tr.is-club:hover { background: rgba(215, 0, 15, .12); }

/* ---------------------------------------------------------------------
   9. PAGINATION
   --------------------------------------------------------------------- */
.pagination {
    display: flex;
    gap: var(--sp-2);
    justify-content: center;
    align-items: center;
    margin-top: var(--sp-8);
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    font-family: var(--font-head);
    font-size: var(--fs-sm);
    font-weight: 600;
    background: var(--paper-2);
    border: var(--rule);
    border-radius: var(--radius);
    transition: var(--transition);
}
.pagination a:hover { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.pagination .active, .pagination span[aria-current] {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.pagination span[aria-disabled] { opacity: .35; }

/* ---------------------------------------------------------------------
   10. FOOTER
   --------------------------------------------------------------------- */
.site-footer {
    position: relative;
    background: var(--ink-900);
    color: var(--ink-300);
    /* ไม่ใส่ margin-top — เดิมมี 96px ทำให้เห็นพื้นหลัง body สีครีมเป็นแถบขาว
       คั่นก่อน footer ทุกหน้า footer มี padding ในตัวอยู่แล้ว (64px) จึงไม่อึดอัด */
    overflow: hidden;
}
.site-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 80% at 0% 0%, rgba(215, 0, 15, .16) 0%, transparent 58%);
}
.site-footer::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--red) 0%, var(--red-deep) 40%, transparent 75%);
}

.footer-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: var(--sp-7);
    padding-top: var(--sp-8);
    padding-bottom: var(--sp-7);
}
.footer-brand img { height: 72px; margin-bottom: var(--sp-4); }
.footer-brand h3 {
    color: #fff;
    font-size: 1.25rem;
    letter-spacing: .04em;
}
.footer-motto {
    font-family: var(--font-head);
    color: var(--red);
    font-weight: 700;
    letter-spacing: .26em;
    font-size: var(--fs-label);
    text-transform: uppercase;
    margin: var(--sp-2) 0 var(--sp-4);
}
.footer-brand p, .footer-contact p {
    font-size: var(--fs-xs);
    line-height: 1.85;
    color: var(--ink-300);
}
.site-footer h4 {
    color: #fff;
    font-family: var(--font-head);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 2px solid var(--red);
    display: inline-block;
}
.footer-links li { margin-bottom: var(--sp-3); }
.footer-links a {
    position: relative;
    display: inline-block;
    padding: 6px 0; /* เป้าแตะสูง ≥24px (WCAG 2.5.8) */
    font-size: var(--fs-xs);
    color: var(--ink-300);
    transition: color .22s var(--ease), padding-left .22s var(--ease);
}
.footer-links a::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    width: 0; height: 1px;
    background: var(--red);
    transition: width .25s var(--ease-out);
}
.footer-links a:hover { color: #fff; padding-left: 16px; }
.footer-links a:hover::before { width: 10px; }
.footer-contact .btn { margin-top: var(--sp-4); }

.footer-bottom {
    position: relative;
    z-index: 1;
    border-top: var(--rule-dark);
    padding: var(--sp-4) 0;
    font-size: var(--fs-label);
    letter-spacing: .04em;
}
.footer-bottom .container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-2);
    color: var(--ink-300); /* 7.10:1 บนพื้น --ink-900 (เดิม --ink-400 = 3.93:1) */
}

/* ---------------------------------------------------------------------
   11. UTILITIES / STATES
   --------------------------------------------------------------------- */
.empty-note, .empty-state {
    padding: var(--sp-8) var(--sp-5);
    text-align: center;
    color: var(--ink-400);
    border: 1px dashed rgba(10, 10, 12, .18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .5);
}
.section-dark .empty-note, .section-dark .empty-state {
    border-color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .03);
    color: var(--ink-300);
}
.empty-state .empty-icon { font-size: 2rem; margin-bottom: var(--sp-3); opacity: .6; }

/* เผยตัวแบบไล่จังหวะ — ซ่อนเฉพาะเมื่อ JS ทำงาน (กันเนื้อหาหายถ้า JS พัง) */
.js-reveal [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
}
.js-reveal [data-reveal].in {
    opacity: 1;
    transform: none;
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .js-reveal [data-reveal] { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   12. RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .main-nav > ul > li > a,
    .main-nav > ul > li > button { padding: 0 10px; font-size: .78125rem; }
}

@media (max-width: 1000px) {
    :root { --header-h: 68px; }

    .menu-toggle { display: block; }

    .main-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        width: 100%;
        height: calc(100dvh - var(--header-h));
        background: var(--ink-900);
        transform: translateX(100%);
        /* visibility ตัดเมนูที่ปิดอยู่ออกจากลำดับ tab จริง ๆ (WCAG 2.4.7 / 2.4.11)
           หน่วงจนสไลด์จบเพื่อให้แอนิเมชันยังเหมือนเดิม */
        visibility: hidden;
        transition: transform .38s var(--ease-out), visibility 0s .38s;
        overflow-y: auto;
        overscroll-behavior: contain;
        margin-left: 0;
    }
    body.nav-open { overflow: hidden; }
    body.nav-open .main-nav {
        transform: translateX(0);
        visibility: visible;
        transition: transform .38s var(--ease-out), visibility 0s;
    }

    .main-nav > ul { flex-direction: column; align-items: stretch; padding: var(--sp-4) var(--sp-5) var(--sp-8); }
    .main-nav > ul > li > a,
    .main-nav > ul > li > button {
        height: auto;
        width: 100%;
        padding: var(--sp-4) 0;
        font-size: 1rem;
        color: #fff;
        border-bottom: var(--rule-dark);
    }
    .main-nav > ul > li > a::after,
    .main-nav > ul > li > button::after { display: none; }

    .dropdown {
        position: static;
        opacity: 1;
        /* inherit ไม่ใช่ visible — เมนูย่อยต้องถูกซ่อนตามเมนูหลักตอนปิด */
        visibility: inherit;
        /* ตัด transition ของ visibility ที่สืบทอดมาจากกฎ desktop
           มิฉะนั้นลิงก์ย่อยจะยังโฟกัสได้อีก .26s หลังปิดเมนู */
        transition: none;
        transform: none;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--red);
        background: transparent;
        margin: 0 0 var(--sp-2) var(--sp-2);
        min-width: 0;
    }
    .dropdown li a { padding: 11px var(--sp-4); border-bottom: 0; }
    .dropdown li a:hover { padding-left: var(--sp-5); }

    .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
}

@media (max-width: 640px) {
    .section { padding: var(--sp-7) 0; }
    .section-loose { padding: var(--sp-8) 0; }
    .section-tight { padding: var(--sp-6) 0; }

    .section-title { flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; }
    .section-title .title-link { margin-left: auto; }

    .header-brand img { height: 40px; }
    .brand-text strong { font-size: .875rem; }
    .brand-text small { display: none; }

    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom .container { justify-content: center; text-align: center; }
}
