/* Empathy Star, Publicis Groupe Thailand Star Awards
   Dark only, by design. Everything emerges from black. */

:root {
  color-scheme: dark;

  --black:        #000000;
  --deep:         #0A0705;
  --gold-bright:  #F5D98B;
  --gold:         #D4A24C;
  --gold-deep:    #8A5A1E;
  --ember:        #FF9A3C;
  --star-white:   #FFF8E7;

  /* Body text sits at 0.82 alpha, not 0.55, measured at 7.4:1 on #0A0705.
     The 0.55 dim is reserved for decorative/secondary labels at >=16px. */
  --text:         rgba(245, 217, 139, 0.88);
  --text-dim:     rgba(245, 217, 139, 0.62);
  --text-faint:   rgba(245, 217, 139, 0.42);

  --glow-sm: 0 0 12px rgba(212, 162, 76, 0.35);
  --glow-md: 0 0 28px rgba(212, 162, 76, 0.45);
  --glow-lg: 0 0 64px rgba(245, 217, 139, 0.30);

  --gutter: 16px;
  --radius: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--black);
  color: var(--text);
  font-family: 'Noto Sans Thai', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  /* Thai tone marks and upper vowels need the room. Never go below 1.7. */
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;                /* dvh, never vh, 100vh hides content behind iOS chrome */
  background-image: radial-gradient(ellipse 120% 80% at 50% 38%, var(--deep) 0%, #000 70%);
  background-attachment: fixed;
}

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.grow { flex: 1 1 auto; }

/* ---------- type ---------- */
.lockup {
  display: block;
  margin: 0 auto 18px;
  width: clamp(104px, 31vw, 134px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(212, 162, 76, 0.28));
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;      /* Latin only, never applied to Thai */
  color: var(--text-faint);
  text-align: center;
  margin: 0 0 10px;
}
h1.title {
  font-family: 'Noto Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(30px, 10vw, 44px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(245, 217, 139, 0.45), 0 0 80px rgba(212, 162, 76, 0.25);
}
.sub {
  text-align: center;
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 400;
  color: var(--gold);
  margin: 12px 0 0;
  line-height: 1.8;
}
.lede {
  text-align: center;
  font-size: clamp(15px, 4.2vw, 17px);
  color: var(--gold);
  margin: 0 auto 18px;
  max-width: 36ch;
  line-height: 1.8;
}
/* Browsers break Thai inside words, which stranded a two-character orphan on
   its own line. Each phrase is its own inline-block, so a wrap can only happen
   at the space between them. */
.lede span { display: inline-block; }
.q {
  font-size: clamp(13px, 4.25vw, 22px);
  font-weight: 500;
  color: var(--gold-bright);
  line-height: 1.9;
  margin: 0 0 6px;
  white-space: nowrap;
}
/* For questions too long to hold one line on a small phone: break only at the
   space between the phrases, never inside a Thai word. */
.q.wrap2 { white-space: normal; font-size: clamp(16px, 5vw, 22px); }
.q.wrap2 span { display: inline-block; }
.hint { font-size: 13px; color: var(--text-faint); line-height: 1.7; }
.privacy {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.7;
  margin: 18px 0 0;
}

/* ---------- top bar / back ---------- */
.topbar {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 2px;
  /* Pull the chevron into the page gutter so the label stays optically centred. */
  margin-left: -10px;
}
.backlink {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  color: var(--text-dim);
  border-radius: 50%;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.backlink:hover, .backlink:focus-visible {
  color: var(--gold-bright);
  background: rgba(245, 217, 139, 0.08);
  outline: none;
}
.backlink:active { background: rgba(245, 217, 139, 0.16); }
/* On the sky the chevron sits over moving stars, so it needs its own ground. */
.backlink.onsky {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(245, 217, 139, 0.16);
  color: var(--gold);
}
.backlink.onsky:hover, .backlink.onsky:focus-visible {
  color: var(--gold-bright); border-color: var(--gold);
}

/* ---------- landing ---------- */
h1.titlemark {
  margin: 0 auto 4px;
  width: 100%;
  max-width: 400px;
  line-height: 0;          /* no stray text leading under the image */
}
h1.titlemark img {
  display: block;
  width: 100%;
  height: auto;
  /* The mark already carries its own burst; this just lifts it off the black. */
  filter: drop-shadow(0 0 34px rgba(245, 217, 139, 0.22));
}

.cornercount {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 16px;
  margin: 0; z-index: 5;
  font-size: 12px; letter-spacing: 0.06em; color: var(--text-faint);
}
.cornercount b { font-weight: 500; color: var(--gold); font-variant-numeric: tabular-nums; }

.previewsky {
  flex: 1 1 auto;
  min-height: 168px;
  max-height: 30dvh;
  position: relative;
  margin: 18px 0 4px;
}
.previewsky::after {
  /* Soften the top and bottom edges so the field reads as part of the page
     rather than as a box that was dropped onto it. */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #000 0%, transparent 10%, transparent 92%, #000 100%);
}
#preview { display: block; width: 100%; height: 100%; }


/* ---------- starburst ---------- */
.burst { position: relative; display: block; width: 100%; height: 0; }
.burst::before, .burst::after {
  content: ''; position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%);
  background: var(--star-white);
}
.burst::before { width: 220px; height: 1px; box-shadow: 0 0 18px 2px var(--gold-bright); }
.burst::after  { width: 1px; height: 64px; box-shadow: 0 0 18px 2px var(--gold-bright); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 14px 30px;
  font: inherit; font-size: 17px; font-weight: 500;
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(212, 162, 76, 0.22), rgba(138, 90, 30, 0.10));
  border: 1px solid rgba(245, 217, 139, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--glow-sm);
  cursor: pointer; text-decoration: none;
  width: 100%;
  transition: box-shadow 0.25s var(--ease), transform 0.12s var(--ease), background 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover, .btn:focus-visible { box-shadow: var(--glow-md); background: linear-gradient(180deg, rgba(212,162,76,0.30), rgba(138,90,30,0.14)); }
.btn:active { transform: scale(0.985); box-shadow: var(--glow-lg); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.ghost { background: transparent; border-color: rgba(245, 217, 139, 0.28); color: var(--text-dim); box-shadow: none; font-weight: 400; }
.btn.ghost:hover { border-color: rgba(245,217,139,0.5); color: var(--gold); }
.btn.sm { min-height: 40px; padding: 8px 16px; font-size: 14px; width: auto; }

.textlink {
  display: inline-block; min-height: 44px; line-height: 44px;
  color: var(--text-dim); font-size: 15px; text-decoration: none;
  border-bottom: 1px solid rgba(245, 217, 139, 0.22);
}
.textlink:hover { color: var(--gold-bright); border-color: var(--gold); }

/* ---------- form ---------- */
.field { margin: 0 0 22px; }
.label { display: block; font-size: 15px; font-weight: 500; color: var(--gold); margin: 0 0 8px; }
.label .opt { font-weight: 300; color: var(--text-faint); font-size: 13px; margin-left: 6px; }

.input, .textarea {
  width: 100%;
  /* 16px minimum, or iOS zooms the viewport the instant the field is focused. */
  font: inherit; font-size: 17px; line-height: 1.7;
  color: var(--star-white);
  background: rgba(255, 248, 231, 0.045);
  border: 1px solid rgba(245, 217, 139, 0.26);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: 56px;
  transition: border-color 0.2s, box-shadow 0.25s, background 0.2s;
}
.textarea { min-height: 92px; resize: none; }
.input::placeholder, .textarea::placeholder { color: rgba(245, 217, 139, 0.3); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 248, 231, 0.07);
  box-shadow: var(--glow-sm);
}
.counter { display: block; text-align: right; font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.counter.warn { color: var(--ember); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 2px 0 26px; }
.chip {
  font: inherit; font-size: 15px; font-weight: 400;
  color: var(--text-dim);
  background: rgba(245, 217, 139, 0.055);
  border: 1px solid rgba(245, 217, 139, 0.22);
  border-radius: var(--radius);
  /* 12px block padding keeps Thai tone marks clear of the border and takes the
     tap target past 44px without needing a fixed height. */
  padding: 12px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover, .chip:focus-visible { color: var(--gold-bright); border-color: var(--gold); background: rgba(245,217,139,0.1); box-shadow: var(--glow-sm); outline: none; }
.chip[aria-pressed="true"] { color: var(--star-white); border-color: var(--gold-bright); background: rgba(245,217,139,0.16); }

/* ---------- sticky action bar ---------- */
.actionbar {
  position: sticky; bottom: 0;
  padding: 22px 0 max(16px, env(safe-area-inset-bottom));
  /* The fade has to be opaque fast, a half-transparent bar sitting over an
     input field reads as a rendering bug, not as depth. */
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.92) 34%, #000 58%);
  backdrop-filter: blur(3px);
}

/* ---------- counter pill ---------- */
.count {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 15px; color: var(--text-dim); letter-spacing: 0.04em;
}
.count b { font-size: 22px; font-weight: 500; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.goal { height: 2px; background: rgba(245,217,139,0.14); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.goal i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); box-shadow: var(--glow-sm); transition: width 1.2s var(--ease); }

/* ---------- sky ---------- */
.skywrap { position: fixed; inset: 0; }
#sky { display: block; width: 100%; height: 100%; touch-action: none; }
.skyui { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.skyui > * { pointer-events: auto; }
.skytop {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 0;
}
.skybottom { padding: 0 var(--gutter) max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.filters { display: flex; gap: 8px; }
.filters button {
  font: inherit; font-size: 14px; color: var(--text-faint);
  background: rgba(0,0,0,0.45); border: 1px solid rgba(245,217,139,0.16);
  border-radius: var(--radius); padding: 9px 15px; min-height: 44px; cursor: pointer;
  backdrop-filter: blur(8px);
}
.filters button[aria-pressed="true"] { color: var(--gold-bright); border-color: var(--gold); }

.card {
  /* Fixed, not in the flex column, otherwise the closed card still reserves
     space and shows as an empty pill at the bottom of the sky. */
  position: fixed;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom) + 104px);
  max-width: 608px; margin: 0 auto;
  opacity: 0; pointer-events: none;
  background: rgba(10, 7, 5, 0.86);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(245, 217, 139, 0.26);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--glow-md), 0 20px 60px rgba(0,0,0,0.7);
  transform: translateY(18px);
  transition: transform 0.42s var(--ease), opacity 0.3s var(--ease);
}
.card[data-open="true"] { transform: translateY(0); opacity: 1; pointer-events: auto; }
.card .word { font-size: 24px; font-weight: 500; color: var(--gold-bright); margin: 0; line-height: 1.6; padding-right: 40px; }
.card .times { font-size: 14px; color: var(--ember); margin-left: 8px; font-weight: 400; }
.card .story { font-size: 15px; color: var(--text); margin: 14px 0 0; padding-left: 14px; border-left: 1px solid rgba(245,217,139,0.25); line-height: 1.85; }
.card .who { display: block; font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.card .close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; background: none; border: 0; color: var(--text-dim); font-size: 22px; cursor: pointer; }

/* ---------- list fallback / a11y view ---------- */
.list { padding: 24px 0 60px; }
.list li { list-style: none; padding: 16px 0; border-bottom: 1px solid rgba(245,217,139,0.1); }
.list .word { font-size: 19px; color: var(--gold-bright); font-weight: 500; }
.list .story { font-size: 15px; color: var(--text-dim); margin: 6px 0 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sr-only:focus-within, .sr-only:focus { position: static; width: auto; height: auto; clip: auto; margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  background: rgba(10,7,5,0.95); border: 1px solid rgba(245,217,139,0.3);
  color: var(--gold-bright); border-radius: var(--radius);
  padding: 13px 22px; font-size: 15px; max-width: calc(100vw - 32px);
  box-shadow: var(--glow-md); transition: transform 0.4s var(--ease); z-index: 90;
}
.toast[data-open="true"] { transform: translate(-50%, 0); }

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  .previewsky { min-height: 240px; max-height: 34dvh; }
  .btn { width: auto; min-width: 280px; }
  .actionbar { background: none; position: static; text-align: center; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
