/* ===== Zeno design tokens (taken from the logo) ===== */
:root {
  --navy: #0b2140;
  --navy-soft: #16345f;
  --green: #0f6b3e;
  --green-mid: #2f8f5b;
  --mint: #6fcf97;
  --gold: #c9a93f;
  --sage: #bcd3c4;
  --cream: #faf8f3;
  --white: #ffffff;
  --ink-muted: #5b6b7f;
  --line: #d3dbd6;
  --danger: #b3261e;

  --font-display: "Bodoni Moda", "Didot", "Bodoni 72", "Times New Roman", serif;
  --font-body: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --mark: var(--navy); /* colour of the Z strokes; overridden on dark backgrounds */
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== Page layout: stacked on phones, split on larger screens ===== */
.main_wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

/* ===== Brand panel ===== */
.zenoTitle {
  --mark: var(--cream);
  background: var(--navy);
  color: var(--cream);
  padding: max(1.25rem, env(safe-area-inset-top)) 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.75rem);
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
}

.brand_mark {
  width: clamp(64px, 18vw, 96px);
  height: auto;
  flex-shrink: 0;
  overflow: visible;
}

.mark_z { stroke: var(--mark); }
.mark_arc { stroke: var(--sage); opacity: 0.55; }

.wordmark {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.wordmark_name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 9vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0.06em;
}

.wordmark_sub {
  font-weight: 600;
  font-size: clamp(0.7rem, 2.4vw, 0.85rem);
  letter-spacing: 0.7em;
  color: var(--mint);
}

.wordmark_rule {
  height: 3px;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green-mid), var(--mint));
}

.brand_note {
  display: none;
  margin: 0;
}

/* ===== Login side ===== */
.loginWrapper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1.75rem, 6vw, 3rem) 1.5rem max(2rem, env(safe-area-inset-bottom));
}

.loginform {
  width: 100%;
  max-width: 26rem;
}

.loginhead {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  color: var(--navy);
}

.loginsub {
  margin: 0 0 2rem;
  color: var(--ink-muted);
  max-width: 34ch;
}

.inputbox {
  display: grid;
  gap: 1.25rem;
}

.field { display: grid; gap: 0.4rem; }

.field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--navy);
}

.field input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 1rem; /* 16px minimum stops iOS zooming on focus */
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:hover { border-color: #aebcb4; }

.field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 107, 62, 0.16);
}

.field_pass { position: relative; }
.field_pass input { padding-right: 3.25rem; }

.toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--green);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.toggle:hover { background: rgba(15, 107, 62, 0.08); }

/* ===== Error message ===== */
.error { min-height: 1.5rem; margin-top: 0.75rem; }

.msg_error {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--danger);
}

/* ===== Button ===== */
.loginbtn {
  width: 100%;
  height: 3.25rem;
  margin-top: 0.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream);
  background: var(--navy);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.setUp_accBox {
  display: block;
  margin-top: 1.25rem;
  text-align: center;
  font-weight: 600;
  color: var(--green);
  text-underline-offset: 3px;
}
.setUp_accBox:hover { color: var(--navy); }
.setUp_accBox:focus-visible { outline: 3px solid var(--green-mid); outline-offset: 3px; border-radius: 4px; }

.loginbtn:hover { background: var(--navy-soft); }
.loginbtn:active { transform: translateY(1px); }
.loginbtn:disabled { opacity: 0.45; cursor: not-allowed; }
.loginbtn[aria-busy="true"] { opacity: 1; cursor: progress; }

.loginbtn:focus-visible,
.toggle:focus-visible {
  outline: 3px solid var(--green-mid);
  outline-offset: 3px;
}

.securenote {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.securenote svg { flex-shrink: 0; margin-top: 0.15rem; color: var(--green); }

/* ===== Tablets and up: side-by-side ===== */
@media (min-width: 900px) {
  .main_wrapper {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: 1fr;
  }

  .zenoTitle {
    padding: clamp(2.5rem, 5vw, 5rem);
    gap: 2.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
  }

  .brand { flex-direction: column; align-items: flex-start; max-width: 26rem; margin-inline: 0; gap: 2rem; }
  .brand_mark { width: clamp(120px, 14vw, 190px); }
  .wordmark { width: 100%; }
  .wordmark_name { font-size: clamp(3.2rem, 5.5vw, 5rem); }
  .wordmark_sub { font-size: 0.95rem; }

  .brand_note {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    color: var(--sage);
    max-width: 26rem;
  }

  .loginWrapper { align-items: center; padding: 3rem clamp(2rem, 6vw, 6rem); }
}

/* Short landscape phones: keep the brand panel compact */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 899px) {
  .zenoTitle { padding-block: 0.75rem; }
  .brand_mark { width: 52px; }
  .wordmark_name { font-size: 1.8rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .zenoTitle, .loginWrapper { padding-inline: 1rem; }
  .wordmark_sub { letter-spacing: 0.5em; }
}

/* One entrance moment: the leaf grows in. Nothing else animates on load. */
@media (prefers-reduced-motion: no-preference) {
  .mark_leaf {
    transform-box: fill-box;
    transform-origin: 0% 100%;
    animation: leaf-grow 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both;
  }
}

@keyframes leaf-grow {
  from { transform: scale(0.2) rotate(-12deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}




/* ===== Views (login / loading / otp / done) ===== */
.hidden { display: none !important; }

.view { width: 100%; max-width: 26rem; }

.view--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 18rem;
  text-align: center;
}

.view--center .loginsub { margin: 0; }

.loadingText { margin: 0; color: var(--ink-muted); }

.doneIcon { color: var(--green); }

/* ===== Loaders: one spinner, two sizes ===== */
.loadfun {
  --size: 1.5rem;
  --track: var(--sage);
  --spin: var(--green);
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  border: 3px solid var(--track);
  border-top-color: var(--spin);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loadfun--btn { --size: 1.3rem; --track: rgba(250, 248, 243, 0.3); --spin: var(--cream); }
.loadfun--lg  { --size: 3rem; border-width: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .loadfun { animation-duration: 2s; }
}

/* ===== Buttons: label and spinner share one centred row ===== */
.loginbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

/* ===== OTP ===== */
.otpEmail { font-weight: 600; word-break: break-all; }

.codebox {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(0.35rem, 2vw, 0.75rem);
}

.codeInput {
  width: 100%;
  height: clamp(3.1rem, 15vw, 3.75rem);
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--navy);
  caret-color: var(--green);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.codeInput:hover { border-color: #aebcb4; }

.codeInput.filled { border-color: var(--navy); }

.codeInput:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 107, 62, 0.16);
}

.codebox.is-error .codeInput { border-color: var(--danger); }
.codebox.is-error .codeInput:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.16); }

@media (prefers-reduced-motion: no-preference) {
  .codebox.shake { animation: shake 0.4s ease; }
}

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.otpStatus {
  min-height: 1.25rem;
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--green);
}

.resend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.linkbtn {
  min-height: 2.5rem;
  padding: 0 0.5rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.linkbtn:hover:not(:disabled) { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:disabled { color: var(--ink-muted); cursor: default; }
.linkbtn:focus-visible { outline: 3px solid var(--green-mid); outline-offset: 2px; }
.linkbtn--center { display: block; margin: 0.25rem auto 0; }

@media (max-width: 360px) {
  .codeInput { font-size: 1.25rem; }
}


/* ===== Shared animation: things rise gently into place ===== */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ===== Welcome screen (after login, before the dashboard) ===== */
.welcome {
  --mark: var(--cream);
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  color: var(--cream);
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(47, 143, 91, 0.35), transparent 60%),
    var(--navy);
}

.welcome_inner { display: grid; justify-items: center; gap: 0.6rem; }

.welcome_mark { width: clamp(96px, 26vw, 140px); height: auto; margin-bottom: 0.9rem; overflow: visible; }

.welcome_hello { margin: 0; font-size: 0.95rem; letter-spacing: 0.04em; color: var(--sage); }

.welcome_name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4.5rem);
  line-height: 1.05;
  text-transform: capitalize;
  word-break: break-word;
}

.welcome_note { margin: 0.9rem 0 0; font-size: 0.95rem; color: var(--sage); }

.welcome_bar {
  width: min(14rem, 60vw);
  height: 3px;
  margin-top: 0.4rem;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(250, 248, 243, 0.15);
}

.welcome_bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-mid), var(--mint));
}

/* The moving parts. Skipped for people who ask their device for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .welcome { animation: fade-in 0.45s ease backwards; }

  .welcome_hello { animation: rise 0.7s ease 0.9s backwards; }
  .welcome_name  { animation: rise 0.7s ease 1.05s backwards; }
  .welcome_note  { animation: rise 0.7s ease 1.3s backwards; }

  .welcome_bar span {
    transform-origin: left;
    animation: bar-fill var(--welcome-ms, 2400ms) cubic-bezier(0.4, 0, 0.2, 1) both;
  }

  /* the Z draws itself, then the leaf grows */
  .welcome_stroke { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.7s ease 0.15s forwards; }
  .welcome_stroke--2 { animation-delay: 0.7s; }
  .welcome .mark_leaf { animation-delay: 1.3s; }
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes bar-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }


/* ===== Private pages: a navy curtain that lifts once the login check passes (see session.js) ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--navy);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

body.boot::before { opacity: 1; transition: none; } /* covered the moment the page opens */
body.boot > * { visibility: hidden; }

/* ===== Login screens (login / loading / code) fade in gently when they swap ===== */
@media (prefers-reduced-motion: no-preference) {
  .view:not(.hidden) { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
}
