/* Brand design tokens. Every component reads colors from these custom
   properties (never a literal hex) so the light/dark toggle (a `.dark`
   class on <html>, see the inline script in base.html <head> and
   static/js/theme.js) repaints everything with zero markup changes.

   Brand accents (mint/sage/magenta/orange/purple/lavender/teal) are
   declared ONCE below and never redefined inside `.dark` — per design
   requirement they must read identically in both modes. Only structural
   tokens (surface/background/text/border) flip.

   Naming note: --color-dark/--color-darker are used throughout every
   template as "card surface" / "page background" respectively — those are
   functional roles, not literal color promises. In light mode they resolve
   to white/near-white; the names stayed as-is rather than touching 100+
   template call sites for a cosmetic rename. */

/* A handful of pages use a small negative margin (Tailwind's -me-8, etc.)
   as an optical-centering trick next to a back-arrow link — a few pixels
   of real, unintended horizontal overflow this creates is invisible in
   normal document flow, but throws off the coordinate origin for any
   `position: fixed` element added later (its `inset-0` ends up measured
   against a scroll-shifted viewport, not the true one). html is the actual
   scrolling element in standards mode, not body — both are set here to be
   safe regardless of which one a given browser treats as such. */
html, body {
  overflow-x: hidden;
}

:root {
  --color-mint: #4EC3A1;
  --color-sage: #36997B;
  --color-magenta: #B52086;
  --color-orange: #F37936;
  --color-purple: #581865;
  --color-lavender: #6B6CAE;
  --color-teal: #009AAC;

  /* Light mode (default) */
  --color-dark: #FFFFFF;      /* card/surface background */
  --color-darker: #F9FAFB;    /* page background (gray-50) */
  --color-surface: #FFFFFF;
  --color-text: #111827;      /* gray-900 */
  --color-text-muted: #6B7280; /* gray-500 */
  --color-border: rgba(17, 24, 39, 0.12);
  --color-header-bg: rgba(255, 255, 255, 0.85); /* translucent header/bottom-nav */
  --color-track: rgba(17, 24, 39, 0.08);        /* progress-bar empty track */
}

:root.dark {
  --color-dark: #1A1A2E;
  --color-darker: #121222;
  --color-surface: #1A1A2E;
  --color-text: #F1F5F9;
  --color-text-muted: #94A3B8;
  --color-border: rgba(148, 163, 184, 0.2);
  --color-header-bg: rgba(26, 26, 46, 0.9);
  --color-track: rgba(255, 255, 255, 0.08);
}

body {
  background-color: var(--color-darker);
  color: var(--color-text);
}

/* Generic form-field styling so plain Django-rendered widgets (no manual
   Tailwind classes per field) still match the dark RTL theme. This is the
   single source of styling for every <input>/<select>/<textarea> in the
   app — new templates never need per-field utility classes, they just work.

   -webkit-appearance/appearance: none is required here, not optional: iOS
   Safari renders <input type="date"> and <select> with their own native
   chrome (fixed padding, a light control background) that silently
   overrides the rules above unless native appearance is stripped first. */
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"], input[type="search"], input[type="time"],
input[type="url"],
select, textarea {
  width: 100%;
  border-radius: 0.75rem;
  padding: 0.625rem 0.9rem;
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--color-darker);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-mint);
  outline-offset: 1px;
}

/* select needs its own arrow redrawn — appearance:none above strips the
   native one along with the unwanted native chrome. Positioned for RTL
   (arrow on the inline-start/right side), with room reserved via padding
   so text never runs under it. */
select {
  padding-inline-end: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394A3B8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1.1em;
}

/* The native calendar glyph is dark-on-transparent by default: fine as-is
   against light-mode's white fields, but invisible against dark-mode's
   navy fields — invert only in dark mode. */
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.8;
  cursor: pointer;
}
:root.dark input[type="date"]::-webkit-calendar-picker-indicator,
:root.dark input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
input[type="date"], input[type="time"] {
  min-height: 2.75rem;
}

/* Off-screen, not display:none/visibility:hidden — html2canvas (and any
   screenshot-based renderer) can't capture an element that never lays out.
   Used for the Story Card in wishes/public.html. */
.visually-hidden {
  position: fixed;
  top: 0;
  left: -9999px;
  pointer-events: none;
}

