/*
 * LexIndex Design System
 * Custom CSS with CSS Variables - No Framework Dependencies
 *
 * Structure:
 * 0. Font Face Declarations
 * 1. CSS Variables (Colors, Typography, Spacing)
 * 2. Modern Reset
 * 3. Base Typography
 * 4. Layout Utilities
 * 5. Components
 * 6. Responsive Breakpoints
 */

/* =============================================================================
   0. FONT FACE DECLARATIONS (Local Roboto)
   ============================================================================= */

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto-400.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/roboto-500.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/roboto-600.ttf') format('truetype');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto-700.ttf') format('truetype');
}

/* =============================================================================
   1. CSS VARIABLES
   ============================================================================= */

:root {
  /* -------------------------------------------------------------------------
     COLORS
     ------------------------------------------------------------------------- */

  /* Primary - Navy Blue (Header, Footer, Primary Actions) */
  --color-primary-900: #0f172a;  /* Darkest - footer */
  --color-primary-800: #1e293b;  /* Dark - header */
  --color-primary-700: #334155;
  --color-primary-600: #475569;
  --color-primary-500: #64748b;
  --color-primary-400: #94a3b8;
  --color-primary-300: #cbd5e1;
  --color-primary-200: #e2e8f0;
  --color-primary-100: #f1f5f9;
  --color-primary-50:  #f8fafc;

  /* Accent - Blue (Links, Buttons, Highlights) */
  --color-accent-700: #1d4ed8;
  --color-accent-600: #2563eb;
  --color-accent-500: #3b82f6;
  --color-accent-400: #60a5fa;
  --color-accent-300: #93c5fd;
  --color-accent-200: #bfdbfe;
  --color-accent-100: #dbeafe;
  --color-accent-50:  #eff6ff;

  /* Semantic Colors */
  --color-success-600: #16a34a;
  --color-success-100: #dcfce7;
  --color-success-text: #166534;

  --color-warning-600: #ca8a04;
  --color-warning-100: #fef9c3;
  --color-warning-text: #854d0e;

  --color-error-600: #dc2626;
  --color-error-100: #fee2e2;
  --color-error-text: #991b1b;

  --color-info-600: #0284c7;
  --color-info-100: #e0f2fe;
  --color-info-text: #075985;

  /* Neutrals (Text, Borders, Backgrounds) */
  --color-text-primary: #1e293b;     /* Main text */
  --color-text-secondary: #475569;   /* Secondary text */
  --color-text-muted: #64748b;       /* Muted/placeholder */
  --color-text-inverse: #ffffff;     /* Text on dark bg */

  --color-bg-page: #f8fafc;          /* Page background */
  --color-bg-card: #ffffff;          /* Card background */
  --color-bg-hover: #f1f5f9;         /* Hover state */
  --color-bg-disabled: #e2e8f0;      /* Disabled state */

  --color-border: #e2e8f0;           /* Default borders */
  --color-border-strong: #cbd5e1;    /* Emphasized borders */

  /* Court Badge Colors */
  --color-court-iccj: #fef3c7;
  --color-court-iccj-text: #92400e;
  --color-court-cedo: #e0e7ff;
  --color-court-cedo-text: #3730a3;
  --color-court-cjue: #dbeafe;
  --color-court-cjue-text: #1e40af;

  /* Extended palette (for dark-mode parity) */
  --color-text-black: #000000;
  --color-text-disclaimer: #ff0000;
  --color-error-700: #b91c1c;
  --color-error-200: #fecaca;
  --color-error-50: #fef2f2;
  --color-accent-800: #1e40af;
  --color-accent-900: #1e3a8a;
  --color-info-50: #f0f9ff;
  --color-notice-bg: #fef3c7;
  --color-notice-text: #92400e;
  --color-warning-bg: #fff3cd;
  --color-warning-border: #ffc107;
  --color-warning-text-alt: #856d04;

  /* Overlays & shadows */
  --color-overlay-dark: rgba(15, 23, 42, 0.4);
  --color-overlay-light: rgba(255, 255, 255, 0.85);
  --color-overlay-card: rgba(255, 255, 255, 0.92);
  --color-overlay-modal: rgba(0, 0, 0, 0.4);
  --color-shadow-sm: rgba(0, 0, 0, 0.08);
  --color-shadow-md: rgba(0, 0, 0, 0.1);
  --color-focus-primary: rgba(30, 41, 59, 0.1);
  --color-focus-search: rgba(148, 163, 184, 0.15);

  /* -------------------------------------------------------------------------
     TYPOGRAPHY
     ------------------------------------------------------------------------- */

  /* Font Family */
  --font-family-base: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                       Helvetica, Arial, sans-serif;
  --font-family-mono: 'Roboto Mono', 'Consolas', 'Monaco', monospace;

  /* Font Sizes - Fluid with clamp(min, preferred, max) */
  --font-size-xs:   clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);     /* 11-12px */
  --font-size-sm:   clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);    /* 13-14px */
  --font-size-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);        /* 14-16px */
  --font-size-lg:   clamp(1rem, 0.95rem + 0.25vw, 1.125rem);      /* 16-18px */
  --font-size-xl:   clamp(1.125rem, 1rem + 0.5vw, 1.25rem);       /* 18-20px */
  --font-size-2xl:  clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);      /* 20-24px */
  --font-size-3xl:  clamp(1.5rem, 1.25rem + 1vw, 1.875rem);       /* 24-30px */
  --font-size-4xl:  clamp(1.875rem, 1.5rem + 1.5vw, 2.25rem);     /* 30-36px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-base: 1.5;
  --line-height-relaxed: 1.75;      /* For legal text readability */

  /* -------------------------------------------------------------------------
     SPACING (8px base grid)
     ------------------------------------------------------------------------- */

  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* -------------------------------------------------------------------------
     LAYOUT
     ------------------------------------------------------------------------- */

  --max-width-content: 1200px;
  --max-width-narrow: 900px;
  --max-width-wide: 1400px;

  --header-height: 72px;
  --footer-height: auto;

  /* -------------------------------------------------------------------------
     BORDERS & SHADOWS
     ------------------------------------------------------------------------- */

  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* -------------------------------------------------------------------------
     TRANSITIONS
     ------------------------------------------------------------------------- */

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}


/* =============================================================================
   2. MODERN RESET
   ============================================================================= */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  min-height: 100vh;
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
}


/* =============================================================================
   3. BASE TYPOGRAPHY
   ============================================================================= */

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-4);
}

/* Links */
a:not([class]) {
  color: var(--color-accent-600);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:not([class]):hover {
  color: var(--color-accent-700);
}

/* Legal text - more relaxed for readability */
.legal-text {
  line-height: var(--line-height-relaxed);
  font-size: var(--font-size-base);
}

/* Small/muted text */
.text-small {
  font-size: var(--font-size-sm);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-secondary {
  color: var(--color-text-secondary);
}


/* =============================================================================
   4. LAYOUT UTILITIES
   ============================================================================= */

/* Container */
.container {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  padding-inline: 25px;
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

/* Page wrapper for sticky footer */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-main {
  flex: 1;
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid {
  display: grid;
}

/* Spacing utilities */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.py-4 { padding-block: var(--space-4); }
.py-6 { padding-block: var(--space-6); }
.py-8 { padding-block: var(--space-8); }

.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }


/* =============================================================================
   5. COMPONENTS
   ============================================================================= */

/* Header, Footer, Cards, Decision Card, Buttons, Form Inputs:
   Removed — unused. Actual pages use page-specific BEM classes:
   .site-header (common.css), .site-footer (common.css),
   .result-card (common.css), .decision-card (decision.css),
   .auth-form__submit (auth.css), .auth-form__input (auth.css).
   Admin uses .btn-sm, .admin-table, etc. (admin.css). */

/* -------------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--border-radius-full);
}

.badge--success {
  background-color: var(--color-success-100);
  color: var(--color-success-text);
}

.badge--warning {
  background-color: var(--color-warning-100);
  color: var(--color-warning-text);
}

.badge--error {
  background-color: var(--color-error-100);
  color: var(--color-error-text);
}

.badge--info {
  background-color: var(--color-info-100);
  color: var(--color-info-text);
}

/* Court-specific badges */
.badge--iccj {
  background-color: var(--color-court-iccj);
  color: var(--color-court-iccj-text);
}

.badge--cedo {
  background-color: var(--color-court-cedo);
  color: var(--color-court-cedo-text);
}

.badge--cjue {
  background-color: var(--color-court-cjue);
  color: var(--color-court-cjue-text);
}

/* Search Box, Modal, Summary Section:
   Removed — unused. Actual pages use .search-container (common.css),
   .nav-modal (common.css), .summary-block (decision.css). */

/* -------------------------------------------------------------------------
   Loading Spinner
   ------------------------------------------------------------------------- */

.loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader--sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Blurred/Paywall: Removed — unused. Actual pages use
   .blurred-results and .cta-float from homepage.css. */


/* =============================================================================
   KEYBOARD FOCUS INDICATORS (:focus-visible)
   Visible focus ring for keyboard navigation only (not mouse clicks).
   Uses :focus-visible so mouse users don't see outlines.
   ============================================================================= */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent-500);
  outline-offset: 2px;
}


/* =============================================================================
   6. RESPONSIVE BREAKPOINTS
   ============================================================================= */

/* Mobile First - then add desktop styles */

/* Desktop: 1024px and up */
@media (min-width: 1024px) {
  .container {
    padding-inline: var(--space-6);
  }

  .hide-desktop {
    display: none !important;
  }
}

/* Mobile: below 768px */
@media (max-width: 767px) {
  :root {
    --header-height: 60px;
  }

  .hide-mobile {
    display: none !important;
  }

}

/* Print styles */
@media print {
  .site-header,
  .site-footer {
    display: none;
  }
}


/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

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

.hidden {
  display: none !important;
}

.visible {
  visibility: visible;
}

.invisible {
  visibility: hidden;
}

