/* MJG Portal — one stylesheet for every page. No build step, no JS. */

:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #ecece7;
  --ink: #121212;
  --ink-2: #44443f;
  --ink-3: #66665f;
  --line: #e0e0da;
  --line-strong: #c9c9c1;
  --logo-filter: none;

  /* per-section accent: tile background + icon colour */
  --dji-tile: #fbe9ec;     --dji-ink: #b0001f;
  --ef-tile: #ebeeef;      --ef-ink: #24343a;
  --pda-tile: #e6f3e9;     --pda-ink: #2f7a41;
  --ev-tile: #2c2c6d;      --ev-ink: #dffe27;
  --staff-tile: #ecece7;   --staff-ink: #121212;

  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0f;
    --surface: #18181a;
    --surface-2: #232326;
    --ink: #f2f2ef;
    --ink-2: #c4c4be;
    --ink-3: #9a9a94;
    --line: #2c2c30;
    --line-strong: #44444a;
    --logo-filter: invert(1);

    --dji-tile: #3a1219;     --dji-ink: #ff8094;
    --ef-tile: #1f2a2e;      --ef-ink: #b9d3db;
    --pda-tile: #15301d;     --pda-ink: #8fd6a0;
    --ev-tile: #2c2c6d;      --ev-ink: #dffe27;
    --staff-tile: #232326;   --staff-ink: #f2f2ef;

    --shadow: none;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 28px; } }

/* ---------- header ---------- */
.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; filter: var(--logo-filter); }
.brand small { font-weight: 500; color: var(--ink-3); font-size: 14px; }
.top-link {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface);
}
.top-link:hover { border-color: var(--ink-3); }

/* ---------- hero ---------- */
.hero { padding: 48px 0 8px; }
@media (min-width: 640px) { .hero { padding: 72px 0 16px; } }
.eyebrow { margin: 0 0 12px; font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.02em; }
.hero h1 {
  margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.2; font-weight: 700;
  letter-spacing: -0.02em; max-width: 16ch; text-wrap: balance;
}
.lead { margin: 18px 0 0; font-size: clamp(1rem, 2.2vw, 1.15rem); color: var(--ink-2); max-width: 60ch; }

.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; }
.jump a {
  display: inline-block; text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.jump a:hover { border-color: var(--ink-3); }

.notice {
  margin: 24px 0 0; padding: 14px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 15px;
}
.notice strong { color: var(--ink); }

/* ---------- sections ---------- */
main { padding-bottom: 24px; }
.section { padding: 44px 0 0; scroll-margin-top: 16px; }
.section-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .section-head { flex-direction: row; align-items: center; gap: 18px; } }
.section-logo { height: 30px; width: auto; filter: var(--logo-filter); }
.section-logo--mark { height: 34px; }
.section-logo--siamef { height: 44px; }
.ev-badge {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--ev-tile); color: var(--ev-ink);
}
.ev-badge svg { width: 24px; height: 20px; }
.section-head h2 { margin: 0; font-size: clamp(1.3rem, 3vw, 1.6rem); line-height: 1.3; letter-spacing: -0.01em; }
.section-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 15px; }
.section-head .titles { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

/* ---------- cards ---------- */
.card {
  position: relative;
  display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: start;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
a.card:hover, .card.has-actions:hover { border-color: var(--line-strong); }
a.card:hover { transform: translateY(-1px); }
a.card:hover .arrow { transform: translate(2px, -2px); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .card, .arrow { transition: none; } a.card:hover { transform: none; } }

.tile {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--tile, var(--staff-tile)); color: var(--tile-ink, var(--staff-ink));
}
.tile svg { width: 22px; height: 22px; }
.is-dji   { --tile: var(--dji-tile);   --tile-ink: var(--dji-ink); }
.is-ef    { --tile: var(--ef-tile);    --tile-ink: var(--ef-ink); }
.is-pda   { --tile: var(--pda-tile);   --tile-ink: var(--pda-ink); }
.is-ev    { --tile: var(--ev-tile);    --tile-ink: var(--ev-ink); }

.card-title { display: block; font-weight: 600; font-size: 17px; line-height: 1.4; }
.card-desc { display: block; margin-top: 3px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.card-url {
  display: block; margin-top: 8px; color: var(--ink-3); font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere;
}
.arrow { color: var(--ink-3); font-size: 18px; line-height: 1; padding-top: 2px; transition: transform .15s ease, color .15s ease; }

.badge {
  display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; vertical-align: 2px;
  font-size: 12px; font-weight: 600; line-height: 1.6; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge--warn { background: #fff1d6; color: #7a4a00; }
@media (prefers-color-scheme: dark) { .badge--warn { background: #3a2a0c; color: #ffd28a; } }

.card.is-soon { background: transparent; border-style: dashed; box-shadow: none; }
.card.is-soon .tile { opacity: .65; }
.card.is-soon .card-title { color: var(--ink-2); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 14px; font-weight: 600; text-decoration: none; background: var(--bg);
}
.actions a:hover { border-color: var(--ink); }

/* ---------- footer ---------- */
.foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 36px 0 40px; color: var(--ink-2); font-size: 15px; }
.foot-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.foot h2 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; }
.foot ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot .company { display: flex; gap: 12px; align-items: flex-start; }
.foot .company img { width: 32px; height: 32px; filter: var(--logo-filter); margin-top: 2px; }
.foot .company strong { display: block; color: var(--ink); }
.legal { margin: 32px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------- 404 ---------- */
.lost { padding: 96px 0; }
.lost h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 5vw, 2.6rem); }
.lost p { margin: 0 0 24px; color: var(--ink-2); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.notice + .grid { margin-top: 12px; }
.section-head > .tile { flex: none; }
/* keep Thai loanwords (โดรน) whole — the line breaker splits them mid-word */
.nw { white-space: nowrap; }
