/* ============================================================
   Slokas — the sign-in page. Its own file: no app.js, no state.
   Same family as the app (styles.css): warm ground, one white
   card, one soft shadow, indigo accent, Fraunces for the title.
   Phone first; the card is centred and never wider than 420px.
   ============================================================ */

:root {
  --bg:        #FAF7F2;
  --card:      #FFFFFF;
  --ink:       #2B2622;
  --ink-2:     #7A7166;
  --ink-3:     #A79E92;
  --line:      #E8E1D7;
  --danger:    #B4452F;

  --brand:      #3B4A8C;
  --brand-tint: rgba(59, 74, 140, .12);
  --brand-soft: rgba(59, 74, 140, .28);

  --r:    12px;
  --r-sm: 9px;

  --shadow: 0 1px 2px rgba(43, 38, 34, .04), 0 8px 24px rgba(43, 38, 34, .06);

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --verse: "Gentium Book Plus", "Gentium Plus", "Noto Serif", "Charis SIL", Georgia, serif;
  --deva: "Noto Serif Devanagari", "Noto Sans Devanagari", "Nirmala UI", "Devanagari Sangam MN", "Mangal", "Gentium Book Plus", Georgia, serif;

  --ease: cubic-bezier(.32, .72, .35, 1);
  --dur: 170ms;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  /* a breath of warmth behind the card, never a gradient you can name */
  background-image: radial-gradient(120% 70% at 50% 0%, rgba(59, 74, 140, .05) 0%, rgba(59, 74, 140, 0) 60%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--brand-soft);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

/* ---------- the page ---------- */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 30px 26px 24px;
  text-align: center;
}

/* ---------- mark, title, tagline ---------- */
/* the app icon, clipped to its disc so the icon's warm square never shows
   against the white card — the indigo disc fills 71.9% of the png */
.mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  overflow: hidden;
}
.mark img {
  display: block;
  width: 100px;
  height: 100px;
  margin: -14px;
  clip-path: circle(35.9% at 50% 50%);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.tagline {
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
}

/* ---------- the ornament verse ---------- */
.ornament {
  margin: 22px 0 24px;
  padding: 16px 6px 0;
  border-top: 1px solid var(--line);
}
.ornament .deva {
  margin: 0;
  font-family: var(--deva);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
}
.ornament .roman {
  margin: 5px 0 0;
  font-family: var(--verse);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-2);
}
.ornament-ref {
  margin: 8px 0 0;
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- the form ---------- */
.form { text-align: left; }

.field + .field { margin-top: 14px; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  font-size: 16px;          /* 16px keeps iOS from zooming the page */
  line-height: 46px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:hover { border-color: #DDD4C6; }
.input:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

/* password + the eye that shows it */
.pw { position: relative; }
.pw .input { padding-right: 46px; }

.eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.eye:hover { color: var(--ink-2); background: rgba(43, 38, 34, .04); }
.eye.is-on { color: var(--brand); }
.eye .eye-shut { display: none; }
.eye.is-on .eye-open { display: none; }
.eye.is-on .eye-shut { display: block; }

/* keep me signed in */
.remember {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 0;
  min-height: 24px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.remember input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

/* The error slot is always here, so a wrong password never shifts the
   button down the page — only the line inside it appears. */
.err-slot {
  min-height: 42px;
  padding-top: 10px;
}
.err {
  margin: 0;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: rgba(180, 69, 47, .08);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.35;
}

.submit {
  width: 100%;
  height: 48px;
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #F7F6FB;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.submit:hover { background: #33407A; border-color: #33407A; }
.submit:active { transform: translateY(1px); }
.submit[disabled] { opacity: .62; cursor: default; transform: none; }

.form.is-busy .input, .form.is-busy .remember { opacity: .7; pointer-events: none; }

/* ---------- the story of these slokas ----------
   Word for word the same text as the "About these slokas" sheet in the app.
   The first line always shows; on a phone the rest waits behind "Read more"
   so the form is still within reach on a 390x844 screen. */
.story {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.story p {
  margin: 0;
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink-2);
}
.story-lead {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.story-rest p { margin-top: 9px; }
.story.is-collapsed .story-rest { display: none; }

.story-toggle {
  display: none;
  margin-top: 8px;
  padding: 2px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--brand-soft);
}
.story-toggle:hover { text-decoration-color: var(--brand); }
@media (max-width: 560px) {
  .story-toggle { display: inline-block; }
}

/* the sign-up form is four fields long: on a phone the decorative verse steps
   aside for it, so the fields and the button are within reach */
@media (max-width: 560px) {
  body.is-signup .ornament { display: none; }
  body.is-signup .story { margin-bottom: 0; }
}

/* ---------- Sign in / Create an account ---------- */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 20px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.seg-btn {
  height: 36px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--card);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(43, 38, 34, .06);
}

/* the small grey line under a field that needs one word of explaining */
.hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* the honeypot: a person never sees it, a robot fills it in */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ---------- footer ---------- */
.foot {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ---------- desktop: the story stands beside the form ----------
   The two wrappers are invisible on a phone (the card is one column, exactly
   as before); from 860px the card widens and they become its two columns, so
   the whole story is readable without pushing the form off the screen. */
@media (min-width: 860px) {
  .card {
    max-width: 820px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 38px;
    align-items: start;
    padding: 34px 32px 26px;
  }
  .card-do { padding-top: 4px; }
  .card-do .seg { margin-top: 0; }
  .story { margin-top: 22px; }
  .ornament { margin-bottom: 0; }
  .foot { margin-top: 24px; }
}

/* ---------- phone ---------- */
@media (max-width: 420px) {
  .page { padding: 22px 14px calc(22px + env(safe-area-inset-bottom)); }
  .card { padding: 26px 20px 20px; border-radius: var(--r); }
  .title { font-size: 29px; }
  .ornament { margin: 20px 0 22px; }
  .ornament .deva { font-size: 16px; }
  .ornament .roman { font-size: 13.5px; }
  .story { margin-top: 18px; padding-top: 14px; }
  .seg { margin: 18px 0 16px; }
}

@media (hover: none) and (pointer: coarse) {
  .eye { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
