/* โรงเรียนวัฒนธรรมอิสลาม — หน้าเว็บหลัก wti.ac.th
   สีมาจากตราโรงเรียน: เขียวเข้มของวงนอก + ทอง/น้ำตาลของคบเพลิงและชั้นหนังสือ */

:root {
  --green-950: #062619;
  --green-900: #0a3a27;
  --green-800: #0f4e33;
  --green-700: #146441;
  --green-500: #1f8a57;
  --green-100: #e3f1e9;
  --gold-600: #a8822f;
  --gold-500: #c8a24a;
  --gold-200: #eedfb4;
  --cream: #faf6ec;
  --paper: #ffffff;
  --ink: #18241e;
  --muted: #56655d;
  --line: #e4ddc9;

  --font-th: "Noto Sans Thai", system-ui, sans-serif;
  --font-head: "Noto Serif Thai", "Noto Sans Thai", serif;
  --font-ar: "Amiri", "Noto Naskh Arabic", serif;

  --wrap: 1160px;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(10 58 39 / .06), 0 8px 24px rgb(10 58 39 / .08);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-th);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* grid ลูกต้องหดได้ ไม่งั้นข้อความไทยยาวๆ ดันหน้าล้นจอมือถือ */
.hero > .wrap > *, .about > *, .tracks > *, .admit > *, .contact > *, .identity > *, .pillars > * { min-width: 0; }
a { color: var(--green-700); }
a:hover { color: var(--green-500); }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.3; margin: 0 0 .5em; color: var(--green-900); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 14px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 2px; border-radius: 4px; }

/* ---------- ลวดลายเรขาคณิต (ดาวแปดแฉก) ---------- */
.pattern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23c8a24a' stroke-opacity='.16' stroke-width='1.2'%3E%3Cpath d='M40 8 49.4 30.6 72 40 49.4 49.4 40 72 30.6 49.4 8 40 30.6 30.6Z'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3Crect x='22' y='22' width='36' height='36'/%3E%3Cpath d='M0 0 8 8M80 0 72 8M0 80 8 72M80 80 72 72'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 80px 80px;
}

/* ---------- ส่วนหัว ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(250 246 236 / .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--green-900); margin-right: auto; }
.brand img { width: 44px; height: 44px; }
.brand b { display: block; font-family: var(--font-head); font-size: 1.05rem; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.2; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; color: var(--ink); font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { background: var(--green-100); color: var(--green-800); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .95rem/1 var(--font-th); text-decoration: none;
  padding: 12px 20px; border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-gold { background: var(--gold-500); color: var(--green-950); }
.btn-gold:hover { background: var(--gold-200); color: var(--green-950); }
.btn-green { background: var(--green-700); color: #fff; }
.btn-green:hover { background: var(--green-800); color: #fff; }
.btn-ghost { border-color: rgb(255 255 255 / .45); color: #fff; }
.btn-ghost:hover { border-color: var(--gold-200); color: var(--gold-200); }
.nav .btn { margin-left: 8px; padding: 10px 16px; }
.nav .btn-green, .nav .btn-green:hover { color: #fff; }

.menu-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--green-900); }
.menu-toggle svg { width: 28px; height: 28px; }

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--cream); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--green-900); color: #fff; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 75% 45%, rgb(31 138 87 / .45), transparent 60%);
  pointer-events: none;
}
.hero > .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr .75fr; gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 72px; }
.hero-ar { font-family: var(--font-ar); font-size: clamp(1.3rem, 2.4vw, 1.75rem); color: var(--gold-200); margin: 0 0 8px; direction: rtl; text-align: left; unicode-bidi: plaintext; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 6.4vw, 3.8rem); margin-bottom: 12px; }
.hero h1 span { display: block; font-size: .5em; font-family: var(--font-th); font-weight: 500; color: var(--gold-200); margin-top: 6px; }
.hero-motto { font-family: var(--font-head); font-size: clamp(1.1rem, 2vw, 1.35rem); color: #fff; border-left: 3px solid var(--gold-500); padding-left: 16px; margin: 24px 0 32px; }
.hero-motto small { display: block; font-family: var(--font-th); font-size: .8rem; color: rgb(255 255 255 / .7); margin-top: 2px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-seal { justify-self: center; position: relative; width: min(340px, 80vw); aspect-ratio: 1; }
.hero-seal::before { content: ""; position: absolute; inset: -18px; border-radius: 50%; border: 1px solid rgb(200 162 74 / .45); }
.hero-seal::after { content: ""; position: absolute; inset: -36px; border-radius: 50%; border: 1px dashed rgb(200 162 74 / .25); }
.hero-seal img { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 20px 60px rgb(0 0 0 / .35); }

.facts { position: relative; z-index: 1; border-top: 1px solid rgb(200 162 74 / .3); background: rgb(6 38 25 / .55); }
.facts ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.facts li { padding: 22px 20px 22px 0; border-right: 1px solid rgb(200 162 74 / .2); }
.facts li:last-child { border-right: 0; }
.facts li + li { padding-left: 20px; }
.facts b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--gold-200); line-height: 1.2; }
.facts span { font-size: .9rem; color: rgb(255 255 255 / .8); }

@media (max-width: 900px) {
  .hero > .wrap { grid-template-columns: 1fr; gap: 56px; padding-top: 48px; padding-bottom: 64px; }
  .hero-seal { order: -1; width: min(220px, 60vw); }
  .facts ul { grid-template-columns: repeat(2, 1fr); }
  .facts li:nth-child(2) { border-right: 0; }
  .facts li:nth-child(odd) { padding-left: 0; }
  .facts li:nth-child(-n+2) { border-bottom: 1px solid rgb(200 162 74 / .2); }
}

/* ---------- Section ทั่วไป ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--paper); }
.eyebrow { display: inline-block; font-size: .85rem; font-weight: 600; letter-spacing: .04em; color: var(--gold-600); margin-bottom: 8px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 720px; }
.section-head { margin-bottom: 48px; }
@media (max-width: 700px) { .section { padding: 64px 0; } }

/* ---------- เกี่ยวกับ / ประวัติ ---------- */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.about figure { margin: 0; }
.about figure img { border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 4/3; object-fit: cover; width: 100%; height: auto; }
.about figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }

.founder { margin-top: 28px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--gold-500); border-radius: var(--radius); }
.section-alt .founder { background: var(--cream); }
.founder h3 { margin-bottom: 4px; }
.founder .ar { font-family: var(--font-ar); color: var(--gold-600); font-size: 1.1rem; }
.founder p { font-size: .95rem; color: var(--muted); margin: 8px 0 0; }

.timeline { list-style: none; margin: 56px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 36px; }
.timeline li { position: relative; padding: 24px 20px 0 0; border-top: 2px solid var(--gold-200); }
.timeline li::before { content: ""; position: absolute; top: -8px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--gold-500); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--gold-500); }
.timeline b { display: block; font-family: var(--font-head); color: var(--green-800); font-size: 1.25rem; }
.timeline span { font-size: .92rem; color: var(--muted); }

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; gap: 32px; }
  .timeline { grid-template-columns: 1fr 1fr; row-gap: 28px; }
}
@media (max-width: 520px) {
  .timeline { grid-template-columns: 1fr; border-left: 2px solid var(--gold-200); margin-left: 6px; row-gap: 20px; }
  .timeline li { padding: 0 0 0 24px; border-top: 0; }
  .timeline li::before { top: 6px; left: -8px; }
}

/* ---------- ปรัชญา / อัตลักษณ์ ---------- */
.values { background: var(--green-900); color: #fff; }
.values h2, .values h3 { color: #fff; }
.values .lead { color: rgb(255 255 255 / .75); }
.motto-big { font-family: var(--font-head); font-size: clamp(1.6rem, 3.6vw, 2.6rem); color: var(--gold-200); margin: 0 0 40px; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar { padding: 28px; border: 1px solid rgb(200 162 74 / .3); border-radius: var(--radius); background: rgb(255 255 255 / .03); }
.pillar .num { font-family: var(--font-head); color: var(--gold-500); font-size: .95rem; }
.pillar p { color: rgb(255 255 255 / .78); margin: 0; font-size: .97rem; }

.identity { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.identity .card { padding: 28px; border-radius: var(--radius); background: var(--cream); color: var(--ink); }
.identity .card h3 { color: var(--green-900); }
.identity .tag { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--gold-600); }
.identity .quote { font-family: var(--font-head); font-size: 1.5rem; color: var(--green-800); margin: 2px 0 10px; }
.identity ul { margin: 12px 0 0; padding-left: 1.2em; color: var(--muted); font-size: .95rem; }

@media (max-width: 900px) {
  .pillars, .identity { grid-template-columns: 1fr; }
}

/* ---------- หลักสูตร ---------- */
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.track { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.track header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.track header h3 { margin: 0; font-size: 1.4rem; }
.track header .ar { font-family: var(--font-ar); color: var(--gold-600); font-size: 1.15rem; }
.levels { list-style: none; margin: 0; padding: 0; }
.levels li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.levels li:last-child { border-bottom: 0; }
.levels b { font-weight: 600; }
.levels span { color: var(--muted); font-size: .92rem; text-align: right; }
.programs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip { font-size: .85rem; padding: 6px 12px; border-radius: 999px; background: var(--green-100); color: var(--green-800); }
.chip b { font-weight: 700; }

.daily { margin-top: 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.daily div { padding: 20px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.section-alt .daily div { background: var(--cream); }
.daily svg { width: 28px; height: 28px; color: var(--gold-600); margin-bottom: 8px; }
.daily b { display: block; color: var(--green-900); }
.daily span { font-size: .9rem; color: var(--muted); }

@media (max-width: 900px) {
  .tracks { grid-template-columns: 1fr; }
  .daily { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .track { padding: 24px 20px; }
  .daily { grid-template-columns: 1fr; }
}

/* ---------- ศิษย์เก่า ---------- */
.alumni { position: relative; color: #fff; background: var(--green-950); overflow: hidden; }
.alumni img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.alumni::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--green-950) 30%, rgb(6 38 25 / .4)); z-index: 1; }
.alumni .wrap { position: relative; z-index: 2; padding-top: 112px; padding-bottom: 112px; }
.alumni h2 { color: #fff; max-width: 620px; }
.alumni p { color: rgb(255 255 255 / .82); max-width: 560px; }
.alumni .credit { font-size: .8rem; color: rgb(255 255 255 / .55); margin-top: 24px; }

/* ---------- รับสมัคร ---------- */
.admit { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 48px; box-shadow: var(--shadow); }
.admit ol { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.admit ol li { counter-increment: s; position: relative; padding: 0 0 18px 48px; }
.admit ol li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--green-700); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.admit ol b { display: block; color: var(--green-900); }
.admit ol span { color: var(--muted); font-size: .95rem; }
.admit .note { font-size: .88rem; color: var(--muted); margin-top: 16px; }
.admit-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

@media (max-width: 900px) {
  .admit { grid-template-columns: 1fr; padding: 32px 22px; }
}

/* ---------- ระบบออนไลน์ + เอกสาร ---------- */
.links-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.link-card { display: flex; flex-direction: column; gap: 4px; padding: 24px; border-radius: var(--radius); background: var(--cream); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.link-card:hover { border-color: var(--gold-500); transform: translateY(-2px); color: var(--ink); }
.link-card svg { width: 26px; height: 26px; color: var(--green-700); margin-bottom: 6px; }
.link-card b { color: var(--green-900); }
.link-card span { font-size: .9rem; color: var(--muted); }
.link-card em { font-style: normal; font-size: .8rem; color: var(--gold-600); margin-top: auto; padding-top: 8px; }

.docs { margin-top: 56px; }
.docs h3 { margin-bottom: 16px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.doc-list a { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 10px; background: var(--cream); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.doc-list a:hover { border-color: var(--gold-500); color: var(--ink); }
.doc-list svg { width: 24px; height: 24px; flex: none; color: #b3412e; }
.doc-list small { display: block; color: var(--muted); font-size: .8rem; }

@media (max-width: 900px) {
  .links-grid { grid-template-columns: 1fr 1fr; }
  .doc-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) { .links-grid { grid-template-columns: 1fr; } }

/* ---------- ติดต่อ ---------- */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; }
.contact dl { margin: 0; display: grid; gap: 20px; }
.contact dt { font-size: .85rem; font-weight: 600; color: var(--gold-600); }
.contact dd { margin: 2px 0 0; }
.contact dd a { text-decoration: none; }
.map { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); min-height: 360px; background: var(--green-100); }
.map iframe { width: 100%; height: 100%; min-height: 360px; border: 0; display: block; }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }

/* ---------- ท้ายหน้า ---------- */
.site-footer { background: var(--green-950); color: rgb(255 255 255 / .75); padding: 48px 0 32px; font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.site-footer .brand { color: #fff; margin: 0; }
.site-footer .brand small { color: rgb(255 255 255 / .6); }
.site-footer a { color: var(--gold-200); }
.site-footer .ar { font-family: var(--font-ar); color: var(--gold-200); font-size: 1.1rem; }
.copy { width: 100%; border-top: 1px solid rgb(255 255 255 / .12); padding-top: 20px; font-size: .82rem; color: rgb(255 255 255 / .5); }
