/* =====================================================
   GILBATECH CORE STYLES v1.4
   Institutional • Predictable • Long-Term Safe
   AUTHORITATIVE BASELINE — DO NOT FRAGMENT
===================================================== */


/* =====================================================
   1. RESET & BASE
===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg-page);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}


/* =====================================================
   2. DESIGN TOKENS — SINGLE SOURCE OF TRUTH
===================================================== */
:root {
  /* Brand */
  --primary: #5d2594;
  --primary-strong: #6b2fb8;
  --primary-soft: rgba(93, 37, 148, 0.12);

  /* Text */
  --text: #1f2933;
  --muted: #6b7280;

  /* Backgrounds */
  --bg-page: #ffffff;
  --bg-section: #f9fafb;

  /* Borders */
  --border: #e5e7eb;

  /* Shadows */
  --shadow-header: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-cta: 0 10px 24px rgba(93, 37, 148, 0.35);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;

  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-xxl: 4.5rem;
}


/* =====================================================
   3. LAYOUT CONTAINER
===================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}


/* =====================================================
   4. HEADER
===================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-page);
  border-bottom: 1px solid var(--primary-soft);
  box-shadow: var(--shadow-header);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: var(--space-md);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}


/* =====================================================
   5. PRIMARY NAVIGATION
===================================================== */
.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.site-header nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  position: relative;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.site-header nav a.active {
  color: var(--primary);
  font-weight: 600;
}


/* =====================================================
   6. LANGUAGE SWITCHER
===================================================== */
.lang-switcher {
  display: flex;
  gap: 0.35rem;
}

.lang-switcher button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-switcher button:hover,
.lang-switcher button:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
}

.lang-switcher button.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}


/* =====================================================
   7. BUTTON SYSTEM
===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

/* Primary */
.btn.primary {
  background-color: var(--primary-strong);
  color: #ffffff;
  border: 1px solid var(--primary-strong);
  box-shadow: var(--shadow-cta);
}

.btn.primary:hover {
  background-color: var(--primary);
}

/* Outline (Hero / Contrast Contexts) */
.btn.outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.btn.outline:hover {
  background-color: rgba(255, 255, 255, 0.12);
}


/* =====================================================
   8. HERO
===================================================== */
.hero {
  position: relative;
  padding: var(--space-xxl) 0;
  color: #ffffff;
  overflow: hidden;
}

.hero .container {
  max-width: 1100px;
}

.hero h1 {
  font-size: 2.35rem;
  line-height: 1.18;
  max-width: 680px;
  margin: 0;
  letter-spacing: -0.02em;
}

.hero p {
  margin-top: var(--space-sm);
  font-size: 1.05rem;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.92);
}

.hero-actions {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}


/* =====================================================
   9. HERO BACKGROUND — HOME
===================================================== */
.hero-home::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 18% 28%,
      rgba(255,255,255,0.08),
      transparent 42%
    ),
    linear-gradient(
      135deg,
      rgba(93,37,148,0.88),
      rgba(17,24,39,0.94)
    );
  z-index: 0;
}

.hero-home .container {
  position: relative;
  z-index: 1;
}


/* =====================================================
   10. CONTENT SECTIONS
===================================================== */
section {
  padding: var(--space-xl) 0;
}

section.alt {
  background-color: var(--bg-section);
}

section h1,
section h2 {
  margin-top: 0;
}


/* =====================================================
   11. FOOTER
===================================================== */
footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

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


/* =====================================================
   12. COMPONENTS
===================================================== */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background-color: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.icon-card {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.icon-card .icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}


/* =====================================================
   13. RTL SUPPORT — AUTHORITATIVE
===================================================== */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .site-header .container,
[dir="rtl"] nav,
[dir="rtl"] .lang-switcher,
[dir="rtl"] .hero-actions,
[dir="rtl"] .icon-card,
[dir="rtl"] .footer-links {
  flex-direction: row-reverse;
}

[dir="rtl"] .icon-card {
  text-align: right;
}


/* =====================================================
   14. RESPONSIVE
===================================================== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}


/* =====================================================
   15. DARK MODE TOKENS
===================================================== */
:root {
  --bg-page-dark: #0f172a;
  --bg-section-dark: #111827;

  --text-dark: #e5e7eb;
  --muted-dark: #9ca3af;

  --border-dark: #1f2937;

  --shadow-header-dark: 0 2px 6px rgba(0,0,0,0.4);
}


/* =====================================================
   16. DARK MODE — SYSTEM PREFERENCE
===================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: var(--bg-page-dark);
    --bg-section: var(--bg-section-dark);
    --text: var(--text-dark);
    --muted: var(--muted-dark);
    --border: var(--border-dark);
    --shadow-header: var(--shadow-header-dark);
  }
}


/* =====================================================
   17. DARK MODE — MANUAL OVERRIDE (OPTIONAL)
===================================================== */
#theme-toggle:checked ~ * {
  --bg-page: var(--bg-page-dark);
  --bg-section: var(--bg-section-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
  --border: var(--border-dark);
  --shadow-header: var(--shadow-header-dark);
}

.theme-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--primary);
  color: #ffffff;
  padding: 0.6rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  z-index: 999;
}
.nav-toggle {
  display: none;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }

  nav[hidden] {
    display: none;
  }
}
.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}
/* =====================================================
   ACCESSIBLE FOCUS STYLES (WCAG 2.2)
===================================================== */

/* Reset default */
*:focus {
  outline: none;
}

/* Keyboard-only focus */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Buttons & links refinement */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

/* Skip link stronger focus */
.skip-link:focus-visible {
  outline: 3px solid #fff;
}
