/* Impact Ledger neumorphism theme. Load AFTER style.css.
   Accessible: soft raised/inset surfaces, text >=4.5:1, visible focus rings,
   one accent hue (teal #7797a3, chosen by Arash 2026-11-08) for the primary action and progress fills.

   Class hooks expected (add any that are missing in the markup):
     .card .tile .input-box (or bare input/select/textarea) .bottom-nav .fab .btn-primary .btn
     .tile.active / [aria-pressed="true"] = inset.  .bottom-nav [aria-current="page"] = inset.

   New components (pure CSS, driven by --value 0..100 set via a class-free attribute is
   not possible without inline style, so set it from JS: el.style.setProperty('--value', n)
   or add classes/attributes in your own sheet):

   .icon-circle  raised round icon holder, 48px
     <span class="icon-circle" aria-hidden="true"><svg>...</svg></span>

   .ring  donut progress; --value 0-100; centre is inset and holds the label
     <div class="ring" role="img" aria-label="70% of weekly goal"><span>70%</span></div>

   .pill-bars / .pill-bar  vertical inset tracks, fill height = --value
     <div class="pill-bars">
       <div class="pill-bar"><div class="pill-track"><div class="pill-fill"></div></div>
         <span class="pill-label">People</span><span class="pill-value">82%</span></div>
     </div>   (set --value on .pill-bar)

   .progress  slim inset track with gradient fill, optional bubble
     <div class="progress" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
       <div class="progress-fill"><span class="progress-tip">50%</span></div></div>   (--value on .progress)

   .segmented  raised container, accent-filled active segment
     <div class="segmented" role="group"><button aria-pressed="true">One-off</button><button aria-pressed="false">Monthly</button></div>
     (active = [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"] or .active)

   .toggle  pill track + raised knob, accent track when on
     <button class="toggle" role="switch" aria-checked="true" aria-label="Still giving"></button>
     (or <input type="checkbox" class="toggle" role="switch">)
*/
:root {
  --bg: #eef0f5;
  --surface: #eef0f5;
  --surface-muted: #e3e7ee;
  --ink: #1c2433;
  --ink-muted: #3f4a5c;
  --ink-faint: #4b5668;
  --border: transparent;
  --border-faint: transparent;
  --teal: #3f5f6a;               /* text/icons in the accent hue: #7797a3 deepened to pass 4.5:1 */
  --teal-light: #eef0f5;
  --teal-strong: #5f808c;        /* pressed state of the teal */
  --blue: #3f5f6a; --blue-light: #e2eaed;
  --teal-border: transparent;
  --on-teal: #10202a;            /* dark text on #7797a3 = 5.3:1 (white would be 3.1:1) */
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --accent-a: #7797a3;           /* the highlight colour */
  --accent-b: #7797a3;
  --fill-a: #6a8b97;             /* decorative fills (no text on them) */
  --fill-b: #9fbcc6;
  --accent-grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --fill-grad: linear-gradient(90deg, var(--fill-a), var(--fill-b));
  --fill-grad-v: linear-gradient(0deg, var(--fill-a), var(--fill-b));

  --neu-light: #ffffff;
  --neu-dark: #c5ccd8;
  /* Tight, small shadows: crisp edges, no smears. */
  --neu-raised: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light);
  --neu-raised-sm: 2px 2px 6px var(--neu-dark), -2px -2px 6px var(--neu-light);
  --neu-inset: inset 2px 2px 4px var(--neu-dark), inset -2px -2px 4px var(--neu-light);
  --neu-glow: 0 0 0 transparent;
  --neu-focus: #3f5f6a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262b36; --surface: #262b36; --surface-muted: #1f232c;
    --ink: #eef1f6; --ink-muted: #b9c2d0; --ink-faint: #a2adbd;
    --teal: #9dbcc7; --teal-light: #262b36; --on-teal: #10202a; --teal-strong: #8fb0bc; --blue: #9dbcc7; --blue-light: #26343b;
    --accent-a: #7797a3; --accent-b: #7797a3;
    --fill-a: #7797a3; --fill-b: #a7c2cb;
    --neu-light: #3a4152; --neu-dark: #101318;
    --neu-glow: 0 0 0 transparent;
    --neu-focus: #9dbcc7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262b36; --surface: #262b36; --surface-muted: #1f232c;
  --ink: #eef1f6; --ink-muted: #b9c2d0; --ink-faint: #a2adbd;
  --teal: #9dbcc7; --teal-light: #262b36; --on-teal: #10202a; --teal-strong: #8fb0bc; --blue: #9dbcc7; --blue-light: #26343b;
  --accent-a: #7797a3; --accent-b: #7797a3;
  --fill-a: #7797a3; --fill-b: #a7c2cb;
  --neu-light: #3a4152; --neu-dark: #101318;
  --neu-glow: 0 0 0 transparent;
  --neu-focus: #9dbcc7;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--ink); }

/* Raised surfaces */
.card, .tile, .btn {
  background: var(--surface); color: var(--ink); border: 0; box-shadow: var(--neu-raised);
}
.card { border-radius: var(--radius-lg); }
.tile { border-radius: var(--radius-md); box-shadow: var(--neu-raised-sm); }
/* Pill buttons */
.btn { border-radius: var(--radius-pill); min-height: 44px; padding: 0 24px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:active, .tile:active, .tile.active, .tile[aria-pressed="true"], .btn[aria-pressed="true"] { box-shadow: var(--neu-inset); }

/* Pill inputs, inset */
.input-box, input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--surface); color: var(--ink); border: 0;
  border-radius: var(--radius-pill); box-shadow: var(--neu-inset); min-height: 48px; font: inherit;
}
textarea { border-radius: var(--radius-md); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { padding: 10px 20px; width: 100%; }
::placeholder { color: var(--ink-muted); opacity: 1; }
.input-box input, .input-box select, .input-box textarea { box-shadow: none; background: transparent; }

/* Primary action: gradient pill */
.btn-primary {
  background: var(--accent-grad); color: var(--on-teal); border: 0;
  border-radius: var(--radius-pill); min-height: 48px; padding: 0 28px;
  font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: var(--neu-raised-sm);
}
.btn-primary:active { box-shadow: inset 3px 3px 8px rgba(0,0,0,.35), inset -2px -2px 6px rgba(255,255,255,.15); }
.fab {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent-grad); color: var(--on-teal); border: 0;
  font-size: 32px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--neu-raised-sm); animation: none;
}
.fab:active { box-shadow: inset 2px 2px 5px rgba(0,0,0,.35); }

/* Icon circle */
.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; min-width: 44px; min-height: 44px; border-radius: 50%;
  background: var(--surface); color: var(--teal); box-shadow: var(--neu-raised-sm);
}
.icon-circle svg { width: 22px; height: 22px; }

/* Donut ring */
.ring {
  --value: 0; --size: 150px; --thick: 16px;
  position: relative; width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--fill-a), var(--fill-b) calc(var(--value) * 1%), transparent 0);
  box-shadow: var(--neu-raised); display: grid; place-items: center;
}
.ring::before { /* inset track visible past the arc */
  content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 0;
  background: conic-gradient(transparent calc(var(--value) * 1%), var(--surface-muted) 0);
}
.ring::after { /* inset centre */
  content: ""; position: absolute; inset: var(--thick); border-radius: 50%;
  background: var(--surface); box-shadow: var(--neu-inset); z-index: 1;
}
.ring > * { position: relative; z-index: 2; font-weight: 600; font-size: 1.4rem; color: var(--ink); text-align: center; }

/* Pill bars */
.pill-bars { display: flex; gap: 14px; justify-content: space-between; align-items: flex-end; }
.pill-bar { --value: 0; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.pill-track {
  position: relative; width: 100%; max-width: 44px; height: 140px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); overflow: hidden;
}
.pill-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--value) * 1%);
  border-radius: var(--radius-pill); background: var(--fill-grad-v);
}
.pill-label { font-size: 0.8rem; color: var(--ink-muted); text-align: center; overflow-wrap: anywhere; }
.pill-value { font-size: 0.9rem; font-weight: 600; color: var(--ink); }

/* Slim progress */
.progress {
  --value: 0; position: relative; height: 12px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); margin-top: 40px;
}
.progress-fill {
  position: relative; height: 100%; width: calc(var(--value) * 1%); min-width: 12px;
  border-radius: var(--radius-pill); background: var(--fill-grad);
}
.progress-tip {
  position: absolute; right: 0; bottom: calc(100% + 12px); transform: translateX(50%);
  padding: 4px 12px; border-radius: 12px; background: var(--surface); color: var(--ink);
  font-size: 0.85rem; font-weight: 500; box-shadow: var(--neu-raised-sm); white-space: nowrap;
}
.progress-tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--surface);
}

/* Segmented control */
.segmented {
  display: inline-flex; gap: 4px; padding: 5px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-raised-sm);
}
.segmented > * {
  min-height: 44px; min-width: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}
.segmented > [aria-pressed="true"], .segmented > [aria-selected="true"],
.segmented > [aria-checked="true"], .segmented > .active {
  background: var(--accent-grad); color: var(--on-teal); box-shadow: 1px 1px 3px rgba(0,0,0,.18);
}

/* Toggle */
.toggle {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 64px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); cursor: pointer;
}
.toggle::after {
  content: ""; position: absolute; top: 6px; left: 6px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--neu-raised-sm);
}
.toggle[aria-checked="true"], .toggle:checked { background: var(--accent-grad); box-shadow: inset 2px 2px 6px rgba(0,0,0,.3); }
.toggle[aria-checked="true"]::after, .toggle:checked::after { left: 26px; background: #ffffff; box-shadow: 2px 2px 6px rgba(0,0,0,.35); }

/* Focus: always visible */
:focus-visible { outline: 3px solid var(--neu-focus); outline-offset: 3px; }
.input-box:focus-within { outline: 2px solid var(--neu-focus); outline-offset: 1px; box-shadow: var(--neu-inset); }
.input-box input:focus-visible, .input-box select:focus-visible, .input-box textarea:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .tile, .btn, .btn-primary, .fab, input, select, textarea, .toggle, .toggle::after, .pill-fill, .progress-fill { transition: box-shadow .15s ease, left .15s ease, height .3s ease, width .3s ease; }
}

/* Selected choice chips: same as the segmented control (teal fill, dark text). */
.chip[aria-pressed="true"] { background: var(--accent-a); color: var(--on-teal); border-color: transparent; box-shadow: 1px 1px 3px rgba(0,0,0,.18); }
