:root {
  --purple-deep: #25003f;
  --purple-main: #5c1892;
  --gold-1: #fff0a8;
  --gold-2: #d7a943;
  --gold-3: #8c5c12;
  --text-purple: #5a176e;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  font-family: "Sarabun", system-ui, sans-serif;
  overflow: hidden;
  background: var(--purple-deep);
  opacity: 0;
  animation: pageFadeIn 1.2s ease forwards;
}

.royal-landing {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  isolation: isolate;
}

.bg-layer {
  position: absolute;
  inset: 0;
  background-image: url("../images/bg.webp");
  background-size: cover;
  background-position: center center;
  transform: scale(1.015);
  z-index: -4;
}

.purple-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(255,255,255,.18), rgba(255,255,255,0) 30%),
    linear-gradient(to bottom, rgba(24,0,52,.04), rgba(74,13,115,.08) 48%, rgba(238,191,255,.24) 100%),
    radial-gradient(circle at center, rgba(255,255,255,0) 45%, rgba(26,0,50,.34) 100%);
  z-index: -3;
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,238,180,.88) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.58) 0 1px, transparent 2px);
  background-size: 180px 180px, 260px 260px;
  background-position: 20px 40px, 90px 120px;
  opacity: .42;
  animation: twinkle 7s ease-in-out infinite alternate;
  z-index: -2;
}

.sparkle-layer {
  display: none;
}

.content-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.monogram {
  position: absolute;
  top: clamp(42px, 8vh, 86px);
  left: 50%;
  width: clamp(70px, 6vw, 104px);
  transform: translateX(210px);
  filter: drop-shadow(0 5px 10px rgba(70, 30, 0, .25));
  z-index: 5;
}

.queen-stage {
  position: absolute;
  left: 50%;
  top: 37%;
  width: min(72vw, 930px);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.queen-glow {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 58%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.62), rgba(255,218,255,.30) 42%, transparent 70%);
  filter: blur(14px);
  z-index: -1;
}

.queen-image {
  display: block;
  width: 90%;
  height: auto;
  margin: 0 auto;
  filter:
    drop-shadow(0 0 22px rgba(255,255,255,.38))
    drop-shadow(0 0 58px rgba(180,120,255,.28))
    drop-shadow(0 22px 35px rgba(54,0,82,.24));
}

.text-panel {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: min(95vw, 1200px);
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
}

.title-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(88vw, 580px);
  padding: 8px 30px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4e127d 0%, #26003f 100%);
  border: 3px solid var(--gold-2);
  box-shadow:
    inset 0 0 0 2px rgba(255,245,166,.72),
    0 8px 20px rgba(55,0,75,.27),
    0 0 24px rgba(255,219,122,.32);
}

.title-box::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  border: 1px solid rgba(255,232,148,.86);
  pointer-events: none;
}

h1 {
  margin: 0;
  font-family: "Noto Serif Thai", serif;
  font-size: clamp(38px, 4vw, 62px);
  font-weight: 500;
  line-height: 1.05;
  color: #fff7bf;
  text-shadow: 0 0 8px rgba(255,238,160,.86), 0 3px 8px rgba(36,0,56,.56);
  letter-spacing: .02em;
}

.date,
.subtitle,
.blessing-main,
.blessing-sub,
.blessing-org {
  font-family: "Noto Serif Thai", serif;
  color: #6b1c77;
  text-shadow: 0 2px 8px rgba(255,255,255,.55);
}

.date {
  margin: 16px 0 2px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  color: var(--text-purple);
}

.subtitle {
  margin: 0 0 14px;
  font-size: clamp(18px, 1.8vw, 25px);
  line-height: 1.2;
}

.blessing-main {
  margin: 0 auto 4px;
  max-width: 1400px;
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 500;
  color: #6a1b78;
  text-shadow: 0 1px 2px rgba(255,255,255,.55);
  line-height: 1.18;
}

.blessing-sub {
  margin: 0 0 12px;
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.2;
}

.blessing-org {
  margin: 0;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.28;
}

.enter-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  margin-top: 10px;
  padding: 13px 30px 14px;
  border-radius: 999px;
  font-size: clamp(16px, 1.25vw, 19px);
  font-weight: 600;
  color: #3d1458;
  text-decoration: none;
  background: linear-gradient(180deg, #fff6b9 0%, #e3bd55 48%, #b47a1e 100%);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 10px 22px rgba(71,0,101,.22), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .2s ease, filter .2s ease;
}

.enter-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.58), transparent);
  animation: buttonShine 4.5s ease-in-out infinite;
}

.enter-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.enter-btn:active {
  transform: translateY(0);
}

@keyframes pageFadeIn {
  to { opacity: 1; }
}

@keyframes twinkle {
  from { opacity: .28; transform: translateY(0); }
  to { opacity: .55; transform: translateY(-6px); }
}

@keyframes buttonShine {
  to { left: 180%; }
}

/* ===============================
   Notebook / จอเตี้ย
================================ */
@media (max-height: 760px) and (min-width: 901px) {
  .royal-landing {
    min-height: 560px;
  }

  .queen-stage {
    width: min(58vw, 720px);
    top: 35%;
  }

  .queen-image {
    width: 88%;
  }

  .monogram {
    top: 36px;
    width: 82px;
    transform: translateX(165px);
  }

  .text-panel {
    bottom: 18px;
    width: min(96vw, 1180px);
    transform: translateX(-50%) scale(.90);
    transform-origin: bottom center;
  }
}

/* ===============================
   Tablet แนวนอน / iPad Landscape
================================ */
@media (max-width: 1180px) and (min-width: 769px) {
  .royal-landing {
    min-height: 640px;
  }

  .queen-stage {
    width: min(86vw, 780px);
    top: 35%;
  }

  .queen-image {
    width: 92%;
  }

  .monogram {
    width: 60px;
    top: 15%;
    transform: translateX(150px);
  }

  .text-panel {
    width: min(96vw, 1000px);
    bottom: 25%;
  }

  .title-box {
    min-width: min(74vw, 540px);
    padding: 8px 28px 10px;
  }

  h1 {
    font-size: clamp(36px, 5vw, 56px);
  }

  .date {
    margin-top: 13px;
    font-size: clamp(26px, 4vw, 38px);
  }

  .subtitle {
    font-size: clamp(17px, 2.5vw, 22px);
    margin-bottom: 12px;
  }

  .blessing-main {
    font-size: clamp(17px, 2.4vw, 24px);
  }

  .blessing-sub {
    font-size: clamp(15px, 2.2vw, 20px);
    margin-bottom: 10px;
  }

  .blessing-org {
    font-size: clamp(13px, 1.8vw, 16px);
  }
}

/* ===============================
   Tablet แนวตั้ง
================================ */
@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

  .royal-landing {
    height: 100svh;
    min-height: 100svh;
  }

  .bg-layer {
    background-position: center top;
  }

  .queen-stage {
    width: 105vw;
    top: 28%;
  }

  .queen-image {
    width: 94%;
  }

  .monogram {
    width: 60px;
    top: 10%;
    transform: translateX(112px);
  }

  .text-panel {
    width: 95vw;
    bottom: 32%;
    transform: translateX(-50%) scale(.92);
    transform-origin: bottom center;
  }

  .title-box {
    min-width: min(84vw, 500px);
    padding: 7px 24px 9px;
    border-width: 2px;
  }

  .title-box::before {
    inset: -6px;
  }

  h1 {
    font-size: clamp(32px, 7vw, 50px);
  }

  .date {
    margin-top: 12px;
    font-size: clamp(25px, 5.6vw, 36px);
  }

  .subtitle {
    margin-bottom: 10px;
    font-size: clamp(16px, 3.5vw, 22px);
  }

  .blessing-main {
    font-size: clamp(16px, 3.4vw, 22px);
    line-height: 1.25;
  }

  .blessing-sub {
    margin-bottom: 8px;
    font-size: clamp(14px, 3vw, 18px);
  }

  .blessing-org {
    font-size: clamp(12px, 2.4vw, 15px);
    line-height: 1.32;
  }

  .enter-btn {
    min-width: 180px;
    margin-top: 10px;
    padding: 10px 22px 11px;
    font-size: 15px;
  }
}

/* ===============================
   Mobile
================================ */
@media (max-width: 560px) {
  .sparkles {
    opacity: .32;
  }

  .content-wrap {
    padding: 16px;
  }

  .queen-stage {
    width: 132vw;
    top: 28%;
  }

  .queen-image {
    width: 100%;
  }

  .monogram {
    width: 36px;
    top: 10%;
    transform: translateX(78px);
  }

  .text-panel {
    width: 96vw;
    bottom: 35%;
    transform: translateX(-50%) scale(.88);
  }

  .title-box {
    min-width: 82vw;
    padding: 6px 18px 8px;
  }

  h1 {
    font-size: clamp(29px, 8.8vw, 40px);
  }

  .date {
    margin-top: 9px;
    font-size: clamp(24px, 7vw, 32px);
  }

  .subtitle {
    margin-bottom: 8px;
    font-size: clamp(14px, 4vw, 18px);
  }

  .blessing-main {
    font-size: clamp(14px, 3.8vw, 17px);
    line-height: 1.24;
  }

  .blessing-sub {
    margin-bottom: 7px;
    font-size: clamp(13px, 3.5vw, 16px);
  }

  .blessing-org {
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.28;
  }

  .enter-btn {
    min-width: 160px;
    margin-top: 9px;
    padding: 9px 18px 10px;
    font-size: 14px;
  }
}

/* ===============================
   Mobile จอเตี้ยมาก
================================ */
@media (max-width: 560px) and (max-height: 720px) {
  .queen-stage {
    width: 118vw;
    top: 25%;
  }

  .text-panel {
    bottom: 10px;
    transform: translateX(-50%) scale(.78);
  }

  .date {
    margin-top: 7px;
  }

  .subtitle {
    margin-bottom: 6px;
  }

  .blessing-sub {
    margin-bottom: 5px;
  }

  .enter-btn {
    margin-top: 7px;
  }
}

/* ===============================
   Mobile จอแคบมาก เช่น iPhone SE
================================ */
@media (max-width: 390px) {
  .queen-stage {
    width: 128vw;
    top: 26%;
  }

  .monogram {
    width: 50px;
    transform: translateX(68px);
  }

  .text-panel {
    transform: translateX(-50%) scale(.82);
    bottom: 12px;
  }
}

/* Mobile Landscape / มือถือแนวนอนจอเตี้ย */
@media (max-height: 520px) and (orientation: landscape) {
  .royal-landing {
    height: 100svh;
    min-height: 100svh;
  }

  .queen-stage {
    width: 46vw;
    top: 31%;
  }

  .queen-image {
    width: 85%;
  }

  .monogram {
    width: 35px;
    top: 5%;
    transform: translateX(95px);
  }

  .text-panel {
    width: 56vw;
    bottom: 8%;
    transform: translateX(-50%) scale(.72);
    transform-origin: bottom center;
  }

  .title-box {
    min-width: 420px;
    padding: 5px 20px 7px;
  }

  h1 {
    font-size: 38px;
  }

  .date {
    margin-top: 10px;
    font-size: 28px;
  }

  .subtitle {
    margin-bottom: 6px;
    font-size: 16px;
  }

  .blessing-main {
    font-size: 16px;
  }

  .blessing-sub {
    margin-bottom: 5px;
    font-size: 14px;
  }

  .blessing-org {
    font-size: 12px;
    line-height: 1.2;
  }

  .enter-btn {
    margin-top: 6px;
    min-width: 150px;
    padding: 8px 16px;
    font-size: 13px;
  }
}