/* ATREYA_AUTH_R4_FULL_REBUILD
   Full light-theme reconstruction for Login/Register.
   Dark theme is intentionally left to the existing app renderer.
*/

:root[data-theme="light"] {
  --r4-bg: #fffaf1;
  --r4-bg-2: #fffdf8;
  --r4-panel: rgba(255,253,247,.96);
  --r4-ink: #281608;
  --r4-muted: #765d3e;
  --r4-gold: #c9851b;
  --r4-gold-2: #f0b33c;
  --r4-line: rgba(177,113,22,.24);
  --r4-shadow: 0 24px 64px rgba(104,63,11,.12);
}

body.atreya-auth-r4-active {
  margin: 0 !important;
  min-height: 100dvh !important;
  overflow-x: hidden !important;
  background:
    radial-gradient(circle at 8% 26%, rgba(244,190,74,.16), transparent 28%),
    radial-gradient(circle at 83% 70%, rgba(232,174,62,.08), transparent 28%),
    linear-gradient(118deg,#fffdf8 0%,#fff8e9 48%,#fffdf9 100%) !important;
  color: var(--r4-ink) !important;
}

body.atreya-auth-r4-active #app {
  min-height: 100dvh !important;
  background: transparent !important;
}

.atreya-auth-r4-root,
.atreya-auth-r4-root * { box-sizing: border-box; }

.atreya-auth-r4-root {
  min-height: 100dvh;
  color: var(--r4-ink);
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.atreya-auth-r4-root::before,
.atreya-auth-r4-root::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
}
.atreya-auth-r4-root::before {
  width: 520px; height: 520px;
  left: -220px; top: 170px;
  background: radial-gradient(circle,rgba(244,184,63,.20),rgba(244,184,63,0) 70%);
}
.atreya-auth-r4-root::after {
  width: 420px; height: 420px;
  right: -150px; bottom: -170px;
  background: radial-gradient(circle,rgba(231,164,48,.13),rgba(231,164,48,0) 70%);
}

/* Header */
.atreya-auth-r4-header {
  height: 78px;
  padding: 0 clamp(24px,4.6vw,78px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 26px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,252,245,.91);
  border-bottom: 1px solid rgba(172,112,28,.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.atreya-auth-r4-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--r4-ink) !important;
  white-space: nowrap;
}
.atreya-auth-r4-seal {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #2b1808;
  background: radial-gradient(circle at 35% 30%,#ffe59a,#e6a12f 72%);
  border: 1px solid rgba(154,91,5,.30);
  box-shadow: 0 8px 22px rgba(171,101,9,.14), inset 0 0 0 5px rgba(255,248,214,.35);
}
.atreya-auth-r4-brand-copy { display:flex; flex-direction:column; line-height:1; }
.atreya-auth-r4-brand-copy b {
  font: 700 31px/1 Georgia,"Times New Roman",serif;
  color: #2c1909 !important;
  letter-spacing: -.02em;
}
.atreya-auth-r4-brand-copy span {
  margin-top: 5px;
  color: #8a5a19 !important;
  font-size: 12px;
}

.atreya-auth-r4-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(18px,2.1vw,34px);
}
.atreya-auth-r4-nav a {
  position: relative;
  padding: 29px 0 24px;
  color: #2d2013 !important;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.atreya-auth-r4-nav a:hover::after,
.atreya-auth-r4-nav a.is-active::after {
  content:"";
  position:absolute;
  left:0; right:0; bottom:16px;
  height:2px;
  border-radius:99px;
  background: linear-gradient(90deg,#b66b09,#e8ab38);
}

.atreya-auth-r4-actions { display:flex; align-items:center; gap:10px; }
.atreya-auth-r4-action {
  height: 42px;
  padding: 0 20px;
  border: 1px solid rgba(172,103,12,.48);
  border-radius: 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:#2c1a0b !important;
  background: rgba(255,255,255,.56);
  text-decoration:none;
  font-size:14px;
  font-weight:700;
}
.atreya-auth-r4-action.primary {
  border-color: rgba(181,105,6,.28);
  background: linear-gradient(135deg,#ffe199,#efad35);
  box-shadow: 0 8px 20px rgba(194,119,14,.16);
}
.atreya-auth-r4-global {
  color:#76511d;
  font-size:13px;
  white-space:nowrap;
}

/* Main desktop composition */
.atreya-auth-r4-main {
  width: min(1600px,calc(100% - 54px));
  min-height: calc(100dvh - 78px);
  margin: 0 auto;
  padding: 18px 0 24px;
  display:grid;
  grid-template-columns: minmax(330px,.92fr) minmax(420px,1.08fr) minmax(360px,.86fr);
  gap: clamp(20px,2.15vw,38px);
  align-items:center;
}

/* Left visual */
.atreya-auth-r4-visual {
  min-width:0;
  height: min(760px,calc(100dvh - 112px));
  min-height: 560px;
  align-self:center;
  position:relative;
  overflow:hidden;
  border-radius: 34px;
  isolation:isolate;
  background:
    radial-gradient(circle at 52% 32%,rgba(255,214,113,.58),transparent 38%),
    linear-gradient(180deg,rgba(255,251,239,.70),rgba(255,247,229,.25));
}
.atreya-auth-r4-visual::after {
  content:"";
  position:absolute;
  inset:0;
  z-index:4;
  pointer-events:none;
  background:
    linear-gradient(90deg,transparent 0 72%,rgba(255,250,241,.25) 84%,#fffaf1 100%),
    linear-gradient(180deg,rgba(255,250,241,.14),transparent 10% 88%,rgba(255,250,241,.92) 100%);
}
.atreya-auth-r4-hero-image {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center center;
  z-index:2;
  filter:saturate(1.04) contrast(1.02);
}
.atreya-auth-r4-rashi {
  position:absolute;
  z-index:1;
  width:92%;
  aspect-ratio:1;
  left:2%;
  top:5%;
  opacity:.20;
  mix-blend-mode:multiply;
  filter:sepia(.26) saturate(1.12) contrast(1.08) drop-shadow(0 0 10px rgba(199,132,22,.14));
  animation: atreyaR4Orbit 64s linear infinite;
}
.atreya-auth-r4-rashi.inner {
  width:69%;
  left:13%;
  top:17%;
  opacity:.13;
  animation-duration:88s;
  animation-direction:reverse;
}
@keyframes atreyaR4Orbit { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .atreya-auth-r4-rashi { animation:none; }
}

/* Center copy */
.atreya-auth-r4-copy {
  align-self:center;
  min-width:0;
  padding: 8px 0;
}
.atreya-auth-r4-eyebrow {
  width:max-content;
  max-width:100%;
  padding: 8px 13px;
  border:1px solid rgba(183,115,18,.24);
  border-radius:999px;
  background:rgba(244,185,76,.10);
  color:#8d5707;
  font-size:11px;
  letter-spacing:.16em;
  font-weight:850;
  text-transform:uppercase;
}
.atreya-auth-r4-copy h1 {
  margin: 17px 0 17px;
  font: 700 clamp(52px,4.05vw,76px)/.94 Georgia,"Times New Roman",serif;
  letter-spacing:-.045em;
  color:#281507 !important;
}
.atreya-auth-r4-copy h1 .gold { color:#cc8820 !important; }
.atreya-auth-r4-copy p {
  max-width: 560px;
  margin:0;
  color:#735c45 !important;
  font-size:15px;
  line-height:1.7;
}
.atreya-auth-r4-features {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:22px;
}
.atreya-auth-r4-feature {
  min-height:74px;
  padding:12px 12px;
  display:grid;
  grid-template-columns:36px 1fr;
  align-items:center;
  gap:9px;
  border:1px solid rgba(176,111,20,.23);
  border-radius:16px;
  background:rgba(255,253,247,.78);
  box-shadow:0 8px 24px rgba(115,68,10,.05);
}
.atreya-auth-r4-feature .ico {
  width:36px;height:36px;
  border-radius:11px;
  display:grid;place-items:center;
  color:#b56e0a;
  background:#fff7e6;
  border:1px solid rgba(180,110,14,.18);
  font-size:18px;
}
.atreya-auth-r4-feature b { display:block;color:#2e1b0b !important;font-size:13px;line-height:1.15; }
.atreya-auth-r4-feature small { display:block;margin-top:3px;color:#715a3d !important;font-size:10.5px;line-height:1.25; }
.atreya-auth-r4-trust {
  display:flex;
  flex-wrap:wrap;
  gap:10px 18px;
  margin-top:20px;
  padding-top:15px;
  border-top:1px solid rgba(175,111,18,.18);
  color:#6a5134;
  font-size:11px;
}
.atreya-auth-r4-trust span::before { content:"✦"; color:#c9871d; margin-right:7px; }

/* Right card */
.atreya-auth-r4-formcol {
  min-width:0;
  align-self:center;
  display:flex;
  justify-content:flex-end;
}
.atreya-auth-r4-card {
  width:100%;
  max-width:455px;
  padding:34px 34px 28px;
  border-radius:28px;
  border:1px solid rgba(179,112,20,.24);
  background:
    radial-gradient(circle at 8% 5%,rgba(255,221,139,.18),transparent 24%),
    linear-gradient(145deg,rgba(255,253,247,.97),rgba(255,247,229,.94));
  box-shadow:var(--r4-shadow),inset 0 1px rgba(255,255,255,.95);
}
.atreya-auth-r4-card .r4-card-line { width:44px;height:2px;border-radius:99px;background:linear-gradient(90deg,#f3c665,#b87310);margin-bottom:20px; }
.atreya-auth-r4-card .r4-card-badge {
  width:max-content;max-width:100%;
  padding:7px 11px;
  border:1px solid rgba(183,115,18,.22);
  border-radius:999px;
  color:#8e5707;
  background:rgba(244,185,76,.10);
  font-size:10px;
  font-weight:850;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.atreya-auth-r4-card h2 {
  margin:10px 0 9px;
  font:700 clamp(37px,2.8vw,48px)/.98 Georgia,"Times New Roman",serif;
  color:#291705 !important;
  letter-spacing:-.035em;
}
.atreya-auth-r4-card .r4-card-subtitle { margin:0 0 22px;color:#775f42 !important;font-size:13.5px;line-height:1.5; }

.atreya-auth-r4-card form { margin:0 !important; padding:0 !important; background:transparent !important; box-shadow:none !important; border:0 !important; }
.atreya-auth-r4-card form > :where(h1,h2,h3,p):first-child { display:none !important; }
.atreya-auth-r4-card label { display:block;margin:0 0 7px;color:#2d1b0b !important;font-size:11.5px;font-weight:800; }
.atreya-auth-r4-card input,
.atreya-auth-r4-card select,
.atreya-auth-r4-card textarea {
  width:100% !important;
  min-height:52px !important;
  margin:0 0 14px !important;
  padding:0 16px !important;
  border-radius:14px !important;
  border:1px solid rgba(179,119,34,.30) !important;
  background:rgba(255,255,255,.88) !important;
  color:#281608 !important;
  font-size:14px !important;
  box-shadow:inset 0 1px 2px rgba(115,72,14,.03) !important;
  outline:none !important;
}
.atreya-auth-r4-card input:focus,
.atreya-auth-r4-card select:focus,
.atreya-auth-r4-card textarea:focus {
  border-color:#d89a30 !important;
  box-shadow:0 0 0 4px rgba(216,154,48,.10),0 8px 20px rgba(136,84,14,.06) !important;
}
.atreya-auth-r4-card button[type="submit"],
.atreya-auth-r4-card .btn-primary {
  width:100% !important;
  min-height:52px !important;
  border:1px solid rgba(168,103,15,.34) !important;
  border-radius:15px !important;
  background:linear-gradient(90deg,#ffe08c,#f5ae31) !important;
  color:#201304 !important;
  font-weight:850 !important;
  font-size:14px !important;
  box-shadow:0 10px 24px rgba(203,126,18,.14) !important;
}
.atreya-auth-r4-card button[type="submit"]:hover { filter:brightness(1.02);box-shadow:0 12px 28px rgba(203,126,18,.20) !important; }
.atreya-auth-r4-card .auth-links,
.atreya-auth-r4-links {
  margin-top:14px !important;
  display:flex !important;
  justify-content:space-between !important;
  gap:12px !important;
  flex-wrap:wrap !important;
}
.atreya-auth-r4-card .auth-links a,
.atreya-auth-r4-links a { color:#8e5707 !important;font-weight:750 !important;font-size:12px !important;text-decoration:none !important; }
.atreya-auth-r4-note {
  margin-top:18px;
  padding:13px 14px;
  border-radius:14px;
  border:1px solid rgba(181,113,17,.18);
  background:rgba(255,255,255,.58);
  color:#69533a !important;
  font-size:11.5px;
  line-height:1.5;
}

/* Do not show legacy T3 injected header if old cache survives briefly. */
body.atreya-auth-r4-active > :where(#atreyaAuthT3Header,#atreyaAuthT3R1Header,.atreya-auth-t3-header) { display:none !important; }

/* Large laptop */
@media (max-width: 1420px) {
  .atreya-auth-r4-main { width:min(1360px,calc(100% - 38px));grid-template-columns:minmax(300px,.85fr) minmax(390px,1fr) minmax(340px,.83fr);gap:20px; }
  .atreya-auth-r4-copy h1 { font-size:clamp(48px,4vw,64px); }
  .atreya-auth-r4-card { padding:30px 28px 25px; }
  .atreya-auth-r4-nav { gap:18px; }
}

/* Tablet / smaller laptop */
@media (max-width: 1180px) {
  .atreya-auth-r4-header { grid-template-columns:auto 1fr auto; }
  .atreya-auth-r4-nav { display:none; }
  .atreya-auth-r4-main {
    grid-template-columns:minmax(300px,.9fr) minmax(430px,1.1fr);
    grid-template-areas:"visual copy" "form form";
    align-items:center;
    padding-top:28px;
  }
  .atreya-auth-r4-visual { grid-area:visual;height:610px;min-height:520px; }
  .atreya-auth-r4-copy { grid-area:copy; }
  .atreya-auth-r4-formcol { grid-area:form;justify-content:center;padding-bottom:30px; }
  .atreya-auth-r4-card { max-width:620px; }
}

@media (max-width: 820px) {
  .atreya-auth-r4-header { height:70px;padding:0 18px;grid-template-columns:auto 1fr; }
  .atreya-auth-r4-actions { justify-self:end; }
  .atreya-auth-r4-action:first-child,.atreya-auth-r4-global { display:none; }
  .atreya-auth-r4-main {
    width:min(720px,calc(100% - 28px));
    min-height:calc(100dvh - 70px);
    grid-template-columns:1fr;
    grid-template-areas:"copy" "form" "visual";
    gap:20px;
    padding:26px 0 38px;
  }
  .atreya-auth-r4-copy { text-align:center; }
  .atreya-auth-r4-eyebrow { margin-inline:auto; }
  .atreya-auth-r4-copy p { margin-inline:auto; }
  .atreya-auth-r4-features { max-width:620px;margin-inline:auto;margin-top:20px; }
  .atreya-auth-r4-trust { justify-content:center; }
  .atreya-auth-r4-formcol { padding:0; }
  .atreya-auth-r4-card { max-width:600px;margin-inline:auto; }
  .atreya-auth-r4-visual { height:620px;min-height:0; }
}

@media (max-width: 560px) {
  .atreya-auth-r4-brand-copy b { font-size:25px; }
  .atreya-auth-r4-brand-copy span { font-size:10px; }
  .atreya-auth-r4-seal { width:42px;height:42px;font-size:23px; }
  .atreya-auth-r4-action.primary { padding:0 13px;height:40px;font-size:12px; }
  .atreya-auth-r4-main { width:calc(100% - 22px);padding-top:20px; }
  .atreya-auth-r4-copy h1 { font-size:44px; }
  .atreya-auth-r4-copy p { font-size:14px; }
  .atreya-auth-r4-features { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .atreya-auth-r4-card { padding:25px 20px 22px;border-radius:23px; }
  .atreya-auth-r4-card h2 { font-size:39px; }
  .atreya-auth-r4-visual { height:510px;border-radius:24px; }
}
