/* KinCare web — shared neumorphic base.
   Mirrors the app design language (docs/kincaredesignva.md): soft raised/inset surfaces on one
   base colour, paired shadows, status-only colour, big targets. Loaded by every page BEFORE the
   page stylesheet (home.css / legal.css / delete.css).

   Depth = affordance:  raised = tappable · inset = field/track/finished · flat = info only.
   Shadows are always a dark+light pair painted on the SAME colour as the page (--bg). */

:root {
  color-scheme: light;

  /* Tokens (light) */
  --bg: #edf1f4;
  --in: #e6ebef;
  --sd: #cdd5de;
  --sl: #ffffff;
  --ed: #e1e7ec;
  --ink: #15212e;
  --mut: #5e6b78;
  --pri: #15803d;
  --onp: #ffffff;
  --prt: #15803d;
  --gt: #dcf3e4;
  --lb: #fdf1de;  --lbd: #f8d9a8;  --li: #8a4a00;   /* late / amber */
  --sb: #fce8e8;  --sbd: #f5c4c4;  --si: #a82020;   /* skip / delete / red */
  --wm: #ffe7cf;  --wmi: #9a3412;                   /* family warm */
  --yb: #fff6d6;  --yi: #7a5a00;                    /* afternoon */
  --ib: #e6e9fb;  --ii: #3b3f9e;                    /* night (indigo, never violet) */
  --nb: #15212e;  --ni: #ffffff;                    /* active pill */
  --glow: 1;                                        /* showcase glow-circle opacity */

  /* Elevation (always a pair) */
  --raised-s: 4px 4px 10px var(--sd), -4px -4px 10px var(--sl);
  --raised-m: 6px 6px 14px var(--sd), -6px -6px 14px var(--sl);
  --raised-l: 8px 8px 18px var(--sd), -8px -8px 18px var(--sl);
  --inset: inset 3px 3px 8px var(--sd), inset -3px -3px 8px var(--sl);

  /* Shape */
  --r-tile: 14px;
  --r-btn: 18px;
  --r-card: 24px;
  --r-show: 28px;
  --r-sheet: 32px;

  /* Layout + motion */
  --wrap: min(1160px, calc(100% - 40px));
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --press: 150ms;

  --font: "Plus Jakarta Sans", "Hind Siliguri", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Aliases kept so older page rules keep working */
  --surface: var(--bg);
  --text: var(--ink);
  --text-2: var(--mut);
  --line: var(--ed);
  --brand: var(--pri);
  --brand-ink: var(--prt);
  --brand-soft: var(--gt);
  --radius: var(--r-card);
}

/* Dark is opt-in: theme.js sets data-theme="dark" from the toggle (light is the default, whatever the OS says) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1b232c;
    --in: #171e26;
    --sd: #10151b;
    --sl: #27323e;
    --ed: #2c3845;
    --ink: #e8edf2;
    --mut: #9aa7b4;
    --pri: #22c55e;
    --onp: #052e16;
    --prt: #4ade80;
    --gt: #16301f;
    --lb: #33270f;  --lbd: #5c4216;  --li: #fbbf6a;
    --sb: #361a1d;  --sbd: #5c2226;  --si: #fca5a5;
    --wm: #3a2a1a;  --wmi: #ffb36b;
    --yb: #332c10;  --yi: #f5d66b;
    --ib: #1f2340;  --ii: #a5b0ff;
    --nb: #e8edf2;  --ni: #10161d;
    --glow: 0.18;
}

* { box-sizing: border-box; }

html {
  font: 100%/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.0625rem; /* 17px body, never smaller than 13px anywhere */
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

main { overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }

h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

a { color: var(--prt); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 3px solid var(--prt);
  outline-offset: 3px;
  border-radius: 10px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-btn);
  background: var(--nb);
  color: var(--ni);
}
.skip:focus { top: 12px; }

/* Overline label */
.eyebrow {
  margin-bottom: 12px;
  color: var(--prt);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Surface utilities (use these, don't re-roll shadows) ---------- */
.neu-raised-s { background: var(--bg); border: 1px solid var(--ed); box-shadow: var(--raised-s); }
.neu-raised-m { background: var(--bg); border: 1px solid var(--ed); box-shadow: var(--raised-m); }
.neu-raised-l { background: var(--bg); border: 1px solid var(--ed); box-shadow: var(--raised-l); }
.neu-inset    { background: var(--in); box-shadow: var(--inset); }
.neu-flat     { background: var(--bg); }

/* Raised tappable that sinks to inset on press (~150ms, held even on a quick tap via JS .is-pressed) */
.neu-press {
  transition: box-shadow var(--press) ease, background-color var(--press) ease, transform var(--press) ease;
  touch-action: manipulation;
}
.neu-press:active,
.neu-press.is-pressed { box-shadow: var(--inset); background: var(--in); }

/* ---------- Buttons (≥48px, primary CTA 56px) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--ed);
  border-radius: var(--r-btn);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 5px 5px 12px var(--sd), -5px -5px 12px var(--sl);
  cursor: pointer;
  transition: box-shadow var(--press) ease, background-color var(--press) ease;
  touch-action: manipulation;
}
.btn:hover { text-decoration: none; }
.btn:active, .btn.is-pressed { box-shadow: var(--inset); background: var(--in); }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1.0625rem; }
.btn-primary { background: var(--pri); border-color: var(--pri); color: var(--onp); }
.btn-primary:active, .btn-primary.is-pressed {
  background: var(--pri);
  box-shadow: inset 3px 3px 8px rgba(0, 0, 0, 0.28), inset -2px -2px 6px rgba(255, 255, 255, 0.14);
}
.btn-danger { background: var(--sb); border-color: var(--sbd); color: var(--si); }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: var(--inset); }

/* ---------- Top bar: raised floating pill ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 0 0;
  background: linear-gradient(var(--bg) 70%, transparent);
}

.bar-inner {
  width: var(--wrap);
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 10px 8px 18px;
  display: flex;
  flex-wrap: wrap; /* at large text sizes the links drop to a second row instead of overflowing */
  align-items: center;
  gap: 4px 20px;
  border: 1px solid var(--ed);
  border-radius: var(--r-show);
  background: var(--bg);
  box-shadow: var(--raised-m);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.1875rem;
  letter-spacing: -0.03em;
}
.brand:hover { text-decoration: none; }
.brand img { border-radius: 10px; }

.bar-links { display: flex; gap: 6px; margin-left: auto; }
.bar-links a {
  display: inline-flex;
  gap: 0.3em; /* keeps the space before the hidden-on-mobile ".long" span */
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--mut);
  font-size: 0.9375rem;
  font-weight: 700;
  transition: box-shadow var(--press) ease, color var(--press) ease;
}
.bar-links a:hover { color: var(--ink); text-decoration: none; }
.bar-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--in);
  box-shadow: var(--inset);
}

/* "Get the app" = the one main action in the bar */
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--pri);
  color: var(--onp);
  font-size: 0.9375rem;
  font-weight: 800;
  box-shadow: 4px 4px 10px var(--sd), -4px -4px 10px var(--sl);
  transition: box-shadow var(--press) ease;
  touch-action: manipulation;
}
.pill:hover { text-decoration: none; }
.pill:active { box-shadow: inset 3px 3px 8px rgba(0, 0, 0, 0.28), inset -2px -2px 6px rgba(255, 255, 255, 0.14); }

/* ---------- Theme toggle (injected by theme.js; raised round button, sinks on press) ---------- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--ed);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--raised-s);
  cursor: pointer;
  transition: box-shadow var(--press) ease, background-color var(--press) ease;
  touch-action: manipulation;
}
.theme-toggle:active { box-shadow: var(--inset); background: var(--in); }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.bar-links + .theme-toggle { margin-left: -8px; }

/* ---------- Footer ---------- */
.foot { padding: 40px 0 48px; }
.foot-inner {
  width: var(--wrap);
  margin: 0 auto;
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  border-radius: var(--r-card);
  background: var(--in);
  box-shadow: var(--inset);
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--mut);
  font-size: 0.9375rem;
  font-weight: 700;
}
.foot-brand img { border-radius: 7px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 8px; }
.foot-links a {
  display: inline-flex;
  gap: 0.3em;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--mut);
  font-size: 0.9375rem;
  font-weight: 700;
}
.foot-links a:hover,
.foot-links a[aria-current="page"] { color: var(--ink); }
.foot-note {
  width: var(--wrap);
  margin: 18px auto 0;
  padding: 0 8px;
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---------- Scroll reveal: fade up 18px, ease-out (JS adds .is-in; visible without JS) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 400ms var(--ease), transform 400ms var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive chrome ---------- */
@media (max-width: 480px) {
  .bar-links { display: none; } /* Privacy / Terms stay reachable from the footer; keeps logo + theme + CTA on one row */
  .pill { margin-left: 0; }
  .theme-toggle { margin-left: auto !important; }
}

@media (max-width: 600px) {
  .bar-inner { gap: 8px; padding-left: 14px; }
  .brand span { display: none; }
  .bar-links { gap: 2px; }
  .bar-links a { padding: 0 12px; }
  .bar-links .wide, .bar-links .long { display: none; }
  .pill { padding: 0 16px; }
}

/* ---------- Reduced motion: no animation at all, including press ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
