/* Intro (from ui-animations #21 Intro 1), Avalia look.
   Font: Taviraj (Thai + Latin, SIL Open Font License, may be hosted online), see fonts/OFL-Taviraj.txt */
@font-face { font-family: "Taviraj"; src: url("../fonts/Taviraj-Medium.ttf") format("truetype"); font-weight: 500; font-display: block; }
@font-face { font-family: "Taviraj"; src: url("../fonts/Taviraj-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: block; }

:root {
  --bg: #12261F;            /* deep forest green (darker than the logo green #1F3B33) */
  --green: #1F3B33;
  --text: #F7F2E8;          /* line 1: warm cream (logo cream) */
  --gold: #B48E55;          /* logo champagne gold */
  --gold-light: #DDBF85;    /* line 2: lighter gold so it reads on dark green */
  --muted: #C9C2B2;
  --hfs: clamp(2.4rem, min(4.6vw, 8svh), 5rem);   /* headline font size */
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Taviraj", Georgia, serif; }

/* ---------- hero layout ---------- */
html.preview body { overflow: hidden; }   /* ?preview = Animation Center thumbnail mode (harmless here) */

.hero { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; padding: 40px 16px; }
.hero-bg { position: absolute; inset: 0; opacity: .8;
  background:
    radial-gradient(ellipse 50% 38% at 50% 36%, rgba(221,191,133,.16), transparent 70%),   /* soft gold light behind the title */
    radial-gradient(ellipse 80% 45% at 50% 110%, rgba(247,242,232,.10), transparent 70%),  /* morning mist low down */
    radial-gradient(ellipse 60% 60% at 12% 4%, rgba(70,110,92,.30), transparent 65%),
    linear-gradient(#17302A, #0E1F19); }
.hero-bg::after { content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.hero-grid { position: relative; z-index: 1; width: min(100%, 1120px); display: grid;
  grid-template-areas: "title" "copy"; gap: clamp(22px, 4svh, 40px); justify-items: center; text-align: center; }
.title-row { grid-area: title; display: flex; align-items: center; justify-content: center; gap: clamp(20px, 3vw, 44px); }
.logo img { display: block; width: calc(var(--hfs) * 2.8); height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }

/* ---------- the headline ---------- */
/* line-height 1.4: Thai stacks vowels + tone marks above (ที่, ภูมิ) and below the letters */
h1 { margin: 0; font-family: "Taviraj", Georgia, serif; font-weight: 500; font-size: var(--hfs);
  line-height: 1.4; letter-spacing: .005em; white-space: nowrap; color: var(--text); text-align: left;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.55)); }
.line { display: block; }
.line + .line { color: var(--gold-light); }
.line > span, .char { display: inline-block; }

/* While the intro runs, each [data-c] shows two copies of its text:
   ::before = blurry glow (fades out), ::after = sharp text (fades in). */
html[data-intro-run] h1 { filter: none; }
html[data-intro-run] .hero [data-c] { position: relative; -webkit-text-fill-color: transparent; -webkit-text-stroke-color: transparent; }
html[data-intro-run] .hero [data-c]::before,
html[data-intro-run] .hero [data-c]::after { content: attr(data-c); position: absolute; inset: 0; white-space: nowrap;
  -webkit-text-fill-color: currentColor; -webkit-text-stroke-color: currentColor; }
html[data-intro-run] .hero [data-c]::before { opacity: 0; filter: blur(8px); }
html[data-intro-run] .hero .line > [data-c]::before { filter: blur(12px); }
html[data-intro-run] .hero .char::after { text-shadow: 0 2px 10px rgba(0,0,0,.55); }
html[data-intro-run] .hero .line > [data-c]::after { text-shadow: 0 2px 18px rgba(0,0,0,.55); }

/* Hidden before the intro starts. Safety net: if the script fails, everything shows after 4 s. */
@keyframes rv-show { to { opacity: 1; visibility: visible; } }
@keyframes bg-show { to { opacity: .8; transform: none; } }
html:not([data-split]) .hero h1 { visibility: hidden; animation: rv-show 0s 4s forwards; }
html:not([data-intro-done]) .hero :is(.line > span, .logo, .copy) { opacity: 0; animation: rv-show 0s 4s forwards; }
html:not([data-intro-done]) .hero .hero-bg { opacity: .5; transform: scale(1.06); animation: bg-show 0s 4s forwards; }

/* ---------- line under the title ---------- */
.copy { grid-area: copy; margin: 0; font-size: clamp(1rem, 1.4vw, 1.2rem); letter-spacing: .04em; color: var(--muted); }

/* Phones: logo sits above the title (not hidden, the brand must show), title centred and allowed to wrap */
@media (max-width: 700px) {
  .title-row { flex-direction: column; gap: 18px; }
  .logo img { width: min(46vw, 190px); }
  h1 { white-space: normal; text-align: center; font-size: clamp(1.8rem, 8.4vw, 2.8rem); }
}
