/**
 * @file
 * Base styles and CSS custom properties for TeamThru theme.
 */

/* ==================== CSS Variables / Design Tokens ==================== */
:root {
  /* TeamThru Brand Colors */
  --tt-navy: #1A3A5C;
  --tt-navy-dark: #142D47;
  --tt-navy-light: #2A4A6C;
  --tt-teal: #2EBCB0;
  --tt-teal-light: #3DD4C7;
  --tt-teal-dark: #249B91;
  --tt-blue: #1976D2;

  /* Neutrals */
  --white: #FFFFFF;
  --gray-lightest: #F7F7F7;
  --gray-lighter: #E6E6E6;
  --gray-light: #CCCCCC;
  --gray: #757575;
  --gray-dark: #454545;
  --gray-darkest: #1B1B1B;

  /* Functional Colors */
  --text-primary: var(--gray-darkest);
  --text-secondary: var(--gray-dark);
  --text-muted: var(--gray);
  --link-color: var(--tt-blue);
  --link-hover: var(--tt-navy);

  /* Status Colors */
  --success: #2E7D32;
  --warning: #F57C00;
  --error: #C62828;
  --info: #0277BD;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 5rem;

  /* Typography */
  --font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3rem;

  --line-height-tight: 1.25;
  --line-height-base: 1.6;
  --line-height-loose: 1.8;

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

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-wide: 1400px;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-tooltip: 600;

  /* Teal alpha variants */
  --tt-teal-10: rgba(46, 188, 176, 0.1);
  --tt-teal-15: rgba(46, 188, 176, 0.15);
  --tt-teal-20: rgba(46, 188, 176, 0.2);

  /* White alpha variants (for dark backgrounds) */
  --white-90: rgba(255, 255, 255, 0.9);
  --white-70: rgba(255, 255, 255, 0.7);
  --white-60: rgba(255, 255, 255, 0.6);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-10: rgba(255, 255, 255, 0.1);

  /* Status backgrounds */
  --success-bg: #E8F5E9;
  --warning-bg: #FFF3E0;
  --error-bg: #FFEBEE;
}

/* ==================== Reset & Base Styles ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-width: 320px;
}

/* Wrapper to prevent horizontal scroll without hiding dropdowns */
.page-overflow-wrapper {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* Prevent text from causing horizontal overflow */
h1, h2, h3, h4, h5, h6, p, li, td, th, span, label {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--space-md);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--tt-navy);
}

h1 { font-size: var(--font-size-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--font-size-3xl); letter-spacing: -0.02em; }
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-top: 0;
  margin-bottom: var(--space-md);
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--tt-teal);
  outline-offset: 2px;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-xs);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--gray-lighter);
}

th {
  font-weight: var(--font-weight-semibold);
  background-color: var(--gray-lightest);
}

/* Forms */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
}

/* Code */
code, pre {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
}

code {
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--gray-lightest);
  border-radius: var(--border-radius-sm);
}

pre {
  padding: var(--space-md);
  background-color: var(--gray-darkest);
  color: var(--white);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
}

pre code {
  padding: 0;
  background-color: transparent;
}

/* Blockquotes */
blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 4px solid var(--tt-teal);
  background-color: var(--gray-lightest);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  margin: var(--space-xl) 0;
  border: 0;
  border-top: 1px solid var(--gray-lighter);
}

/* Screen Reader Only */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--tt-navy);
  color: var(--white);
  z-index: var(--z-tooltip);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--tt-teal);
  outline-offset: 2px;
}

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

/* ==================== Focus Visible ==================== */
/* Use focus-visible for interactive elements to avoid focus ring on mouse click */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--tt-teal);
  outline-offset: 2px;
}
