/* =========================================================
   ADSC Portal — Silpakorn University
   Mobile-first • Dark mode • Modern effects
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --brand: #00756a;
  --brand-2: #00a896;
  --accent: #f4b740;
  --bg: #f5f8f8;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #0f2a28;
  --muted: #5b7370;
  --line: rgba(15, 42, 40, .10);
  --glass: rgba(255, 255, 255, .72);
  --shadow: 0 10px 30px -12px rgba(0, 60, 55, .25);
  --shadow-lg: 0 30px 60px -20px rgba(0, 60, 55, .35);
  --radius: 20px;
  --font: "Noto Sans Thai", system-ui, sans-serif;
  --font-head: "Prompt", "Noto Sans Thai", sans-serif;
  --gutter: clamp(16px, 4vw, 32px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg: #071615;
  --surface: #0e2321;
  --surface-2: #0b1d1b;
  --text: #e7f4f2;
  --muted: #8fb0ac;
  --line: rgba(231, 244, 242, .10);
  --glass: rgba(10, 30, 28, .70);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
  --brand: #19c3ae;
  --brand-2: #5eead4;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.65; overflow-x: hidden; transition: background .3s, color .3s;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
kbd {
  font: 500 .72rem/1 var(--font); padding: 3px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; border-radius: 8px; }
.container { width: min(1200px, 100% - var(--gutter) * 2); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Header ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass); backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line); transition: box-shadow .3s;
}
.nav.is-scrolled { box-shadow: var(--shadow); }
.nav__inner { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  font: 700 1rem var(--font-head); color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px -6px var(--brand);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font: 600 1rem var(--font-head); }
.brand__text small { color: var(--muted); font-size: .72rem; }

.nav__links { display: flex; gap: 4px; margin-inline: auto; }
.nav__links a {
  padding: 8px 16px; border-radius: 999px; font-weight: 500; color: var(--muted);
  transition: background .2s, color .2s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

.nav__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav__links + .nav__actions { margin-left: 0; }
.btn-search {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  transition: border-color .2s, box-shadow .2s;
}
.btn-search:hover { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 1.3rem; transition: transform .2s var(--ease);
}
.icon-btn:hover { transform: translateY(-2px); }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

.burger { display: none; flex-direction: column; gap: 4px; }
.burger span { width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons / small bits ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; font-weight: 600;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s;
}
.btn:hover { transform: translateY(-3px); }
.btn--primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 14px 28px -10px var(--brand); }
.btn--primary:hover { box-shadow: 0 20px 34px -10px var(--brand); }
.btn--ghost { background: var(--surface); border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--brand); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: blink 1.6s infinite; }
.kicker { font-size: .75rem; font-weight: 600; letter-spacing: .16em; color: var(--brand); }
.pill { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(48px, 9vw, 112px) 0 clamp(56px, 8vw, 96px); isolation: isolate; }
.hero__inner { display: grid; gap: 48px; align-items: center; grid-template-columns: 1.1fr .9fr; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.6rem); margin: 18px 0 16px; letter-spacing: -.01em; }
.grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% 100%; animation: shine 6s linear infinite;
}
.lead { max-width: 56ch; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.stats { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-top: 40px; }
.stats b { display: block; font: 700 2rem/1 var(--font-head); color: var(--brand); }
.stats span { font-size: .82rem; color: var(--muted); }

.blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .5; animation: float 14s ease-in-out infinite; }
.blob--a { width: 420px; height: 420px; background: var(--brand-2); top: -120px; right: -80px; }
.blob--b { width: 320px; height: 320px; background: var(--accent); bottom: -100px; left: 8%; opacity: .32; animation-delay: -5s; }
.blob--c { width: 260px; height: 260px; background: var(--brand); top: 30%; left: -80px; opacity: .25; animation-delay: -9s; }
.grid-bg {
  position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 70%);
}

/* Hero visual */
.hero__visual { position: relative; transform-style: preserve-3d; transition: transform .2s ease-out; }
.orbit { position: relative; aspect-ratio: 1; max-width: 460px; margin-inline: auto; }
.orbit__ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, transparent); animation: spin 40s linear infinite; }
.orbit__ring--1 { inset: 4%; }
.orbit__ring--2 { inset: 22%; animation-direction: reverse; animation-duration: 28s; }
.orbit__core {
  position: absolute; inset: 34%; border-radius: 50%; display: grid; place-content: center; text-align: center;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 12px color-mix(in srgb, var(--brand) 14%, transparent), var(--shadow-lg);
}
.orbit__core span { font: 700 clamp(1.4rem, 4vw, 2.2rem) var(--font-head); }
.orbit__core small { font-size: .5rem; letter-spacing: .12em; opacity: .85; line-height: 1.4; }
.chip {
  position: absolute; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 500; white-space: nowrap;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow); animation: bob 5s ease-in-out infinite;
}
.chip i { font-style: normal; color: var(--brand); }
.chip--1 { top: 4%; left: 8%; }
.chip--2 { top: 14%; right: -2%; animation-delay: -1s; }
.chip--3 { bottom: 26%; left: -4%; animation-delay: -2s; }
.chip--4 { bottom: 10%; right: 6%; animation-delay: -3s; }
.chip--5 { top: 46%; right: -8%; animation-delay: -4s; }

.status-card {
  margin: -36px auto 0; position: relative; max-width: 360px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; gap: 12px;
}
.status-row { display: flex; align-items: center; gap: 12px; }
.status-row small { display: block; font-size: .7rem; color: var(--muted); line-height: 1.2; }
.status-row strong { font-size: .9rem; }
.pulse { position: relative; width: 10px; height: 10px; margin: 0 7px; border-radius: 50%; background: #22c55e; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #22c55e; animation: ping 1.8s infinite; }
.ico { display: grid; place-items: center; width: 24px; color: var(--brand); }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section--tint { background: var(--surface-2); border-block: 1px solid var(--line); }
.section__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.section__head h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 6px 0; }
.section__head p { color: var(--muted); max-width: 52ch; }

/* Filters */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none; padding: 9px 18px; border-radius: 999px; font-weight: 500; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--line); transition: all .25s var(--ease);
}
.filters button:hover { border-color: var(--brand); }
.filters button.is-active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 20px -8px var(--brand); }

/* Cards */
.cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card {
  --mx: 50%; --my: 0%;
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px; min-height: 230px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s, border-color .35s;
  animation: pop .5s var(--ease) both;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx) var(--my), color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%);
}
.card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease);
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.card:hover::before { opacity: 1; }
.card:hover::after { transform: scaleX(1); }
.card__top { display: flex; align-items: center; justify-content: space-between; }
.card__icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 1.5rem; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 20px -8px var(--brand);
  transition: transform .4s var(--ease);
}
.card:hover .card__icon { transform: rotate(-8deg) scale(1.1); }
.tag { font-size: .68rem; font-weight: 600; letter-spacing: .12em; padding: 4px 10px; border-radius: 999px; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.card h3 { font-size: 1.2rem; }
.card p { color: var(--muted); font-size: .92rem; flex: 1; }
.card__foot { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: .9rem; color: var(--brand); }
.card__foot .arrow { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 12%, transparent); transition: transform .3s var(--ease), background .3s, color .3s; }
.card:hover .arrow { transform: translate(3px, -3px) rotate(0deg); background: var(--brand); color: #fff; }
.card.is-soon .card__foot { color: var(--muted); }
.card.is-soon .tag--state { color: #9a6a00; background: color-mix(in srgb, var(--accent) 25%, transparent); }
.empty { text-align: center; padding: 40px; color: var(--muted); }

/* Quick */
.quick { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.quick__item {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s;
}
.quick__item:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--brand); }
.quick__ico { font-size: 1.8rem; margin-bottom: 8px; }
.quick__item small { color: var(--muted); }
.quick__item i { position: absolute; top: 20px; right: 22px; font-style: normal; color: var(--brand); transition: transform .3s var(--ease); }
.quick__item:hover i { transform: translate(4px, -4px); }

/* Timeline */
.timeline { position: relative; display: grid; gap: 18px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--brand), transparent); }
.timeline li { position: relative; display: flex; gap: 18px; align-items: flex-start; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 26px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 20%, transparent); }
.timeline__tag { flex: none; padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.timeline p { color: var(--muted); font-size: .92rem; }

/* Footer */
.footer { padding: 32px 0; border-top: 1px solid var(--line); background: var(--surface); }
.footer__inner { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.footer__links { display: flex; gap: 20px; color: var(--muted); font-size: .9rem; }
.footer__links a:hover { color: var(--brand); }

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 46px; height: 46px; border-radius: 50%;
  color: #fff; font-size: 1.2rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease);
}
.to-top.is-show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Search dialog ---------- */
.search { width: min(640px, calc(100% - 24px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.search::backdrop { background: rgba(3, 20, 18, .55); backdrop-filter: blur(6px); animation: fade .25s; }
.search[open] { animation: drop .35s var(--ease); }
.search__box { margin: 0; }
.search__bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search__bar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 400 1.05rem var(--font); color: var(--text); }
.search__list { max-height: 50vh; overflow: auto; padding: 8px; }
.search__list a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; }
.search__list a:hover, .search__list a.is-sel { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.search__list .card__icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 12px; flex: none; }
.search__list b { display: block; font-size: .95rem; }
.search__list small { color: var(--muted); }
.search__none { padding: 28px; text-align: center; color: var(--muted); }
.search__hint { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
.search__hint kbd { margin-right: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90; padding: 12px 22px; border-radius: 999px; font-size: .9rem;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: all .35s var(--ease);
}
.toast.is-show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */
@keyframes float { 50% { transform: translate(30px, -30px) scale(1.08); } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shine { to { background-position: 200% 0; } }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-16px) scale(.97); } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; gap: 32px; }
  .hero__visual { max-width: 460px; margin-inline: auto; width: 100%; }
  .btn-search span, .btn-search kbd { display: none; }
  .btn-search { padding: 0; width: 40px; height: 40px; justify-content: center; border-radius: 12px; }
}
@media (max-width: 820px) {
  .burger { display: flex; }
  .nav__actions { margin-left: auto; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0; flex-direction: column; padding: 12px var(--gutter) 20px;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    clip-path: inset(0 0 100% 0); opacity: 0; pointer-events: none; transition: clip-path .4s var(--ease), opacity .3s;
  }
  .nav__links.is-open { clip-path: inset(0); opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 14px 16px; border-radius: 14px; }
}
@media (max-width: 560px) {
  .brand__text small { display: none; }
  .hero__cta .btn { flex: 1 1 100%; }
  .stats { gap: 14px 24px; }
  .chip { font-size: .72rem; padding: 6px 10px; }
  .chip--2, .chip--5 { right: 0; }
  .chip--3 { left: 0; }
  .timeline li { flex-direction: column; gap: 8px; padding: 16px; }
  .footer__inner { flex-direction: column; text-align: center; }
  .search { margin-top: 6vh; }
  .search__hint { display: none; }
}

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

/* Thai typography: preserve readable Thai line wrapping. */
:where(h1, h2, h3, p, .lead, .card__foot, .quick__item, .timeline li, .brand__text) { word-break: normal; overflow-wrap: break-word; line-break: loose; }
.hero h1 { line-height: 1.34; text-wrap: balance; }
.card h3 { line-height: 1.45; }

/* Portal compact desktop: keep the first view within a standard laptop viewport. */
@media (min-width: 961px) {
  .hero { min-height: calc(100svh - 68px); display: flex; align-items: center; padding-block: clamp(28px, 5vh, 56px); }
  .hero__inner { gap: clamp(28px, 4vw, 44px); }
  .hero h1 { font-size: clamp(2rem, 4.1vw, 3.25rem); margin-block: 14px; }
  .hero__cta { margin-top: 22px; }
  .stats { margin-top: 28px; }
  .orbit { max-width: clamp(320px, 32vw, 420px); }
}
