/* ==========================================================================
   TJW Smart Grading — Design Tokens (Prototype)
   ชุดสี: Summer Ocean Breeze (กำหนดโดยผู้ใช้) · โครงสร้างสถานะ/ตัวอักษร/ระยะ อิง TJW Examination DS
   ========================================================================== */

@font-face { font-family: "Noto Sans Thai"; font-weight: 400; font-display: swap;
  src: url("../fonts/noto-sans-thai-thai-400-normal.87021b82a4c5.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 600; font-display: swap;
  src: url("../fonts/noto-sans-thai-thai-600-normal.bc9a6ab0d43f.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 700; font-display: swap;
  src: url("../fonts/noto-sans-thai-thai-700-normal.117522ffc3b8.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 400; font-display: swap;
  src: url("../fonts/noto-sans-thai-latin-400-normal.bbabe5759d08.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2026, U+20AC, U+2122; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 600; font-display: swap;
  src: url("../fonts/noto-sans-thai-latin-600-normal.1608210adb74.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2026, U+20AC, U+2122; }
@font-face { font-family: "Noto Sans Thai"; font-weight: 700; font-display: swap;
  src: url("../fonts/noto-sans-thai-latin-700-normal.82792be00e4e.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2026, U+20AC, U+2122; }

:root {
  /* ======================================================================
     SUMMER OCEAN BREEZE — ชุดสีหลักของ TJW Smart Grading
     ค่าที่ผู้ใช้กำหนด (ห้ามเปลี่ยน):
       --sob-honeydew  #F1FAEE  พื้นหลังหลัก
       --sob-white     #FFFFFF  การ์ด ตาราง ช่องกรอก
       --sob-navy      #1D3557  เมนูด้านข้าง หัวข้อ ข้อความหลัก
       --sob-steel     #457B9D  ปุ่มหลัก (ข้อความขาว 4.59:1)
       --sob-powder    #A8DADC  รายการที่เลือก/ส่วนเน้น (ข้อความ navy 8.08:1)
       --sob-red       #E63946  ข้อผิด ข้อผิดพลาด ปุ่มลบ (ใช้กับไอคอน/เส้นขอบ/แถบ)
       --sob-green     #2E7D32  ข้อถูก สถานะสำเร็จ
     เฉดเสริมที่เพิ่มเพื่อให้ผ่าน WCAG AA (ตรวจด้วยสูตร WCAG 2.x):
       --sob-red-text   #B71C2C  ตัวอักษรแดงบนพื้นขาว 6.53:1 (#E63946 ได้ 4.17:1 ไม่ผ่านตัวอักษรเล็ก)
       --sob-green-text #24662A  ตัวอักษรเขียวบนพื้นเขียวอ่อน (#2E7D32 บน tint ได้ 4.39:1)
       --sob-ink-muted  #3D5068  ข้อความรอง 7.72:1 บนพื้นหลัก · 5.39:1 บน #A8DADC
     ====================================================================== */
  --sob-honeydew: #F1FAEE; --sob-white: #FFFFFF; --sob-navy: #1D3557; --sob-steel: #457B9D;
  --sob-powder: #A8DADC; --sob-red: #E63946; --sob-green: #2E7D32;
  --sob-red-text: #B71C2C; --sob-green-text: #24662A; --sob-ink-muted: #3D5068;

  /* ---------- Semantic tokens (ทุกหน้าใช้ชุดนี้) ---------- */
  --surface-page: var(--sob-honeydew);
  --surface-card: var(--sob-white);
  --surface-sunken: #F7FBF6;          /* หัวตาราง / พื้นรองในการ์ด */
  --surface-hover: #E9F5F5;           /* hover แถว/ปุ่มเงียบ (อ่อนกว่า selected) */
  --surface-selected: var(--sob-powder);
  --on-selected: var(--sob-navy);
  --border: #B9CBD6;                  /* ขอบช่องกรอก 1.6:1 + มี label เสมอ */
  --border-strong: #6E8DA3;           /* ขอบปุ่ม/การ์ดเลือก ≥3:1 บนพื้นขาว */
  --border-subtle: #DCE8EC;
  --ink: var(--sob-navy);
  --ink-muted: var(--sob-ink-muted);
  --ink-subtle: #4A5C73;              /* 6.4:1 บนพื้นหลัก — ห้ามวางบน #A8DADC */
  --link: #2E5C7A;                    /* steel เข้มขึ้นสำหรับลิงก์ตัวเล็ก (#457B9D บนพื้นหลักได้ 4.29:1) */
  --focus-ring: var(--sob-steel);     /* 4.3:1 บนพื้นหลัก (เกณฑ์ non-text 3:1) */
  --focus-ring-on-dark: var(--sob-powder);

  /* Primary action */
  --primary: var(--sob-steel);
  --primary-hover: #3A6886;           /* 5.99:1 กับข้อความขาว */
  --primary-active: var(--sob-navy);
  --primary-disabled: #A9C3D3;        /* + cursor not-allowed + ข้อความบอกเหตุผล */
  --on-primary: #FFFFFF;

  /* Navigation (topbar + sidebar) */
  --nav-bg: var(--sob-navy);
  --nav-ink: #DCE8EE;                 /* 9.9:1 */
  --nav-ink-muted: #A8C6D6;           /* 6.89:1 */
  --nav-hover: rgba(255, 255, 255, .08);
  --nav-active-bg: var(--sob-powder);
  --nav-active-ink: var(--sob-navy);

  /* Legacy names used across components → map to Ocean Breeze */
  --brand-900: var(--sob-navy);
  --brand-700: var(--sob-navy);
  --brand-600: #2A4A6E;
  --brand-500: var(--sob-steel);
  --brand-400: #6A9BB8;
  --brand-300: var(--sob-powder);
  --brand-200: #CDEBEC;
  --brand-100: var(--sob-powder);
  --brand-50: var(--surface-hover);
  --brand-500-rgb: 69, 123, 157;
  --brand-700-rgb: 29, 53, 87;
  --on-brand-muted: #CFE3EC;
  --brand-disabled: var(--primary-disabled);

  /* Status (fill / tint / text) — ทุกสถานะแสดงพร้อมไอคอนและข้อความ */
  --success-600: var(--sob-green); --success-100: #E3F1E4; --success-text: var(--sob-green-text);
  --danger-600: var(--sob-red);    --danger-100: #FDE7E9;  --danger-text: var(--sob-red-text);
  --warning-600: #F2B705;          --warning-100: #FFF4D6; --warning-text: #6B4A00; --warning-strong: #A16207;
  --info-600: var(--sob-steel);    --info-100: #E3EFF5;    --info-text: var(--sob-navy);
  --neutral-600: #5B6B7F;          --neutral-100: #E6ECF0; --neutral-text: var(--sob-ink-muted);

  /* Smart Grading: score lifecycle */
  --sg-local: var(--neutral-text);
  --sg-verified: var(--info-text);
  --sg-confirmed: var(--success-text);

  /* Camera overlay (dark UI) */
  --cam-bg: #0e1726;
  --cam-panel: #14223a;
  --cam-ink: #f8fafc;
  --cam-muted: #cbd5e1;
  --cam-guide: #ffffff;
  --cam-ok: #66BB6A;      /* เขียวสำเร็จเฉดสว่างสำหรับพื้นมืด (#2E7D32 มืดเกินบนกล้อง) */
  --cam-warn: #FBBF24;
  --cam-bad: #FF6B75;     /* แดงเฉดสว่างของ #E63946 สำหรับพื้นมืด */
  --cam-info: var(--sob-powder);

  /* Type (Examination DS) */
  --font-sans: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-display: 32px; --lh-display: 40px;
  --fs-h1: 24px; --lh-h1: 32px;
  --fs-h2: 18px; --lh-h2: 26px;
  --fs-body: 15px; --lh-body: 22px;
  --fs-label: 13px; --lh-label: 18px;
  --fs-caption: 12px; --lh-caption: 16px;

  /* Spacing (4-pt) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

  /* Radius */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-pill: 999px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-3: 0 16px 40px rgba(15, 23, 42, .18);

  /* Touch */
  --tap-min: 44px;
  --tap-primary: 52px;

  /* Layout */
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --sidebar-w: 248px;
  --content-max: 1200px;

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: .15s; --dur: .25s;
}


@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0s; --dur: 0s; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
