/* ==========================================================================
   Mike Vasquez Real Estate — Design System
   mikevasquezrealestate.com

   Audience note: primary users are 55–80 years old. Every contrast pair
   below has been computed against the actual WCAG 2.1 relative-luminance
   formula (not eyeballed) and meets 4.5:1 for normal text. Do not swap
   colors without re-checking contrast — see the ratios noted inline.
   ========================================================================== */

/* --------------------------------------------------------------------
   1. COLOR TOKENS
   All ratios below are contrast against #FFFFFF (white) unless noted.
   -------------------------------------------------------------------- */
:root {

  /* Brand core */
  --color-primary:        #1F3B4A; /* deep desert-twilight blue — 11.8:1 on white */
  --color-primary-dark:   #16303C; /* hover/active state — 13.8:1 on white */
  --color-primary-tint:   #DCE6EA; /* light wash for backgrounds/badges, not for text */

  --color-secondary:      #4F6B4A; /* sage green — 5.9:1 on white */
  --color-secondary-dark: #3C5238; /* hover/active state */
  --color-secondary-tint: #E3E9DF; /* light wash for backgrounds, not for text */

  --color-accent:         #9C5518; /* terracotta/clay — 5.6:1 on white — use sparingly, primary CTA only */
  --color-accent-dark:    #7A4212; /* hover/active state */
  --color-accent-tint:    #F1E3D6; /* light wash for backgrounds, not for text */

  /* Neutrals (5-step warm gray scale — pairs with the sand background) */
  --color-neutral-900: #232323; /* body text — 15.7:1 on white */
  --color-neutral-700: #4A4A4A; /* secondary text, captions — 8.9:1 on white */
  --color-neutral-500: #666666; /* muted/helper text, placeholders — 5.7:1 on white (still AA) */
  --color-neutral-200: #E5E1DA; /* borders, dividers, input borders */
  --color-neutral-100: #FAF8F5; /* page background (warm off-white, not stark white) */

  --color-white: #FFFFFF;
  --color-black: #000000;

  /* Status */
  --color-success:      #256B3A; /* 6.5:1 on white */
  --color-success-tint: #E1EEE4;
  --color-error:        #A32626; /* 7.3:1 on white */
  --color-error-tint:   #F5E2E2;

  /* Semantic aliases — reference these in components, not raw colors */
  --color-text:            var(--color-neutral-900);
  --color-text-muted:      var(--color-neutral-700);
  --color-text-placeholder:var(--color-neutral-500);
  --color-bg:              var(--color-neutral-100);
  --color-bg-surface:      var(--color-white);
  --color-border:          var(--color-neutral-200);
  --color-link:            var(--color-primary);
  --color-link-hover:      var(--color-primary-dark);
  --color-focus-ring:      #1F3B4A;

  /* --------------------------------------------------------------------
     2. TYPOGRAPHY
     Two Google Fonts max. Headings: Lora (warm serif, credible, calm).
     Body: PT Sans (humanist sans, high legibility at large sizes).
     font-display: swap avoids invisible text during font load.
     -------------------------------------------------------------------- */
  --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body:    'PT Sans', Arial, Helvetica, sans-serif;

  /* Type scale — base unit is the BROWSER default (1rem = user's font-size
     setting, usually 16px). We do NOT override html{font-size}, because
     doing so silently overrides a visitor's own browser text-size
     preference — a real accessibility issue for this audience. Instead
     the body element is set in rem so it lands at 18px for a 16px
     default, but still scales correctly if the visitor has bumped their
     browser default up. */
  --text-sm:   1rem;       /* ~16px — captions, legal fine print ONLY, never body copy */
  --text-base: 1.125rem;   /* ~18px — minimum body text size, per spec */
  --text-md:   1.25rem;    /* ~20px — lead paragraphs, large body */
  --text-lg:   1.5rem;     /* ~24px — H4 / small subheads */
  --text-xl:   1.875rem;   /* ~30px — H3 */
  --text-2xl:  2.25rem;    /* ~36px — H2 */
  --text-3xl:  2.75rem;    /* ~44px — H1, mobile hero */
  --text-4xl:  3.5rem;     /* ~56px — H1, desktop hero */

  --leading-body:    1.6;  /* required minimum for body copy */
  --leading-heading: 1.25;
  --leading-tight:   1.1;

  --font-weight-regular:  400;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  /* --------------------------------------------------------------------
     3. SPACING SCALE (4px base unit)
     -------------------------------------------------------------------- */
  --space-1:  0.25rem;  /* 4px */
  --space-2:  0.5rem;   /* 8px */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.5rem;   /* 24px */
  --space-6:  2rem;     /* 32px */
  --space-7:  3rem;     /* 48px */
  --space-8:  4rem;     /* 64px */
  --space-9:  6rem;     /* 96px */
  --space-10: 8rem;     /* 128px */

  /* --------------------------------------------------------------------
     4. RADII + SHADOWS (kept subtle — calm, not flashy)
     -------------------------------------------------------------------- */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(35, 35, 35, 0.06);
  --shadow-md: 0 4px 12px rgba(35, 35, 35, 0.08);
  --shadow-lg: 0 8px 24px rgba(35, 35, 35, 0.10);

  /* --------------------------------------------------------------------
     5. LAYOUT / SIZING
     -------------------------------------------------------------------- */
  --tap-target-min: 48px;    /* required minimum for all interactive elements */
  --container-max:  1180px;
  --border-width:   1px;
  --focus-ring-width: 3px;
}

/* --------------------------------------------------------------------
   FONT LOADING
   Replace with a self-hosted @font-face or a <link> in <head> for best
   performance; @import is shown here for completeness only.
   -------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=PT+Sans:wght@400;700&display=swap');

/* --------------------------------------------------------------------
   BASE ELEMENTS
   -------------------------------------------------------------------- */
html {
  /* No font-size override here — respects visitor's browser text settings. */
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--color-text);
  background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-heading);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin: 0 0 var(--space-4) 0;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-4xl); }
}

p {
  margin: 0 0 var(--space-4) 0;
  max-width: 70ch; /* keeps line length readable for aging eyes */
}

small, .text-fine-print {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover,
a:focus {
  color: var(--color-link-hover);
}

/* Visible, high-contrast focus state for keyboard users of any age */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

/* --------------------------------------------------------------------
   BUTTONS
   All variants meet the 48x48px minimum tap target and 18px+ label text.
   -------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-target-min);
  min-width: var(--tap-target-min);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--color-accent); /* accent reserved for primary CTAs */
  color: var(--color-white);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--color-accent-dark);
  color: var(--color-white);
}

.btn-secondary {
  background-color: var(--color-white);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--color-primary-tint);
}

.btn-tertiary {
  background-color: transparent;
  color: var(--color-primary);
  text-decoration: underline;
  min-width: auto;
  padding: var(--space-3) var(--space-2);
}
.btn-tertiary:hover,
.btn-tertiary:focus {
  color: var(--color-primary-dark);
}

.btn:disabled {
  background-color: var(--color-neutral-200);
  border-color: var(--color-neutral-200);
  color: var(--color-neutral-500);
  cursor: not-allowed;
}

/* --------------------------------------------------------------------
   FORM INPUTS
   -------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: var(--tap-target-min);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base); /* never smaller than 18px — prevents mobile zoom-on-focus too */
  color: var(--color-text);
  background-color: var(--color-white);
  border: var(--border-width) solid var(--color-neutral-500);
  border-radius: var(--radius-sm);
}

.form-textarea {
  min-height: calc(var(--tap-target-min) * 2);
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-placeholder);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: 1px;
}

.form-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-error);
  margin-top: var(--space-2);
  font-weight: var(--font-weight-bold);
}

.form-input.has-error,
.form-textarea.has-error {
  border-color: var(--color-error);
}

/* Checkbox / radio — enlarged for easier targeting */
input[type="checkbox"],
input[type="radio"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin-right: var(--space-2);
  accent-color: var(--color-primary);
}

.checkbox-label,
.radio-label {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  font-size: var(--text-base);
  cursor: pointer;
}

/* --------------------------------------------------------------------
   CARDS
   -------------------------------------------------------------------- */
.card {
  background-color: var(--color-bg-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

.card-accent-border {
  border-top: 4px solid var(--color-accent);
}

/* --------------------------------------------------------------------
   STATUS / ALERT STYLES
   -------------------------------------------------------------------- */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  font-size: var(--text-base);
}

.alert-success {
  background-color: var(--color-success-tint);
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert-error {
  background-color: var(--color-error-tint);
  border-color: var(--color-error);
  color: var(--color-error);
}

/* --------------------------------------------------------------------
   UTILITIES
   -------------------------------------------------------------------- */
.text-muted   { color: var(--color-text-muted); }
.text-center  { text-align: center; }
.bg-surface   { background-color: var(--color-bg-surface); }
.bg-primary-tint { background-color: var(--color-primary-tint); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Respect users who've asked the OS to reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
