/* ============================================================
   SwiftCalculators.net — Main Stylesheet
   Purpose: CSS variables, typography, layout, global styles
   Import order: reset.css → style.css → components.css → responsive.css
   ============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
  /* --- Brand Colors --- */
  --primary:          #4F46E5;   /* Indigo — buttons, links, active states */
  --primary-hover:    #4338CA;   /* Darker indigo for hover */
  --primary-light:    #EEF2FF;   /* Light indigo for backgrounds */
  --secondary:        #06B6D4;   /* Cyan — accents, highlights */
  --secondary-hover:  #0891B2;
  --secondary-light:  #ECFEFF;

  /* --- Semantic Colors --- */
  --success:          #22C55E;
  --success-light:    #F0FDF4;
  --warning:          #F59E0B;
  --warning-light:    #FFFBEB;
  --error:            #EF4444;
  --error-light:      #FEF2F2;
  --info:             #3B82F6;
  --info-light:       #EFF6FF;

  /* --- Backgrounds --- */
  --bg-page:          #F8FAFC;   /* Page background */
  --bg-card:          #FFFFFF;   /* Card/section background */
  --bg-input:         #FFFFFF;   /* Input field background */
  --bg-hover:         #F1F5F9;   /* Hover state background */
  --bg-overlay:       rgba(15, 23, 42, 0.5); /* Modal overlay */

  /* --- Text --- */
  --text-primary:     #0F172A;   /* Main headings, body */
  --text-secondary:   #64748B;   /* Subtext, descriptions */
  --text-muted:       #94A3B8;   /* Placeholder, disabled */
  --text-inverse:     #FFFFFF;   /* Text on dark backgrounds */
  --text-link:        #4F46E5;   /* Link color */

  /* --- Borders --- */
  --border:           #E2E8F0;   /* Default border */
  --border-focus:     #4F46E5;   /* Focus state border */
  --border-error:     #EF4444;   /* Error state border */

  /* --- Shadows --- */
  --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow:           0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-md:        0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.06);
  --shadow-lg:        0 10px 15px rgba(0,0,0,0.08), 0 20px 40px rgba(0,0,0,0.07);
  --shadow-focus:     0 0 0 3px rgba(79, 70, 229, 0.15);

  /* --- Border Radius --- */
  --radius-xs:        4px;
  --radius-sm:        8px;
  --radius:           12px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --radius-full:      9999px;

  /* --- Spacing Scale --- */
  --space-1:    4px;
  --space-2:    8px;
  --space-3:    12px;
  --space-4:    16px;
  --space-5:    20px;
  --space-6:    24px;
  --space-8:    32px;
  --space-10:   40px;
  --space-12:   48px;
  --space-16:   64px;
  --space-20:   80px;
  --space-24:   96px;

  /* --- Typography --- */
  --font-family:      system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:        'Courier New', Courier, monospace;

  --font-xs:          0.75rem;    /* 12px */
  --font-sm:          0.875rem;   /* 14px */
  --font-base:        1rem;       /* 16px */
  --font-lg:          1.125rem;   /* 18px */
  --font-xl:          1.25rem;    /* 20px */
  --font-2xl:         1.5rem;     /* 24px */
  --font-3xl:         1.875rem;   /* 30px */
  --font-4xl:         2.25rem;    /* 36px */
  --font-5xl:         3rem;       /* 48px */

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

  --line-height-tight:    1.25;
  --line-height-normal:   1.5;
  --line-height-relaxed:  1.75;

  /* --- Layout --- */
  --container-sm:     640px;
  --container-md:     768px;
  --container-lg:     1024px;
  --container-xl:     1280px;
  --container-2xl:    1400px;

  /* --- Header --- */
  --header-height:    64px;

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

  /* --- Z-index --- */
  --z-below:      -1;
  --z-base:       0;
  --z-dropdown:   100;
  --z-sticky:     200;
  --z-header:     300;
  --z-modal:      400;
  --z-toast:      500;
  --z-tooltip:    600;
}

/* ============================================================
   GLOBAL BASE STYLES
   ============================================================ */
body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-page);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: var(--font-4xl); font-weight: var(--font-weight-bold);   line-height: var(--line-height-tight); }
h2 { font-size: var(--font-3xl); font-weight: var(--font-weight-bold);   line-height: var(--line-height-tight); }
h3 { font-size: var(--font-2xl); font-weight: var(--font-weight-semibold); line-height: var(--line-height-tight); }
h4 { font-size: var(--font-xl);  font-weight: var(--font-weight-semibold); line-height: var(--line-height-tight); }
h5 { font-size: var(--font-lg);  font-weight: var(--font-weight-medium);  line-height: var(--line-height-normal); }
h6 { font-size: var(--font-base); font-weight: var(--font-weight-medium); line-height: var(--line-height-normal); }

p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

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

a {
  color: var(--text-link);
  transition: color var(--transition-fast);
}

a:hover { color: var(--primary-hover); }

strong { font-weight: var(--font-weight-semibold); }
em     { font-style: italic; }

small  { font-size: var(--font-sm); color: var(--text-secondary); }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--primary);
}

/* ============================================================
   LAYOUT — CONTAINER
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-sm  { max-width: var(--container-sm); }
.container-md  { max-width: var(--container-md); }
.container-lg  { max-width: var(--container-lg); }
.container-2xl { max-width: var(--container-2xl); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  height: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  gap: var(--space-4);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.site-logo span {
  color: var(--primary);
}

.site-logo img {
  height: 32px;
  width: auto;
}

/* Header Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.header-nav a:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

/* Search Bar in Header */
.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  max-width: 400px;
  margin-inline: var(--space-8);
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-4) 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-page);
  font-size: var(--font-sm);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
  background: var(--bg-card);
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb li:last-child {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  padding: var(--space-10) 0 var(--space-8);
  text-align: center;
}

.hero h1 {
  font-size: var(--font-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.hero p {
  font-size: var(--font-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin-inline: auto;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.page-main {
  min-height: calc(100vh - var(--header-height));
  padding-bottom: var(--space-20);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  align-items: start;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
  font-size: var(--font-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.section-subtitle {
  font-size: var(--font-lg);
  color: var(--text-secondary);
  margin-top: calc(-1 * var(--space-4));
  margin-bottom: var(--space-6);
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background-color: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer-brand p {
  font-size: var(--font-sm);
  color: #94A3B8;
  margin-top: var(--space-4);
  line-height: var(--line-height-relaxed);
}

.footer-col h4 {
  font-size: var(--font-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-inverse);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col a {
  display: block;
  font-size: var(--font-sm);
  color: #94A3B8;
  margin-bottom: var(--space-2);
  transition: color var(--transition-fast);
}

.footer-col a:hover { color: var(--text-inverse); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-sm);
  color: #64748B;
}

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

/* Display */
.d-none     { display: none !important; }
.d-block    { display: block !important; }
.d-flex     { display: flex !important; }
.d-grid     { display: grid !important; }
.d-inline   { display: inline !important; }

/* Flex utilities */
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

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

/* Text colors */
.text-primary    { color: var(--text-primary) !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-muted      { color: var(--text-muted) !important; }
.text-brand      { color: var(--primary) !important; }
.text-success    { color: var(--success) !important; }
.text-error      { color: var(--error) !important; }
.text-warning    { color: var(--warning) !important; }

/* Font weights */
.font-normal   { font-weight: var(--font-weight-normal) !important; }
.font-medium   { font-weight: var(--font-weight-medium) !important; }
.font-semibold { font-weight: var(--font-weight-semibold) !important; }
.font-bold     { font-weight: var(--font-weight-bold) !important; }

/* Font sizes */
.text-xs   { font-size: var(--font-xs) !important; }
.text-sm   { font-size: var(--font-sm) !important; }
.text-base { font-size: var(--font-base) !important; }
.text-lg   { font-size: var(--font-lg) !important; }
.text-xl   { font-size: var(--font-xl) !important; }
.text-2xl  { font-size: var(--font-2xl) !important; }

/* Spacing */
.mt-0  { margin-top: 0 !important; }
.mt-4  { margin-top: var(--space-4) !important; }
.mt-6  { margin-top: var(--space-6) !important; }
.mt-8  { margin-top: var(--space-8) !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-4  { margin-bottom: var(--space-4) !important; }
.mb-6  { margin-bottom: var(--space-6) !important; }
.mb-8  { margin-bottom: var(--space-8) !important; }

/* Width */
.w-full  { width: 100% !important; }
.w-auto  { width: auto !important; }

/* Visibility */
.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;
}

/* Truncate text */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
