/* =========================================================
   JJ Signature – Diwali Love Letter Contest
   Mobile-first. Desktop shows the same phone-width column.
   ========================================================= */

:root {
  --bg: #F4F2F0;
  --paper: #FFFFFF;
  --paper-warm: #FBF9F6;
  --brown: #4E4237;
  --brown-2: #6B5A4B;
  --muted: #8A7D72;
  --line: #E4DED7;
  --gold: #B08D57;
  --gold-soft: #EADBC2;
  --error: #B3261E;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(78, 66, 55, .08);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Great Vibes', cursive;
  --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tamil: 'Noto Sans Tamil', 'Latha', sans-serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--brown);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.lang-ta { font-family: var(--tamil), var(--sans); font-size: 14.5px; }
.ta { font-family: var(--tamil); }

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ---------- Splash ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #FFFFFF 0%, var(--bg) 65%);
  overflow: hidden;
  transition: opacity .6s ease, visibility .6s;
}
.splash.leaving { opacity: 0; visibility: hidden; }

.splash-inner {
  width: 100%;
  max-width: 420px;
  padding: 24px 28px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}

.splash-logo {
  width: 220px;
  margin: 0 auto -20px;
  mix-blend-mode: multiply;          /* white logo background blends into theme */
  animation: logoIn 1.1s cubic-bezier(.2,.7,.2,1) both;
}

.splash-line {
  width: 0;
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: lineGrow .9s .7s ease forwards;
}

.splash-tag {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  letter-spacing: .5px;
  color: var(--brown-2);
  opacity: 0;
  animation: fadeUp .7s 1s ease forwards;
}

.splash-choose { margin-top: 42px; opacity: 0; animation: fadeUp .7s 1.35s ease forwards; }

.splash-q { margin: 0 0 18px; font-size: 14px; color: var(--muted); line-height: 1.8; }

.lang-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn-lang {
  padding: 16px 10px;
  border: 1px solid var(--brown);
  border-radius: 999px;
  background: transparent;
  color: var(--brown);
  font: 500 17px var(--sans);
  cursor: pointer;
  transition: background .25s, color .25s, transform .15s;
}
.btn-lang .ta { font-weight: 600; }
.btn-lang:hover, .btn-lang:focus-visible { background: var(--brown); color: #fff; outline: none; }
.btn-lang:active { transform: scale(.97); }

.spark {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px 3px rgba(176, 141, 87, .45);
  opacity: 0;
  animation: twinkle 3.2s ease-in-out infinite;
}
.s1 { top: 14%; left: 16%; animation-delay: .4s; }
.s2 { top: 22%; right: 14%; animation-delay: 1.4s; width: 4px; height: 4px; }
.s3 { bottom: 18%; left: 12%; animation-delay: 2.1s; width: 4px; height: 4px; }
.s4 { bottom: 26%; right: 18%; animation-delay: .9s; }

@keyframes logoIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes lineGrow { to { width: 180px; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.6); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- App shell ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  opacity: 0;
  transition: opacity .6s ease;
}
.app.visible { opacity: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 16px;
  background: rgba(244, 242, 240, .92);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { height: 36px; width: auto; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font: 500 13px var(--sans);
  cursor: pointer;
}
.lang-toggle .active { color: var(--brown); font-weight: 600; }
.lang-toggle .sep { color: var(--line); }

main { padding: 0 16px 8px; }

/* ---------- Hero ---------- */

.hero { padding: 28px 8px 26px; text-align: center; }

.hero-kicker {
  margin: 0 0 6px;
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}
.lang-ta .hero-kicker { letter-spacing: .5px; font-size: 12px; }

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.15;
  font-weight: 600;
}
.lang-ta .hero-title { font-family: var(--tamil); font-size: 25px; line-height: 1.45; font-weight: 700; }

.hero-script {
  margin: 4px 0 10px;
  font-family: var(--script);
  font-size: 34px;
  line-height: 1.2;
  color: var(--gold);
}

.hero-sub { margin: 0 auto 22px; max-width: 360px; color: var(--brown-2); font-size: 14px; }

.hero-date { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.hero-date strong { color: var(--brown); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--brown); color: #fff; box-shadow: 0 8px 20px rgba(78, 66, 55, .25); }
.btn-primary:hover { background: #3F352C; }
.btn-primary:disabled { opacity: .75; cursor: progress; }

.btn-block { width: 100%; }

.btn-ghost { background: transparent; color: var(--brown); border: 1px solid var(--brown); min-height: 42px; padding: 8px 22px; font-size: 14px; }

.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */

.card {
  margin-bottom: 18px;
  padding: 24px 18px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-title {
  position: relative;
  margin: 0 0 20px;
  padding-bottom: 12px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.section-title::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 0;
  width: 56px; height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.lang-ta .section-title { font-family: var(--tamil); font-size: 19px; font-weight: 700; line-height: 1.5; }

/* ---------- Rewards ---------- */

.reward-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.reward-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.r-ico {
  flex: 0 0 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--gold-soft);
  border-radius: 50%;
}
.reward-list h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.reward-list p { margin: 0; font-size: 13.5px; color: var(--brown-2); }

/* ---------- Form ---------- */

.entry-form { padding-top: 26px; }

.field, fieldset.field { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }

.q {
  display: block;
  margin-bottom: 10px;
  padding: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.45;
}
.hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-warm);
  color: var(--brown);
  font: 16px var(--sans);        /* 16px stops iOS zoom on focus */
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none;
  appearance: none;
}
.lang-ta .input { font-family: var(--tamil), var(--sans); }
.input::placeholder { color: #B5AAA0; }
.input:focus { outline: none; border-color: var(--gold); background: #fff; box-shadow: 0 0 0 3px rgba(176, 141, 87, .18); }

.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

.letter-paper .textarea {
  min-height: 200px;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 27px, #EFE7DC 27px, #EFE7DC 28px) local,
    #FFFDF9;
  line-height: 28px;
  padding-top: 10px;
}

.counter { margin-top: 4px; text-align: right; font-size: 12px; color: var(--muted); }

.sub { margin-bottom: 14px; }
.sub-l { display: block; margin-bottom: 6px; font-size: 13px; color: var(--brown-2); }

.phone { display: flex; align-items: stretch; }
.phone .cc {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: var(--bg);
  font-size: 15px;
  color: var(--brown-2);
}
.phone .input { border-radius: 0 12px 12px 0; letter-spacing: 1px; }

/* Relationship chips */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { position: relative; cursor: pointer; }
.chip-wide { grid-column: 1 / -1; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 100%;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-warm);
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
  transition: all .2s;
}
.chip input:checked + span {
  border-color: var(--brown);
  background: var(--brown);
  color: #fff;
  box-shadow: 0 4px 12px rgba(78, 66, 55, .2);
}
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(176, 141, 87, .35); }

.other-wrap { margin-top: 10px; }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.captcha-row img { border: 1px solid var(--line); border-radius: 10px; background: var(--paper-warm); }
.captcha-refresh {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--brown);
  cursor: pointer;
}
.captcha-refresh:active { transform: rotate(-90deg); transition: transform .2s; }
.captcha-input { max-width: 190px; text-transform: uppercase; letter-spacing: 4px; font-weight: 600; }

/* Checkboxes */
.privacy { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.check { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; font-size: 13.5px; cursor: pointer; }
.check input {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brown);
}
.check a { color: var(--brown); font-weight: 500; }
.field .check { margin-bottom: 0; }

/* Errors */
.err { margin: 6px 0 0; font-size: 12.5px; color: var(--error); min-height: 0; }
.err:empty { display: none; }
.has-error .input, .has-error .chip span { border-color: var(--error); }
.has-error .phone .cc { border-color: var(--error); }

.form-error {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #FCEEEE;
  color: var(--error);
  font-size: 13.5px;
}

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Rules ---------- */

.rules { padding: 6px 18px; }
.rules details { border-bottom: 1px solid var(--line); }
.rules details:last-child { border-bottom: 0; }
.rules summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: '+'; font-size: 22px; font-weight: 300; color: var(--gold); line-height: 1; }
.rules details[open] summary::after { content: '–'; }
.rules ol { margin: 0 0 16px; padding-left: 20px; font-size: 13.5px; color: var(--brown-2); }
.rules li { margin-bottom: 8px; }

.dates { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0 0 12px; font-size: 13.5px; }
.dates dt { color: var(--muted); }
.dates dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; }

.note { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); font-style: italic; }

/* ---------- Closed ---------- */

.closed { text-align: center; color: var(--brown-2); }

/* ---------- Thank you ---------- */

.thanks { padding: 24px 16px 8px; }
.thanks-card { text-align: center; padding: 34px 20px; animation: fadeUp .6s ease both; }
.heart { font-size: 42px; color: #C0392B; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }

.coupon {
  margin: 24px 0 16px;
  padding: 20px 16px;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  background: var(--paper-warm);
}
.coupon-label { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.coupon-code {
  margin-bottom: 14px;
  font-family: 'Courier New', monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--brown);
  user-select: all;
}
.thanks-sign { margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 19px; }
.lang-ta .thanks-sign { font-family: var(--tamil); font-style: normal; font-size: 15px; }

/* ---------- Footer ---------- */

.footer { padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; font-size: 12.5px; color: var(--muted); }
.footer-logo { width: 80px; margin: 0 auto 8px; opacity: .85; }
.footer p { margin: 0; }

/* ---------- Larger screens ---------- */

@media (min-width: 600px) {
  body { background: linear-gradient(180deg, #EDE9E5 0%, var(--bg) 40%); }
  .app { box-shadow: 0 0 0 1px var(--line); background: var(--bg); }
  .hero-title { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .splash-line { width: 180px; }
  .splash-tag, .splash-choose { opacity: 1; }
}
