/* ═══════════════════════════════════════════════════════════════
   Tomasetti portal-gate login — Dragonfly Inn restyle (2026-08-02)
   theme-mrs (Mrs/Family + Bookshelf) now matches bookshelf.css:
   butter/chestnut/sage/cranberry palette, Playfair + Cormorant,
   warm candlelight gradients, dragonfly watermark.
   dash / star / edge / nova keep their stock accents.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --ink: #12151c;
  --muted: rgba(18, 21, 28, 0.68);
  --paper: #f4f6fb;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(18, 21, 28, 0.12);
  --brand: #1d4ed8;
  --brand-hot: #2563eb;
  --brand-deep: #1e3a8a;
  --glow-a: rgba(37, 99, 235, 0.28);
  --glow-b: rgba(14, 165, 233, 0.22);
  --danger: #b91c1c;
  --danger-bg: #fde8e8;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

body.theme-star {
  --brand: #0f766e;
  --brand-hot: #0d9488;
  --brand-deep: #115e59;
  --glow-a: rgba(13, 148, 136, 0.30);
  --glow-b: rgba(245, 158, 11, 0.18);
}

body.theme-edge {
  --brand: #0e7490;
  --brand-hot: #0891b2;
  --brand-deep: #155e75;
  --glow-a: rgba(8, 145, 178, 0.28);
  --glow-b: rgba(45, 212, 191, 0.18);
}

/* ── Dragonfly Inn (Mrs / Family + Bookshelf) ── */
body.theme-mrs {
  --ink: #2c241e;
  --muted: rgba(44, 36, 30, 0.68);
  --paper: #f7efdf;
  --panel: rgba(255, 252, 245, 0.86);
  --line: rgba(74, 59, 50, 0.14);
  --brand: #4a3b32;        /* chestnut */
  --brand-hot: #6b5a4f;    /* chestnut-soft */
  --brand-deep: #8c3b43;   /* cranberry */
  --glow-a: rgba(233, 196, 150, 0.30);
  --glow-b: rgba(106, 123, 97, 0.18);
  --gold: #c9a95c;
  --gold-light: #e0c88a;
  --sage-soft: #8a9e82;
  --danger: #b3442f;
  --danger-bg: #fbe9e2;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
}

body.theme-nova {
  --brand: #0284c7;
  --brand-hot: #0ea5e9;
  --brand-deep: #0369a1;
  --glow-a: rgba(56, 189, 248, 0.30);
  --glow-b: rgba(251, 146, 60, 0.18);
}

/* ── Pat (light purple — she likes light purple) ── */
body.theme-pat {
  --ink: #332b4a;
  --muted: rgba(51, 43, 74, 0.68);
  --paper: #f3eefb;
  --panel: rgba(255, 253, 255, 0.86);
  --line: rgba(96, 74, 150, 0.16);
  --brand: #7c6ac4;        /* lilac */
  --brand-hot: #9a87d6;    /* lilac-soft */
  --brand-deep: #5d47a8;   /* deep violet */
  --glow-a: rgba(181, 158, 240, 0.34);
  --glow-b: rgba(214, 188, 246, 0.24);
  --gold: #b9a0e8;
  --gold-light: #d4c2f2;
  --sage-soft: #8a7fae;
  --danger: #a1446b;
  --danger-bg: #fbe9f1;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh; /* mobile URL-bar correctness; vh is the fallback */
  font-family: var(--font-body);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #e8eef8 0%, #d9e2f1 48%, #c9d5e8 100%);
}

body.theme-star {
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #e6f3f1 0%, #d5e8e4 48%, #c5ddd8 100%);
}

body.theme-edge {
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #e6f4f7 0%, #d5e8ef 48%, #c4dde6 100%);
}

/* ── Inn: warm candlelight parchment ── */
body.theme-mrs {
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #f7efdf 0%, #eadbc4 48%, #dfcbaa 100%);
}

/* ── Pat: light lavender sky ── */
body.theme-pat {
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #f3eefb 0%, #e6ddf4 48%, #d9ccf0 100%);
}

/* dragonfly watermark (same pattern as bookshelf.css) */
body.theme-mrs::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 100 100'%3E%3Cpath d='M50 15c-8 0-15 4-20 10 3-1 7-2 10-2 8 0 15 4 20 10 5-6 12-10 20-10 3 0 7 1 10 2-5-6-12-10-20-10-3 0-7 1-10 2-3-1-7-2-10-2zM20 32c-5 3-9 8-11 14 2-1 5-2 8-2 6 0 12 3 16 8 4-5 10-8 16-8 3 0 6 1 8 2-2-6-6-11-11-14-4 2-9 3-14 3-5 0-10-1-14-3zM15 55c-3 4-5 9-5 14 0 2 0 4 1 6 2-3 5-5 8-5 5 0 9 2 13 6 3-4 8-6 13-6 3 0 6 1 8 3-2-5-5-10-9-13-4 2-8 3-13 3-5 0-10-1-14-3zM32 78c-2 3-3 7-3 11 0 2 0 3 1 5 2-3 4-5 7-5 4 0 8 2 11 5 3-3 7-5 11-5 3 0 5 2 7 5 1-2 1-3 1-5 0-4-1-8-3-11-3-2 2-7 3-11 3-4 0-8-1-11-3z' fill='%234A3B32' opacity='0.045'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: dragonflyFloat 90s linear infinite;
}

/* Pat: same dragonfly, tinted light violet */
body.theme-pat::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 100 100'%3E%3Cpath d='M50 15c-8 0-15 4-20 10 3-1 7-2 10-2 8 0 15 4 20 10 5-6 12-10 20-10 3 0 7 1 10 2-5-6-12-10-20-10-3 0-7 1-10 2-3-1-7-2-10-2zM20 32c-5 3-9 8-11 14 2-1 5-2 8-2 6 0 12 3 16 8 4-5 10-8 16-8 3 0 6 1 8 2-2-6-6-11-11-14-4 2-9 3-14 3-5 0-10-1-14-3zM15 55c-3 4-5 9-5 14 0 2 0 4 1 6 2-3 5-5 8-5 5 0 9 2 13 6 3-4 8-6 13-6 3 0 6 1 8 3-2-5-5-10-9-13-4 2-8 3-13 3-5 0-10-1-14-3zM32 78c-2 3-3 7-3 11 0 2 0 3 1 5 2-3 4-5 7-5 4 0 8 2 11 5 3-3 7-5 11-5 3 0 5 2 7 5 1-2 1-3 1-5 0-4-1-8-3-11-3-2 2-7 3-11 3-4 0-8-1-11-3z' fill='%235D47A8' opacity='0.05'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: dragonflyFloat 90s linear infinite;
}

body.theme-nova {
  background:
    radial-gradient(ellipse 70% 55% at 12% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(165deg, #e8f4fb 0%, #dcecf6 48%, #cfe3f0 100%);
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 48px 24px, -24px 48px; }
}

@keyframes dragonflyFloat { to { background-position: 160px 80px; } }

.card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 2rem 1.75rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.14);
  animation: rise 0.55s ease both;
}

/* Inn card: warm panel + gold top ribbon */
body.theme-mrs .card,
body.theme-pat .card {
  border: 1px solid rgba(74, 59, 50, 0.18);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(115%);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  box-shadow: 0 16px 48px rgba(74, 59, 50, 0.16);
  overflow: hidden;
}

body.theme-mrs .card::before,
body.theme-pat .card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-deep), var(--gold));
}

.inn-dfly {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 0.7rem;
  color: var(--gold);
  filter: drop-shadow(0 2px 6px rgba(74, 59, 50, 0.25));
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-deep);
}

/* Inn eyebrow: cranberry, small caps, centered under the dragonfly */
body.theme-mrs .eyebrow,
body.theme-pat .eyebrow {
  text-align: center;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
}

h1 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

body.theme-mrs h1,
body.theme-pat h1 {
  text-align: center;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.lede {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

body.theme-mrs .lede,
body.theme-pat .lede {
  text-align: center;
  font-style: italic;
  font-size: 1.08rem;
}

.error {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--danger-bg);
  border-left: 4px solid var(--danger);
  color: var(--danger);
  font-weight: 700;
}

form {
  display: grid;
  gap: 0.95rem;
  margin-top: 1.35rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.92rem;
}

body.theme-mrs label,
body.theme-pat label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--brand);
}

input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Inn inputs: warm cream, serif text, gold focus */
body.theme-mrs input,
body.theme-pat input {
  background: var(--paper);
  border-color: rgba(74, 59, 50, 0.2);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 1.1rem;
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}

body.theme-mrs input:focus,
body.theme-pat input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 92, 0.22);
}

button {
  margin-top: 0.25rem;
  min-height: 3.1rem;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #f8fafc;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

/* Inn button: chestnut with cranberry hover */
body.theme-mrs button,
body.theme-pat button {
  border-radius: 12px;
  background: var(--brand);
  color: var(--paper);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(74, 59, 50, 0.28);
}

button:hover { background: var(--brand-hot); transform: translateY(-1px); }
button:active { transform: translateY(0); }

body.theme-mrs button:hover,
body.theme-pat button:hover { background: var(--brand-deep); }

.hint {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

body.theme-mrs .hint,
body.theme-pat .hint {
  text-align: center;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--sage-soft);
}

/* ── Mobile-first: no iOS/Android default chrome ── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  -webkit-tap-highlight-color: transparent;
}
input, button {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 10px; /* keep explicit for iOS (appearance:none resets radius) */
  touch-action: manipulation; /* kill double-tap zoom / 300ms delay on older mobile */
}
input {
  font-size: 1rem; /* >=16px: prevents iOS auto-zoom on focus */
}
body.theme-mrs input,
body.theme-pat input {
  font-size: 1.05rem;
}

/* iOS/Chrome autofill: keep the themed background instead of default yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 9999s ease-out;
  caret-color: var(--ink);
}
body.theme-mrs input:-webkit-autofill,
body.theme-mrs input:-webkit-autofill:hover,
body.theme-mrs input:-webkit-autofill:focus,
body.theme-pat input:-webkit-autofill,
body.theme-pat input:-webkit-autofill:hover,
body.theme-pat input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  box-shadow: 0 0 0 1000px var(--paper) inset;
}

/* Tactile press feedback (desktop keeps translateY hover) */
button:active {
  transform: translateY(1px) scale(0.98);
}
body.theme-mrs button:active,
body.theme-pat button:active {
  transform: translateY(1px) scale(0.98);
}

/* Focus visible (keep accessible) */
:where(input, button):focus-visible {
  outline: 3px solid var(--brand-deep);
  outline-offset: 2px;
}

/* ── Small screens (phones) ── */
@media (max-width: 480px) {
  body {
    padding: max(1.25rem, env(safe-area-inset-top))
             max(1rem, env(safe-area-inset-right))
             max(1.5rem, env(safe-area-inset-bottom))
             max(1rem, env(safe-area-inset-left));
    place-items: start center; /* keep the card anchored near the top on small screens */
  }
  .card {
    width: min(100%, 400px);
    margin-top: 2vh; /* body padding already accounts for safe-area-inset-top */
    padding: 1.7rem 1.4rem 1.4rem;
    border-radius: 20px;
  }
  body.theme-mrs .card,
  body.theme-pat .card {
    border-radius: 22px;
  }
  .inn-dfly {
    width: 42px;
    height: 42px;
  }
  h1 {
    font-size: clamp(1.6rem, 7vw, 2.1rem);
  }
  label {
    font-size: 0.86rem;
  }
  input {
    min-height: 3.1rem;
    font-size: 1.05rem;
  }
  button {
    min-height: 3.3rem;
    font-size: 1.1rem;
  }
  .eyebrow {
    font-size: 0.7rem;
  }
  /* pause the heavy background pan on phones for battery + smoothness */
  body.theme-mrs::after,
  body.theme-pat::after,
  .sky {
    animation: none;
  }
  body.theme-mrs::after,
  body.theme-pat::after {
    background-size: 120px 120px;
  }
}

@media (max-width: 360px) {
  body { padding-inline: 0.75rem; }
  .card { padding: 1.5rem 1.1rem 1.25rem; }
  .lede { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sky, .card, button { animation: none; transition: none; }
  button:hover, button:active { transform: none; }
  /* theme-mrs button:active has higher specificity; pin it explicitly */
  body.theme-mrs button:active,
  body.theme-pat button:active { transform: none; }
  body.theme-mrs::after,
  body.theme-pat::after { animation: none; }
}
