:root {
  --gold-deep: #69400f;
  --gold-main: #a96f14;
  --gold-mid: #c48a24;
  --gold-soft: #e7bd62;
  --cream: #fff8dc;
  --copy-width: 650px;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: #c88b24;
  color: var(--gold-deep);
  font-family: "Sarabun", system-ui, sans-serif;
  opacity: 0;
  animation: page-in .7s ease forwards;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

.background {
  position: absolute;
  inset: 0;
  z-index: -5;
  background: url("../images/bg.webp") center center / cover no-repeat;
}

.gold-overlay {
  position: absolute;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  background:
    radial-gradient(circle at 69% 31%, rgba(255,255,255,.16), transparent 24%),
    radial-gradient(circle at 69% 37%, rgba(255,229,143,.08), transparent 42%),
    linear-gradient(90deg, rgba(255,246,213,.025), transparent 48%, rgba(112,57,0,.025));
}

.hero {
  position: relative;
  width: min(92vw, 1480px);
  height: 100%;
  margin: 0 auto;
}

.copy-panel {
  position: absolute;
  left: 10.5%;
  top: 38.5%;
  width: min(44vw, var(--copy-width));
  transform: translateY(-50%) scale(.64);
  transform-origin: center center;
  text-align: center;
  z-index: 4;
}

.monogram {
  display: block;
  width: clamp(84px, 7vw, 118px);
  max-height: 160px;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 3px 7px rgba(95,50,0,.12));
}

.heading-rule {
  position: relative;
  width: 60%;
  height: 12px;
  margin: 0 auto 0;
}
.heading-rule::before,
.heading-rule::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 41%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(169,111,20,.78));
}
.heading-rule::before { left: 0; }
.heading-rule::after { right: 0; transform: scaleX(-1); }
.heading-rule span::before {
  content: "❧";
  position: absolute;
  inset: -3px 0 auto;
  color: var(--gold-mid);
  font-size: 20px;
  line-height: 1;
}

h1 {
  margin: 0;
  font-family: "Noto Serif Thai", "Th Sarabun New", serif;
  font-size: clamp(58px, 5.25vw, 94px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: .005em;
  color: #75470f;
  text-shadow:
    0 1px 1px rgba(255,255,255,.58),
    0 2px 7px rgba(72,38,0,.14);
}

.date-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 13px;
  width: 70%;
  margin: 12px auto 15px;
}
.date-line span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(181,126,37,.82) 24%, rgba(181,126,37,.82) 76%, transparent);
}
.date-line strong {
  position: relative;
  font-family: "Noto Serif Thai", serif;
  font-size: clamp(25px, 2.05vw, 35px);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: #714511;
}
.date-line strong::before,
.date-line strong::after {
  content: "◆";
  padding: 0 9px;
  font-size: .39em;
  vertical-align: .38em;
  color: #b17a20;
}

.occasion,
.royal-name,
.devotion,
.organization {
  margin: 0;
  color: #68400f;
  text-shadow:
    0 1px 1px rgba(255,255,255,.62),
    0 2px 6px rgba(74,41,0,.12);
}
.occasion,
.royal-name {
  font-family: "Noto Serif Thai", "Th Sarabun New", serif;
}
.occasion {
  font-size: clamp(23px, 1.95vw, 33px);
  font-weight: 500;
  line-height: 1.38;
}
.royal-name {
  margin-top: 3px;
  font-size: clamp(24px, 2vw, 35px);
  font-weight: 500;
  line-height: 1.32;
}

.small-rule {
  position: relative;
  width: 42%;
  height: 1px;
  margin: 17px auto 22px;
  background: linear-gradient(90deg, transparent, rgba(183,128,39,.76) 23%, rgba(183,128,39,.76) 77%, transparent);
}
.small-rule::after {
  content: "❦";
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  background: rgba(255,244,210,.68);
  color: #ad751b;
  font-size: 20px;
  line-height: 20px;
}

.devotion,
.organization {
  font-family: "Sarabun", sans-serif;
  font-weight: 500;
}
.devotion {
  font-size: clamp(16px, 1.28vw, 20px);
  line-height: 1.58;
}
.organization {
  width: 100%;
  margin: 4px auto 0;
  font-size: clamp(15px, 1.18vw, 19px);
  line-height: 1.58;
}

.enter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 226px;
  margin-top: 21px;
  padding: 10px 12px 10px 27px;
  border: 1px solid rgba(255,244,190,.94);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.17), transparent 38%),
    linear-gradient(180deg, #d6a332 0%, #a66d0b 100%);
  box-shadow:
    inset 0 0 0 2px rgba(103,58,0,.20),
    inset 0 1px 0 rgba(255,255,255,.26),
    0 7px 18px rgba(104,61,0,.15);
  color: #fff9df;
  text-decoration: none;
  font-family: "Noto Serif Thai", serif;
  font-size: clamp(17px, 1.3vw, 21px);
  line-height: 1;
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}
.enter-btn i {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(255,247,209,.68);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 27px;
  font-style: normal;
  line-height: 1;
  transform: translateY(-1px);
}
.enter-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    inset 0 0 0 2px rgba(103,58,0,.18),
    inset 0 1px 0 rgba(255,255,255,.30),
    0 10px 22px rgba(104,61,0,.18);
}
.enter-btn:focus-visible {
  outline: 3px solid rgba(255,248,210,.92);
  outline-offset: 4px;
}

.portrait-stage {
  position: absolute;
  right: 14%;
  top: 35.5%;
  width: min(33vw, 480px);
  height: 68%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
}
.portrait-glow {
  position: absolute;
  left: 50%;
  top: 35%;
  width: 128%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.28) 0%, rgba(255,245,202,.14) 27%, rgba(255,221,115,.05) 50%, transparent 72%);
  filter: blur(9px);
  opacity: .55;
}
.king-image {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: auto;
  height: min(63vh, 620px);
  max-width: 100%;
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 13px 22px rgba(83,48,0,.10));
}

.ambient-effects {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.ambient-effects::before {
  content: "";
  position: absolute;
  right: 5%;
  bottom: 5%;
  width: 43vw;
  height: 24vh;
  background: radial-gradient(ellipse at center, rgba(255,218,99,.11), transparent 69%);
  filter: blur(20px);
}
.ambient-effects::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3%;
  height: 20%;
  background: linear-gradient(to top, rgba(255,192,50,.06), transparent 73%);
}
.ambient-effects span {
  position: absolute;
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,248,208,.82);
  box-shadow: 0 0 10px 3px rgba(255,210,76,.30);
  animation: shimmer 5s ease-in-out infinite alternate;
}
.ambient-effects span:nth-child(1) { right: 9%; bottom: 18%; transform: scale(.8); }
.ambient-effects span:nth-child(2) { right: 24%; bottom: 10%; transform: scale(.48); animation-delay: -.8s; }
.ambient-effects span:nth-child(3) { right: 37%; bottom: 22%; transform: scale(.62); animation-delay: -1.6s; }
.ambient-effects span:nth-child(4) { left: 8%; bottom: 12%; transform: scale(.45); animation-delay: -2.2s; }
.ambient-effects span:nth-child(5) { left: 31%; bottom: 8%; transform: scale(.72); animation-delay: -2.9s; }
.ambient-effects span:nth-child(6) { right: 16%; top: 17%; transform: scale(.55); animation-delay: -3.5s; }

@keyframes page-in { to { opacity: 1; } }
@keyframes shimmer {
  from { opacity: .22; filter: blur(.4px); }
  to { opacity: .72; filter: blur(0); }
}

@media (max-height: 760px) and (min-width: 901px) {
  .royal-landing { min-height: 560px; }
  .copy-panel { left: 10%; top: 38%; transform: translateY(-50%) scale(.55); }
  .portrait-stage { right: 14%; top: 34.5%; width: min(31vw, 425px); height: 72%; }
  .king-image { height: min(61vh, 545px); }
}

@media (max-width: 1180px) and (min-width: 769px) {
  .hero { width: 96vw; }
  .copy-panel { left: 5%; top: 39%; width: 53vw; transform: translateY(-50%) scale(.57); }
  .portrait-stage { right: 8%; top: 35.5%; width: 36vw; height: 70%; }
  .king-image { height: min(60vh, 565px); }
}

@media (max-width: 768px) {
  body { overflow: auto; }
  .royal-landing {
    min-height: 760px;
    height: 100svh;
  }
  .background { background-position: 38% center; }
  .hero { width: 100%; }

  /* Mobile: anchor the portrait from its visible top edge instead of the
     bottom of a tall container. This removes the large empty area above it. */
  .portrait-stage {
    right: 50%;
    top: max(14px, env(safe-area-inset-top));
    width: min(64vw, 390px);
    height: 46%;
    transform: translateX(50%);
  }
  .portrait-glow {
    top: 31%;
    width: 116%;
    opacity: .45;
  }
  .king-image {
    top: 0;
    bottom: auto;
    height: min(46svh, 610px);
  }

  /* Place copy immediately after the portrait rather than pinning it to
     the bottom of tall phone screens. */
  .copy-panel {
    left: 50%;
    top: 49%;
    bottom: auto;
    width: 94vw;
    transform: translateX(-50%) scale(.58);
    transform-origin: top center;
  }
  .monogram { width: 76px; }
}

@media (max-width: 560px) {
  .royal-landing { min-height: 720px; }
  .background { background-position: 41% center; }
  .portrait-stage {
    top: max(8px, env(safe-area-inset-top));
    width: min(68vw, 350px);
    height: 45%;
  }
  .king-image { height: min(43svh, 540px); }
  .copy-panel {
    top: 44%;
    transform: translateX(-50%) scale(.52);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .royal-landing { min-height: 100svh; }
  .copy-panel {
    left: 1%;
    top: 49%;
    bottom: auto;
    width: 52vw;
    transform: translateY(-50%) scale(.43);
    transform-origin: left center;
  }
  .portrait-stage {
    right: 8%;
    top: 50%;
    width: 29vw;
    height: 78%;
    transform: translateY(-48%);
  }
  .king-image { height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  body, .ambient-effects span { animation: none; }
  body { opacity: 1; }
  .enter-btn { transition: none; }
}
