/**
 * Global Styles - Base reset and typography
 */

/* ==================== CSS RESET ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--duration-normal) var(--ease-in-out),
        color var(--duration-normal) var(--ease-in-out);
}

/* ==================== TYPOGRAPHY ==================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--text-5xl);
    letter-spacing: var(--tracking-tight);
}

h2 {
    font-size: var(--text-4xl);
    letter-spacing: var(--tracking-tight);
}

h3 {
    font-size: var(--text-3xl);
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-in-out);
}

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

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

strong,
b {
    font-weight: var(--font-semibold);
}

em,
i {
    font-style: italic;
}

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

/* ==================== LISTS ==================== */
ul,
ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
}

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

/* ==================== MEDIA ==================== */
img,
video,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

img {
    image-rendering: -webkit-optimize-contrast;
}

/* ==================== SELECTION ==================== */
::selection {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* ==================== UTILITY CLASSES ==================== */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 600px) {
    .container {
        padding: 0 var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-8);
    }
}

.section {
    padding: var(--space-16) 0;
}

@media (min-width: 600px) {
    .section {
        padding: var(--space-20) 0;
    }
}

@media (min-width: 1024px) {
    .section {
        padding: var(--space-24) 0;
    }
}

/* Section headers */
.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

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

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

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

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

.text-accent {
    color: var(--color-primary);
}

/* Display utilities */
.hidden {
    display: none;
}

.block {
    display: block;
}

.inline {
    display: inline;
}

.inline-block {
    display: inline-block;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.grid {
    display: grid;
}

/* Flexbox utilities */
.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

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

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

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

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

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

.justify-start {
    justify-content: flex-start;
}

.justify-end {
    justify-content: flex-end;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

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

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: var(--space-3) var(--space-4);
    z-index: var(--z-tooltip);
    transition: top var(--duration-fast) var(--ease-in-out);
}

.skip-link:focus {
    top: 0;
}
/* Mobile Overflow Fix */
.mobile-overflow-fix, html, body { overflow-x: hidden !important; max-width: 100vw; width: 100%; }

/* ==================== GLOBAL LOADER ==================== */
html.i18n-loading body {
    overflow: hidden !important;
}
html.i18n-loading body > *:not(#site-header-el) {
    opacity: 0;
    visibility: hidden;
}
html.i18n-loading body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-primary);
    z-index: 99999;
    visibility: visible;
    opacity: 1;
}
html.i18n-loading body::after {
    content: '';
    position: fixed;
    top: 50%; left: 50%;
    width: 80px; height: 80px;
    margin-top: -40px; margin-left: -40px;
    background-image: url('../assets/images/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 100000;
    visibility: visible;
    opacity: 1;
    animation: loader-pulse 1.5s infinite ease-in-out;
}
@keyframes loader-pulse {
    0% { transform: scale(0.85); opacity: 0.6; filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4)); }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 25px rgba(99, 102, 241, 0.9)); }
    100% { transform: scale(0.85); opacity: 0.6; filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4)); }
}

/* ==================== TEXT ALIGNMENT: GLOBAL FIX ==================== */
/* Prevent any inherited text-align:justify on all paragraph/bullet content */
p,
.bullet,
.t-bullet,
.t-desc-text,
.t-quote-text,
.card-desc,
.card-body p,
.timeline-content p,
.exp-hero-desc,
.card-bullets .bullet,
li {
    text-align: left !important;
}

/* RTL: flip to right-align */
[dir="rtl"] p,
[dir="rtl"] .bullet,
[dir="rtl"] .t-bullet,
[dir="rtl"] .t-desc-text,
[dir="rtl"] .t-quote-text,
[dir="rtl"] .card-desc,
[dir="rtl"] .card-body p,
[dir="rtl"] .timeline-content p,
[dir="rtl"] li {
    text-align: right !important;
}

