/* baba.gemmerkop.co.za — safari-baby theme, mobile-first, light/dark toggle */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --line: #6f5b47; --ink: #4b4033; --muted: #8c7f6d;
  --cream: #f7f1e4; --card: #fffdf7; --hairline: #ecdfc6;
  --sage: #8fa98c; --sage-soft: #d7e3d3;
  --terra: #c6835f;
  --grad-1: #dcecec; --grad-2: #eae3d2; --grad-3: #ecdcc0;
  /* animal line-art palette */
  --animal-line: #6f5b47;
  --f-sage: #d7e3d3; --f-sand: #f4e7cd; --f-blush: #eabfa8; --f-face: #fffdf7;
  /* per-animal line colours */
  --c-giraffe: #cf9b53; --c-lion: #cf9636; --c-elephant: #7f93a3;
  --c-zebra: #5f5a51; --c-rhino: #7f9668;
  --c-hippo: #8f8aa0; --c-monkey: #a9794f; --c-crocodile: #6f9e6a;
  --c-cheetah: #d0a24e; --c-warthog: #9c8574; --c-flamingo: #d98aa0; --c-ostrich: #8c8375;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --line: #ead9bd; --ink: #ece3d3; --muted: #b6a892;
  --cream: #1e1a14; --card: #2a231b; --hairline: #3c3226;
  --sage: #9db99a; --sage-soft: #384436;
  --terra: #e0a07a;
  --grad-1: #26302f; --grad-2: #2a251c; --grad-3: #2c2419;
  --animal-line: #ecdcbf;
  --f-sage: #384636; --f-sand: #4a3b28; --f-blush: #6f4e40; --f-face: #201a13;
  --c-giraffe: #e3b878; --c-lion: #e8c06d; --c-elephant: #a9bccb;
  --c-zebra: #d0c8bb; --c-rhino: #aac08d;
  --c-hippo: #b3a7c2; --c-monkey: #cfa07a; --c-crocodile: #9ec89a;
  --c-cheetah: #e6c07a; --c-warthog: #c3ab98; --c-flamingo: #edaabf; --c-ostrich: #c0b3a3;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--cream);
  min-height: 100vh; min-height: 100dvh; -webkit-font-smoothing: antialiased;
  overflow-x: hidden; transition: background-color .25s ease, color .25s ease;
}
img, svg { max-width: 100%; height: auto; }

/* ---- Animals ----------------------------------------------------------- */
.animal { display: block; width: 46px; height: 46px; color: var(--animal-line); }
.animal.a-giraffe { color: var(--c-giraffe); }
.animal.a-lion { color: var(--c-lion); }
.animal.a-elephant { color: var(--c-elephant); }
.animal.a-zebra { color: var(--c-zebra); }
.animal.a-rhino { color: var(--c-rhino); }
.animal.a-hippo { color: var(--c-hippo); }
.animal.a-monkey { color: var(--c-monkey); }
.animal.a-crocodile { color: var(--c-crocodile); }
.animal.a-cheetah { color: var(--c-cheetah); }
.animal.a-warthog { color: var(--c-warthog); }
.animal.a-flamingo { color: var(--c-flamingo); }
.animal.a-ostrich { color: var(--c-ostrich); }

.collage { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-bottom: 1.3rem; }
.token {
  width: 66px; height: 66px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--hairline);
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(111,91,71,0.10);
}
.token .animal { width: 44px; height: 44px; }
.token.big { width: 78px; height: 78px; }
.token.big .animal { width: 54px; height: 54px; }
/* compact single-row collage (e.g. 5 animals) */
.collage.compact { gap: 0.4rem; flex-wrap: nowrap; }
.collage.compact .token { width: 54px; height: 54px; box-shadow: 0 3px 9px rgba(111,91,71,0.10); }
.collage.compact .token .animal { width: 36px; height: 36px; }

/* doodle collage — frameless full-body animals in a row */
.collage.doodle { gap: 0.3rem; flex-wrap: nowrap; align-items: flex-end; }
.collage.doodle .token { background: none; border: none; box-shadow: none; width: auto; height: auto; }
.collage.doodle .animal { width: 56px; height: 56px; }
.collage.doodle.lg .animal { width: 74px; height: 74px; }
/* hero doodle scene — wraps to 2 rows on narrow screens */
.collage.doodle.hero { flex-wrap: wrap; gap: 0.5rem 0.7rem; margin-bottom: 1.5rem; }
.collage.doodle.hero .animal { width: 62px; height: 62px; }
@media (min-width: 480px) { .collage.doodle.hero .animal { width: 74px; height: 74px; } }

/* ---- Theme toggle ------------------------------------------------------ */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--hairline); background: var(--card);
  color: var(--line); display: inline-grid; place-items: center;
  cursor: pointer; flex: 0 0 auto; -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, border-color .2s;
}
.theme-toggle:hover { background: var(--sage-soft); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: block; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.toggle-float { position: absolute; top: max(1rem, env(safe-area-inset-top)); right: 1rem; z-index: 3; }

/* ---- Centered auth screens (login) ------------------------------------- */
.auth-wrap {
  position: relative; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: max(1.2rem, env(safe-area-inset-top)) 1.1rem max(1.2rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--grad-1) 0%, var(--grad-2) 55%, var(--grad-3) 100%);
}

/* ---- Login background doodles ------------------------------------------ */
.bg-decor { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg-animal { position: absolute; opacity: 0.20; }
.bg-animal .animal { width: 100%; height: auto; }
@media (min-width: 480px) { .bg-animal { opacity: 0.16; } }

/* ---- Cards ------------------------------------------------------------- */
.card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 20px;
  padding: 2rem 1.5rem; box-shadow: 0 18px 44px rgba(111,91,71,0.18);
}
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand h1 { font-size: 1.4rem; color: var(--line); }
.brand p { font-size: 0.95rem; color: var(--muted); margin-top: 0.25rem; }

/* ---- Form fields ------------------------------------------------------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--line); margin-bottom: 0.4rem; }
.input {
  width: 100%; font-size: 16px; padding: 0.8rem 0.9rem; min-height: 48px;
  border: 1.5px solid var(--hairline); border-radius: 12px;
  background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px rgba(143,169,140,0.25); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.3rem; font-size: 0.9rem; }
.remember { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); }
.remember input { width: 18px; height: 18px; accent-color: var(--sage); }
.row a { color: var(--terra); text-decoration: none; font-weight: 600; }
.row a:hover { text-decoration: underline; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: block; width: 100%; min-height: 50px; padding: 0.85rem 1rem;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, #93ab86, #7c9a73);
  color: #fffef9; font-size: 1.05rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  box-shadow: 0 6px 16px rgba(124,154,115,0.32);
}
.btn:hover { opacity: 0.93; }
.btn:active { opacity: 0.85; }

/* ---- Messages ---------------------------------------------------------- */
.error, .msg { padding: 0.75rem 0.9rem; border-radius: 12px; font-size: 0.9rem; text-align: center; margin-bottom: 1.15rem; }
.error, .msg.error { background: rgba(198,131,95,0.14); color: var(--terra); border: 1px solid rgba(198,131,95,0.35); }
.msg.ok { background: rgba(143,169,140,0.18); color: var(--sage); border: 1px solid rgba(143,169,140,0.4); }
.hint { display: none; margin-top: 1rem; font-size: 0.88rem; color: var(--muted); text-align: center; }

/* ---- App shell (pages after login) ------------------------------------ */
.app-header {
  position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--hairline);
  padding: 0.6rem 1rem; padding-top: max(0.6rem, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.app-header .logo { width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto; background: var(--sage-soft); display: grid; place-items: center; }
.app-header .logo .animal { width: 34px; height: 34px; }
.app-nav { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
.app-nav .greet { color: var(--muted); font-size: 0.9rem; margin-right: 0.2rem; }
.app-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0.4rem 0.65rem; border-radius: 10px; color: var(--line); text-decoration: none; font-weight: 600; font-size: 0.9rem; -webkit-tap-highlight-color: transparent; }
.app-nav a:hover { background: var(--sage-soft); }

.container { max-width: 720px; margin: 0 auto; padding: 2rem 1.1rem 3rem; }
.panel { background: var(--card); border: 1px solid var(--hairline); border-radius: 20px; padding: 1.75rem 1.4rem; box-shadow: 0 10px 34px rgba(111,91,71,0.12); }
.panel.center { text-align: center; }
.panel h1 { font-size: 1.5rem; margin-bottom: 0.6rem; color: var(--line); }
.panel p { color: var(--muted); }

@media (min-width: 480px) {
  .card { padding: 2.5rem 2rem; }
  .app-header { padding-left: 1.5rem; padding-right: 1.5rem; }
  .container { padding: 3rem 1.5rem; }
  .panel { padding: 2.5rem 2rem; }
}
