/* Dhirise · landing (front door). Mobile first at 390px, then widens.
   The photo is the whole background; the only darkening is a soft gradient behind the card. */
:root{
  --ink:#f6f1e7; --muted:#d9d2e6; --sky-ink:#1b1641; --gold:#e9b95c; --gold-2:#f6d488; --err:#ffb3a8;
  --f-brand:"Marcellus",Georgia,serif;
  --f-head:"Playfair Display",Georgia,serif;
  --f-body:"Mukta",system-ui,-apple-system,"Segoe UI",sans-serif;
  --vh:100dvh;   /* replaced by the visible height when the keyboard opens (gate.js) */
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#16122b}
body{font-family:var(--f-body);color:var(--ink);-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%}
[hidden]{display:none!important}

/* ---------- stage ---------- */
.gate{
  position:relative;height:100vh;height:var(--vh);overflow:hidden;isolation:isolate;
  display:flex;flex-direction:column;
  padding:calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background:#16122b url("../assets/hero.png") no-repeat;
  background-size:cover;
  background-position:72% top;          /* phones: keep the face (upper right) in view */
}
/* soft dark gradient behind the card only (lower part on phones) */
.gate::before{
  content:"";position:absolute;left:0;right:0;bottom:0;height:58%;z-index:-1;pointer-events:none;
  background:linear-gradient(to top,rgba(14,10,32,.78) 0%,rgba(14,10,32,.55) 45%,rgba(14,10,32,0) 100%);
}

/* ---------- logo ---------- */
/* dark glass pill so the light logo reads on the bright sky (the image file itself is not recoloured) */
.brand{
  position:absolute;z-index:2;
  top:calc(16px + env(safe-area-inset-top));left:calc(16px + env(safe-area-inset-left));
  display:flex;align-items:center;gap:10px;
  padding:8px 14px;border-radius:999px;
  background:rgba(14,10,32,.45);
  -webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);
  border:1px solid rgba(255,255,255,.28);
}
.brand img{height:28px;width:auto;display:block}
.brand .wm{display:flex;flex-direction:column;line-height:1.1}
.brand .wm b{font-family:var(--f-body);font-size:16px;font-weight:600;color:#fff;letter-spacing:.01em}
.brand .wm small{margin-top:2px;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--gold-2)}

/* ---------- punch line, in the open sky above the card ---------- */
.copy{margin-top:auto;padding:0 2px 12px;max-width:54vw}   /* phones: stay in the open sky, left of the face */
.copy h1{margin:0;font-family:var(--f-head);font-weight:700;font-size:clamp(30px,8.6vw,40px);line-height:1.05;letter-spacing:-.01em;
  color:var(--sky-ink);text-shadow:0 1px 14px rgba(255,236,200,.7)}
.copy p{margin:8px 0 0;font-size:15px;line-height:1.35;font-weight:600;color:var(--sky-ink);text-shadow:0 1px 10px rgba(255,236,200,.75)}

.copy h1{max-width:4.8em}   /* phones: "I want to / be heard." stays clear of the face */

/* ---------- glass card ---------- */
.card{
  flex:none;width:100%;max-width:400px;
  max-height:calc(var(--vh) - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  padding:20px 24px 24px;border-radius:24px;
  background:rgba(20,15,42,.52);
  -webkit-backdrop-filter:blur(18px) saturate(1.2);backdrop-filter:blur(18px) saturate(1.2);
  border:1px solid rgba(255,255,255,.22);
  box-shadow:0 20px 60px -20px rgba(0,0,0,.6);
}
.card-brand{margin:0 0 12px;font-size:15px;line-height:1.45;font-weight:500;color:var(--ink)}
form{display:flex;flex-direction:column;gap:10px;margin:0}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:14px;font-weight:600;color:var(--muted)}
.field input,.field select{
  width:100%;min-height:48px;padding:10px 14px;font:500 16px var(--f-body);   /* 16px: iOS won't zoom */
  color:var(--ink);background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.25);border-radius:12px;outline:none;
  -webkit-appearance:none;appearance:none;
}
.field select{background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 20px) 55%,calc(100% - 14px) 55%;background-size:6px 6px;background-repeat:no-repeat;padding-right:38px}
.field select option{color:#1b1641;background:#fff}
.field input:focus,.field select:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(233,185,92,.25)}
.field input[aria-invalid="true"],.field select[aria-invalid="true"]{border-color:var(--err)}
.field input::-webkit-outer-spin-button,.field input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.field input[type=number]{-moz-appearance:textfield}
.row2{display:grid;grid-template-columns:1fr 1.25fr;gap:10px}
.row2 .field{min-width:0}
#ref{text-transform:uppercase;letter-spacing:.08em}
#ref::placeholder{text-transform:none;letter-spacing:0}
/* referral code status: a green tick + "Invited by …", or a muted note; never an error */
.ref-status{display:flex;align-items:center;gap:6px;margin:0;font-size:13px;line-height:1.3;color:var(--muted)}
.ref-status:empty{display:none}
.ref-status.ok{color:#7fe0a8}
.ref-status svg{flex:none;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.err{margin:0;min-height:0;font-size:13px;color:var(--err)}
.err:empty{display:none}

.or{display:flex;align-items:center;gap:10px;margin:2px 0;color:var(--muted);font-size:13px}
.or::before,.or::after{content:"";flex:1;height:1px;background:rgba(255,255,255,.22)}

/* the button stays reachable: it sticks to the bottom of the card while the card scrolls */
.submit{position:sticky;bottom:-24px;margin:0 -24px -24px;padding:4px 24px 24px;
  background:linear-gradient(to top,rgba(20,15,42,.92) 60%,rgba(20,15,42,0))}
.btn{display:flex;align-items:center;justify-content:center;width:100%;min-height:48px;padding:12px 18px;border:0;border-radius:14px;cursor:pointer;
  font:700 17px var(--f-body);color:#22180a;background:linear-gradient(180deg,var(--gold-2),var(--gold));box-shadow:0 10px 26px -12px var(--gold)}
.btn:active{transform:translateY(1px)}
.btn:focus-visible,.link:focus-visible{outline:2px solid #fff;outline-offset:3px}

/* consent (DPDP): unchecked by default, 22px box, 48px row, label wraps */
.consent{display:flex;align-items:flex-start;gap:12px;min-height:48px;padding:4px 0}
.consent input{flex:none;width:22px;height:22px;margin:1px 0 0;cursor:pointer;
  -webkit-appearance:none;appearance:none;border:1.5px solid rgba(255,255,255,.55);border-radius:6px;background:rgba(255,255,255,.08);
  display:grid;place-content:center}
.consent input::after{content:"";width:11px;height:6px;border:2.5px solid #22180a;border-top:0;border-right:0;transform:rotate(-45deg) translate(1px,-1px);opacity:0}
.consent input:checked{background:var(--gold);border-color:var(--gold)}
.consent input:checked::after{opacity:1}
.consent input:focus-visible{outline:2px solid #fff;outline-offset:3px}
.consent input[aria-invalid="true"]{border-color:var(--err)}
.consent label{font-size:14px;line-height:1.45;color:var(--muted);cursor:pointer}
.btn[aria-disabled="true"]{opacity:.45;box-shadow:none;cursor:not-allowed}

.back{display:flex;flex-direction:column;align-items:stretch;gap:10px}
.back .btn span{margin-left:.3em}
.link{align-self:center;background:none;border:0;padding:8px;font:500 15px var(--f-body);color:var(--muted);text-decoration:underline;cursor:pointer}

/* phones: the card carries a brand sentence and the consent row, so keep its rhythm compact
   and the copy low in the open sky, clear of the face */
@media (max-width:899px){
  .copy p{max-width:46vw}
  .card{padding:18px 20px 20px}
  .card-brand{font-size:14px;line-height:1.4;margin-bottom:10px}
  form{gap:8px}
  .field{gap:4px}
  .field label{font-size:13px}
  .field input,.field select{min-height:44px;padding:8px 14px}
  .or{margin:0}
  .consent{gap:10px;padding:2px 0}
  .consent label{font-size:13px;line-height:1.4}
  .submit{bottom:-20px;margin:0 -20px -20px;padding:4px 20px 20px}
}

/* short phones (e.g. 375×667): tighten so the face stays clear */
@media (max-height:700px) and (max-width:899px){
  .copy h1{font-size:32px}
  .copy p{font-size:15px}
  .card{padding:18px}
  .submit{bottom:-18px;margin:0 -18px -18px;padding:4px 18px 18px}
  form{gap:9px}
  .field input,.field select{min-height:46px}
}

/* ---------- wide screens: card left-center, punch line in the sky above it ---------- */
@media (min-width:900px){
  .gate{
    padding:calc(28px + env(safe-area-inset-top)) 48px 28px;
    justify-content:center;
    background-position:right 10%;    /* portrait photo on a wide screen: anchor high so the face is never cropped */
  }
  .gate::before{
    top:0;bottom:0;height:auto;right:auto;width:min(720px,60vw);
    background:radial-gradient(ellipse 85% 60% at 32% 62%,rgba(14,10,32,.68) 0%,rgba(14,10,32,.42) 45%,rgba(14,10,32,0) 75%);
  }
  .brand img{height:32px}
  .copy{margin-top:0;padding:0 0 18px;max-width:560px}
  .copy h1{font-size:clamp(46px,4.6vw,64px);max-width:none}
  .copy p{font-size:18px;max-width:34ch}
  .card{max-width:400px}
}

/* motion only when welcome */
@media (prefers-reduced-motion:no-preference){
  .copy,.card{animation:rise .6s cubic-bezier(.2,.7,.2,1) both}
  .card{animation-delay:.08s}
  @keyframes rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
}

/* ---------- falling leaves (drawn by gate.js) ----------
   Fixed layer over the photo and the card; it never takes a tap, so clicks pass straight through. */
.leaves{position:fixed;inset:0;z-index:5;pointer-events:none;overflow:hidden;contain:strict}
.leaf{position:absolute;left:0;top:0;pointer-events:none;will-change:transform,opacity;filter:drop-shadow(0 2px 3px rgba(40,20,0,.25))}
.leaf svg{display:block;width:100%;height:100%}
@media (prefers-reduced-motion:reduce){.leaves{display:none}}

/* ---------- consent sheet ----------
   Phones: rises from the bottom (max 70dvh). Wide screens: centred, max 420px. Above the leaves. */
.sheet-dim{position:fixed;inset:0;z-index:20;display:flex;align-items:flex-end;justify-content:center;background:rgba(10,7,24,.55)}
.sheet{
  width:100%;max-height:70dvh;display:flex;flex-direction:column;
  padding:18px 20px calc(18px + env(safe-area-inset-bottom));
  border-radius:24px 24px 0 0;
  background:rgba(20,15,42,.82);
  -webkit-backdrop-filter:blur(18px) saturate(1.2);backdrop-filter:blur(18px) saturate(1.2);
  border:1px solid rgba(255,255,255,.22);border-bottom:0;
  box-shadow:0 -20px 60px -20px rgba(0,0,0,.6);color:var(--ink);
}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.sheet-head h2{margin:0;font-family:var(--f-head);font-weight:700;font-size:22px;color:#fff}
.sheet-x{flex:none;width:44px;height:44px;margin:-6px -8px -6px 0;display:grid;place-items:center;border:0;border-radius:12px;background:transparent;color:var(--muted);cursor:pointer}
.sheet-x svg{width:22px;height:22px}
.sheet-x:hover{color:#fff;background:rgba(255,255,255,.08)}
.sheet-x:focus-visible,.sheet-body:focus-visible{outline:2px solid #fff;outline-offset:2px}
.sheet-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;font-size:15px;line-height:1.5;color:var(--ink)}
.sheet-body ul{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:12px}
.sheet-body li{position:relative;padding-left:18px}
.sheet-body li::before{content:"";position:absolute;left:2px;top:.62em;width:7px;height:7px;border-radius:50%;background:var(--gold)}
.sheet-body p{margin:0 0 12px}
.sheet-body p:last-child{margin-bottom:0}
.sheet-foot{flex:none;padding-top:14px}
.sheet-hint{margin:0 0 8px;font-size:12px;color:var(--muted);text-align:center}
/* the last line of the notice ("By tapping I agree, …"): highlighted in gold */
#consentLines .consent-final{padding:10px 12px;border-left:3px solid var(--gold);border-radius:8px;
  background:rgba(233,185,92,.12);color:var(--gold-2);font-weight:600}
/* "I agree": muted until the notice is read, then clearly lit */
#agree[aria-disabled="true"]{opacity:.45;box-shadow:none;cursor:not-allowed}
#agree[aria-disabled="false"]{opacity:1;font-weight:700;font-size:18px;color:#1c140c;
  background:linear-gradient(180deg,#f6d58e,var(--gold) 55%,#c9963f);
  box-shadow:0 0 0 3px rgba(233,185,92,.35),0 8px 24px rgba(233,185,92,.45)}
@media (prefers-reduced-motion:no-preference){
  #agree.pulse[aria-disabled="false"]{animation:agreePulse .6s ease-out 1}
  @keyframes agreePulse{0%{transform:scale(1)}50%{transform:scale(1.03)}100%{transform:scale(1)}}
}
@media (min-width:900px){
  .sheet-dim{align-items:center}
  .sheet{max-width:420px;border-radius:24px;border-bottom:1px solid rgba(255,255,255,.22);padding-bottom:20px}
}
@media (prefers-reduced-motion:no-preference){
  .sheet-dim:not([hidden]){animation:dimIn .25s ease both}
  .sheet-dim:not([hidden]) .sheet{animation:sheetUp .35s cubic-bezier(.2,.7,.2,1) both}
  @keyframes dimIn{from{opacity:0}to{opacity:1}}
  @keyframes sheetUp{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
}

/* temporary: preview link for the new question screen */
.preview{display:block;margin-top:8px;text-align:center;font-size:13px;color:var(--muted);text-decoration:underline;min-height:24px}
