/* Base styles
   Radius rule: controls 12px, cards 20px, media 28px.

   ============================================================================
   BRAND: to rebrand, change the values in this first block (and the fonts
   below). Everything else in the app points to these. See BRANDING.md.
   ============================================================================ */

:root {
  /* Brand colour scale, darkest to lightest. 600 is the main brand colour. */
  --brand-950: #12132A;   /* landing footer */
  --brand-900: #16182B;   /* sidebar, phone frames, dark bubbles, shadows */
  --brand-850: #1B1E56;   /* gradient shade */
  --brand-800: #1C1F5A;   /* photo frame shade */
  --brand-700: #262A72;   /* photo frame base */
  --brand-650: #2B2F7A;   /* hero card in dark mode */
  --brand-600: #2A2E7F;   /* MAIN BRAND COLOUR: buttons, hero card, links */
  --brand-550: #3A3FA0;   /* gradient highlight */
  --brand-500: #3B409A;   /* photo frame highlight */
  --brand-400: #6A6FD0;
  --brand-300: #8C92EE;
  --brand-200: #A3A8F4;   /* brand colour in dark mode */
  --brand-150: #C9CCF8;
  --brand-100: #D6D8FB;
  --brand-75:  #E2E3F4;   /* soft brand tint */
  --brand-dark-soft: #242851; /* soft brand tint in dark mode */
  --on-brand: #F4F5FA;    /* text on the brand colour */

  /* Surfaces that stay dark in both themes (sidebar, footer) */
  --night-bg: #0E0F1C;
  --night-text: #D6D8EA;
  --night-muted: #C9CBDC;
  --night-subtle: #8E91A8;
  --night-link: #9A9DB8;
  --night-faint: #6E7190;
  --night-line: #262845;
  --night-ring: #2A2D45;

  /* Landing page tints and glows */
  --tint-a-from: #EEEFFA; --tint-a-to: #DFE1F5;
  --tint-b-from: #EAF0F8; --tint-b-to: #DCE4F3;
  --tint-c-from: #F6F6FB; --tint-c-to: #E3E5F7;
  --glow-a-light: #C9CCF4; --glow-b-light: #D9D2F2;
  --tint-a-dark-from: #1B1E36; --tint-a-dark-to: #22264A;
  --tint-b-dark-from: #181C31; --tint-b-dark-to: #1F2442;
  --tint-c-dark-from: #171A2E; --tint-c-dark-to: #23274C;
  --glow-a-dark: #2C3070; --glow-b-dark: #33285E;

  /* Accents that aren't the brand */
  --whatsapp: #1B8049;
  --owed-dot: #FF9C94;

  /* Fonts (also update the Google Fonts link in each .html page) */
  --font-display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Theme colours: light first, dark below. These mostly point at the brand block. */
:root {
  --bg: #F1F2F4;
  --surface: #FCFCFD;
  --surface-2: #E7E8EE;
  --ink: #16182B;
  --ink-2: #474A60;
  --ink-3: #62657B;
  --line: #D9DBE3;
  --brand: var(--brand-600);
  --brand-ink: #FCFCFD;
  --brand-soft: var(--brand-75);
  --hero-bg: var(--brand-600);
  --hero-ink: var(--on-brand);
  --pos: #1B7650;
  --pos-soft: #DDEFE6;
  --neg: #B0302A;
  --neg-soft: #F6E1DF;
  --shadow: 0 1px 2px color-mix(in srgb, var(--brand-900) 5%, transparent), 0 12px 32px -12px color-mix(in srgb, var(--brand-600) 18%, transparent);

  --r-control: 12px;
  --r-card: 20px;
  --r-media: 28px;

  /* Page width: layouts fill the screen up to this, with a fluid margin at the edges */
  --page-max: 1760px;
  --page-gutter: clamp(24px, 4vw, 80px);
  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--night-bg);
  --surface: #16182A;
  --surface-2: #20233A;
  --ink: #ECEDF4;
  --ink-2: #B4B6C9;
  --ink-3: #9295AB;
  --line: var(--night-ring);
  --brand: var(--brand-200);
  --brand-ink: var(--night-bg);
  --brand-soft: var(--brand-dark-soft);
  --hero-bg: var(--brand-650);
  --hero-ink: #ECEDF4;
  --pos: #56C694;
  --pos-soft: #16302A;
  --neg: #F2837B;
  --neg-soft: #3A1D22;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 16px 40px -16px rgb(0 0 0 / .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { text-wrap: balance; }
p, li, figcaption { text-wrap: pretty; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Skip link: hidden until a keyboard user tabs to it */
.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 100; padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform .3s var(--ease);
}
.skip-link:focus { transform: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0;
}
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Logo */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-family: var(--font-display);
  font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em;
  white-space: nowrap;
}
/* The logo files live in img/. Pages show the navy version on light backgrounds and the
   light version in dark mode; always-dark areas (footer, sidebar) use only the light one. */
.logo-img { display: block; height: 28px; width: auto; flex: none; }
.logo-for-dark { display: none; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: block; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-weight: 560; font-size: .97rem; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { opacity: .92; }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-3); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-danger { background: var(--neg-soft); color: var(--neg); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn i { font-size: 1.15em; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: var(--r-control); border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; font-size: 1.3rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* Text link button */
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-weight: 560; font-size: .9rem;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: transparent;
  transition: text-decoration-color .2s;
}
.link-btn:hover { text-decoration-color: currentColor; }

/* Forms */
.field { display: grid; gap: 8px; }
.field label { font-size: .9rem; font-weight: 550; color: var(--ink); }
.field .help { font-size: .85rem; color: var(--ink-3); }
.field .error { font-size: .85rem; color: var(--neg); min-height: 0; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-control);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input[aria-invalid="true"] { border-color: var(--neg); }
.textarea { min-height: 88px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

/* Avatars: initials on tinted ground */
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 32%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 650; font-size: .85rem; letter-spacing: .01em;
}

/* Image frames: indigo ground shows if an image is missing */
.frame {
  position: relative; overflow: hidden; border-radius: var(--r-media);
  background:
    radial-gradient(120% 90% at 20% 10%, var(--brand-500) 0%, transparent 60%),
    radial-gradient(90% 80% at 90% 100%, var(--brand-800) 0%, transparent 70%),
    var(--brand-700);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: var(--r-control);
  font-size: .93rem; font-weight: 520; z-index: 90;
  transition: opacity .25s var(--ease), transform .35s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  border-radius: 10px;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
