/* =========================================================
   คลัง Effect (Scroll Effects Library)
   ที่มา: C:\AppServ\www\med-projects\index5.html  (แยก/จัดหมวดใหม่)
   วิธีใช้:
       <link rel="stylesheet" href="effects/effects.css">
       <script src="effects/effects.js"></script>
   หมายเหตุ: ทุกคลาสนำหน้าด้วย fx- เพื่อไม่ชนกับ Bootstrap / CSS เดิม
   ========================================================= */

:root {
    --fx-accent: #e60012;
    --fx-ease: cubic-bezier(.2, .7, .2, 1);
    --fx-ease-strong: cubic-bezier(.77, 0, .18, 1);
}

/* =========================================================
   FX-01  FADE UP REVEAL
   ใช้: <div class="fx-reveal">...</div>
   ========================================================= */
.fx-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity .9s ease, transform .9s var(--fx-ease);
}
.fx-reveal.fx-active {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   FX-02  SLIDE REVEAL (ข้อความเลื่อนขึ้นจากล่าง)
   ใช้: <div class="fx-slide"><span>LEARN</span></div>
        (เพิ่ม fx-delay-1 / fx-delay-2 เพื่อเหลื่อมเวลา)
   ========================================================= */
.fx-slide {
    overflow: hidden;
}
.fx-slide > span {
    display: block;
    transform: translateY(120%);
    transition: transform 1.2s var(--fx-ease-strong);
}
.fx-slide.fx-active > span {
    transform: translateY(0);
}
.fx-slide.fx-delay-1 > span { transition-delay: .12s; }
.fx-slide.fx-delay-2 > span { transition-delay: .24s; }

/* =========================================================
   FX-03  IMAGE MASK REVEAL (แผงสีเลื่อนออกเผยรูป)
   ใช้: <div class="fx-imgmask fx-reveal-img">
          <div class="fx-mask"></div><img src="...">
        </div>
   ========================================================= */
.fx-imgmask {
    position: relative;
    overflow: hidden;
}
.fx-imgmask img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
    transition: transform 1.5s var(--fx-ease);
}
.fx-imgmask .fx-mask {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--fx-accent);
    transform: translateX(0);
    transition: transform 1.2s var(--fx-ease-strong);
}
.fx-imgmask.fx-active .fx-mask { transform: translateX(100%); }
.fx-imgmask.fx-active img     { transform: scale(1); }

/* =========================================================
   FX-04  TEXT WORD REVEAL (ไล่คำ)
   ใช้: <h2 class="fx-words" data-fx-words>ข้อความ ...</h2>
        (JS จะ split เป็น span.fx-word ให้เอง)
   ========================================================= */
.fx-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity .7s ease, transform .7s ease;
    margin-right: .15em;
}
.fx-word.fx-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   FX-05  TYPOGRAPHY PARALLAX (ตัวหนังสือยักษ์ขยับ)
   ใช้: <section class="fx-typo">
          <div class="fx-typo-word" data-speed="0.18">UNIVERSITY</div>
          <div class="fx-typo-word fx-second" data-speed="-0.12">FUTURE</div>
          <div class="fx-typo-center">...</div>
        </section>
   ========================================================= */
.fx-typo {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.fx-typo-word {
    position: absolute;
    left: 50%;
    white-space: nowrap;
    opacity: .08;
    pointer-events: none;
    transform: translateX(-50%);
    will-change: transform;
}
.fx-typo-word.fx-second {
    top: 60%;
    opacity: .12;
}
.fx-typo-center {
    position: relative;
    z-index: 2;
    text-align: center;
}

/* =========================================================
   FX-06  IMAGE PARALLAX (รูปขยับตอน scroll)
   ใช้: <div class="fx-parallax-wrap">
          <img class="fx-parallax-img" src="...">
        </div>
   ========================================================= */
.fx-parallax-wrap {
    position: relative;
    overflow: hidden;
}
.fx-parallax-img {
    width: 100%;
    height: 120%;
    object-fit: cover;
    transform: translateY(-10%);
    will-change: transform;
}

/* =========================================================
   FX-07  STICKY SECTION (คอลัมน์ซ้ายตรึง)
   ใช้: <section class="fx-sticky">
          <div class="fx-sticky-left">...</div>
          <div class="fx-sticky-right"><article>..</article>..</div>
        </section>
   ========================================================= */
.fx-sticky {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.fx-sticky-left {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.fx-sticky-right > * {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =========================================================
   FX-08  COUNTER ANIMATION (ตัวเลขนับขึ้น)
   ใช้: <strong class="fx-counter" data-target="35000">0</strong>
   ========================================================= */
.fx-counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   FX-09  HOVER IMAGE ZOOM (hover แล้วรูปซูม)
   ใช้: <a class="fx-zoom"><img src="..."></a>
   ========================================================= */
.fx-zoom {
    display: block;
    overflow: hidden;
}
.fx-zoom img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s var(--fx-ease);
}
.fx-zoom:hover img {
    transform: scale(1.08);
}

/* =========================================================
   FX-10  UNDERLINE LINK REVEAL (เส้นใต้วิ่ง)
   ใช้: <a href="#" class="fx-underline">explore</a>
   ========================================================= */
.fx-underline {
    position: relative;
    display: inline-block;
}
.fx-underline::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 3px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .6s var(--fx-ease-strong);
}
.fx-underline:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* =========================================================
   KEYFRAMES (ใช้กับ FX-01 hero line / ลูกศร)
   ========================================================= */
@keyframes fx-lineReveal {
    from { transform: translateY(110%); }
    to   { transform: translateY(0); }
}
@keyframes fx-scrollArrow {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(8px); }
}
.fx-line-reveal {
    display: block;
    overflow: hidden;
    animation: fx-lineReveal 1s var(--fx-ease-strong) both;
}
.fx-scroll-arrow {
    animation: fx-scrollArrow 1.5s ease-in-out infinite;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
    .fx-sticky { grid-template-columns: 1fr; }
    .fx-sticky-left {
        position: relative;
        height: auto;
        min-height: 70vh;
    }
}

/* เคารพผู้ใช้ที่ปิดอนิเมชัน */
@media (prefers-reduced-motion: reduce) {
    .fx-reveal,
    .fx-slide > span,
    .fx-imgmask img,
    .fx-imgmask .fx-mask,
    .fx-word {
        transition: none !important;
    }
    .fx-reveal,
    .fx-word { opacity: 1; transform: none; }
    .fx-slide > span { transform: none; }
    .fx-imgmask .fx-mask { transform: translateX(100%); }
    .fx-imgmask img { transform: none; }
}

/* =========================================================
   COMPONENT: HEADER  (site-header)
   ที่มา: index5.html — ยึดจากด้านบน, มี mix-blend-mode difference
   ========================================================= */
.site-header {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    mix-blend-mode: difference;
    color: #fff;
}
.site-header .logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
}
.main-nav {
    display: flex;
    gap: 40px;
}
.main-nav a {
    position: relative;
    font-size: 14px;
    transition: .3s;
}
.main-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: .4s ease;
}
.main-nav a:hover::after {
    width: 100%;
}
.menu-button {
    display: none;
    flex-direction: column;
    gap: 6px;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.menu-button span {
    display: block;
    width: 28px;
    height: 2px;
    background: #fff;
}

/* =========================================================
   COMPONENT: HERO  (hero + วงกลมเบลอ + line reveal)
   ========================================================= */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #111;
    color: #fff;
}
.hero-background {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.hero-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: .4;
}
.circle-one {
    width: 500px;
    height: 500px;
    top: -200px;
    right: -100px;
    background: #e60012;
}
.circle-two {
    width: 400px;
    height: 400px;
    bottom: -150px;
    left: 10%;
    background: #5435d9;
}
/* .container scoped เฉพาะใน hero กันชนกับ Bootstrap */
.hero .container {
    width: min(calc(100% - 80px), 1400px);
    margin-inline: auto;
}
.hero-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    padding-top: 100px;
}
.eyebrow {
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 30px;
    color: rgba(255, 255, 255, .55);
}
.hero-title {
    font-size: clamp(70px, 10vw, 170px);
    line-height: .85;
    letter-spacing: -5px;
    font-weight: 600;
}
.hero-title .line {
    display: block;
    overflow: hidden;
    animation: fx-lineReveal 1s var(--fx-ease-strong) both;
}
.hero-title .line:nth-child(1) { animation-delay: .1s; }
.hero-title .line:nth-child(2) { animation-delay: .2s; }
.hero-title .line:nth-child(3) { animation-delay: .3s; }
.hero-title .accent {
    color: var(--fx-accent);
}
.hero-description {
    max-width: 500px;
    margin-top: 50px;
    font-size: 18px;
    line-height: 1.8;
    color: rgba(255, 255, 255, .65);
}
.scroll-down {
    display: inline-flex;
    gap: 20px;
    align-items: center;
    margin-top: 50px;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, .6);
}
.scroll-down span {
    font-size: 22px;
    animation: fx-scrollArrow 1.5s ease-in-out infinite;
}
.hero-number {
    font-size: 14px;
    color: rgba(255, 255, 255, .5);
}

/* .reveal (ชื่อเดิมใน hero) = เหมือน FX-01 แต่ใช้คลาส .active */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity .9s ease, transform .9s var(--fx-ease);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .main-nav { display: none; }
    .menu-button { display: flex; }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-number { display: none; }
}
@media (max-width: 600px) {
    .site-header { height: 70px; padding: 0 20px; }
    .hero-title { font-size: 58px; letter-spacing: -3px; }
    .hero .container { width: calc(100% - 40px); }
}
