/* ==========================================================================
   CSEJ Endurance Hub - Standalone Design System & Stylesheet
   ========================================================================== */

:root {
  /* Design system tokens (OKLCH with hex/rgb fallbacks) */
  --radius: 0.375rem;
  --background: #ffffff;
  --foreground: #1c352a;
  --card: #ffffff;
  --card-foreground: #141724;
  --popover: #ffffff;
  --popover-foreground: #141724;
  --primary: #006a4e;
  --primary-hover: #00563f;
  --primary-foreground: #ffffff;
  --secondary: #f6f8f7;
  --secondary-hover: #eaf0ed;
  --secondary-foreground: #1b533d;
  --muted: #f6f8f7;
  --muted-foreground: #5a7368;
  --accent: #e52823;
  --accent-hover: #cc1e19;
  --accent-foreground: #ffffff;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --border: #dbe3df;
  --input: #dbe3df;
  --ring: #006a4e;

  /* Typography */
  --font-sans: "Manrope", "Alexandria", system-ui, -apple-system, sans-serif;
  --font-display: "Barlow Condensed", "Alexandria", sans-serif;
}

@supports (color: oklch(0 0 0)) {
  :root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.22 0.025 160);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.129 0.042 264.695);
    --primary: oklch(0.42 0.105 163);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.975 0.004 160);
    --secondary-foreground: oklch(0.34 0.08 163);
    --muted: oklch(0.975 0.004 160);
    --muted-foreground: oklch(0.5 0.025 160);
    --accent: oklch(0.61 0.235 27);
    --accent-foreground: oklch(1 0 0);
    --border: oklch(0.9 0.012 160);
    --input: oklch(0.9 0.012 160);
    --ring: oklch(0.42 0.105 163);
  }
}

/* Base reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
}

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

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  letter-spacing: 0;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

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

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

button, input, textarea {
  font: inherit;
}

/* RTL Support */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] body {
  font-family: "Alexandria", sans-serif;
}

[dir="rtl"] .rtl-rotate-180 {
  transform: rotate(180deg);
}

/* Layout Utilities */
.max-w-7xl {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

.px-5 {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

@media (min-width: 1024px) {
  .lg\:px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(219, 227, 223, 0.7);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-container {
  display: flex;
  height: 5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-logo {
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-text {
  display: none;
  line-height: 1.15;
}

@media (min-width: 640px) {
  .brand-text {
    display: block;
  }
}

.brand-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

[dir="rtl"] .brand-title {
  font-family: "Alexandria", sans-serif;
}

.brand-sub {
  display: block;
  max-width: 10rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.75rem;
}

@media (min-width: 1024px) {
  .nav-desktop {
    display: flex;
  }
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch {
  display: flex;
  height: 2.5rem;
  align-items: center;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  padding: 0.25rem;
}

.lang-btn {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--primary);
  border-radius: 2px;
  transition: all 0.2s;
}

.lang-btn.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.lang-btn:not(.active):hover {
  background-color: var(--secondary-hover);
}

/* Button Variants */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-cta {
  background-color: var(--accent);
  color: var(--accent-foreground);
  height: 2.75rem;
  padding: 0 1.25rem;
}

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

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  height: 2.75rem;
  padding: 0 1.25rem;
}

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

.btn-lg {
  height: 3.25rem;
  padding: 0 1.75rem;
  font-size: 1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 0 0.5rem;
  height: 2.25rem;
}

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

.btn-icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-cta-header {
  display: none;
}

@media (min-width: 768px) {
  .btn-cta-header {
    display: inline-flex;
  }
}

.mobile-menu-toggle {
  display: flex;
}

@media (min-width: 1024px) {
  .mobile-menu-toggle {
    display: none;
  }
}

.nav-mobile {
  border-top: 1px solid var(--border);
  background-color: var(--background);
  padding: 1rem 1.25rem;
  display: none;
}

.nav-mobile.open {
  display: block;
}

.nav-mobile-link {
  display: block;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  font-weight: 600;
  color: var(--primary);
  transition: color 0.2s;
}

.nav-mobile-link:hover {
  color: var(--accent);
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 88svh;
  padding-top: 5rem;
  display: flex;
  align-items: center;
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.05));
}

[dir="rtl"] .hero-overlay {
  background: linear-gradient(to left, #ffffff, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.05));
}

.hero-content {
  position: relative;
  z-index: 3;
  width: 100%;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.hero-inner {
  max-width: 42rem;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.kicker-line {
  display: inline-block;
  height: 1px;
  width: 2.25rem;
  background-color: var(--accent);
}

.hero-title {
  max-width: 36rem;
  font-size: 3.75rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.9;
  color: var(--primary);
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 4.5rem;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 6rem;
  }
}

.hero-subtitle {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}

[dir="rtl"] .hero-subtitle {
  font-family: "Alexandria", sans-serif;
}

@media (min-width: 640px) {
  .hero-subtitle {
    font-size: 2.25rem;
  }
}

.hero-body {
  margin-top: 1.5rem;
  max-width: 32rem;
  font-size: 1rem;
  line-height: 2;
  color: rgba(28, 53, 42, 0.75);
}

/* Sections Common */
.section-py {
  padding-top: 6rem;
  padding-bottom: 6rem;
}

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

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

/* Section Title */
.section-header-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-header-title {
  max-width: 48rem;
  font-size: 2.25rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1;
  color: var(--primary);
}

@media (min-width: 640px) {
  .section-header-title {
    font-size: 3rem;
  }
}

/* About Section */
.about-grid {
  display: grid;
  gap: 3.5rem;
}

@media (min-width: 1024px) {
  .about-grid {
    grid-template-columns: 1.05fr 1fr;
  }
}

.about-intro {
  border-inline-start: 4px solid var(--primary);
  padding-inline-start: 2rem;
}

.about-text {
  margin-top: 1.75rem;
  font-size: 1.125rem;
  line-height: 2;
  color: var(--muted-foreground);
}

.pillars-grid {
  display: grid;
  gap: 1px;
  background-color: var(--border);
}

@media (min-width: 640px) {
  .pillars-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

.pillar-card {
  background-color: var(--background);
  padding: 1.5rem;
}

.pillar-num {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--accent);
}

[dir="rtl"] .pillar-num {
  font-family: "Alexandria", sans-serif;
}

.pillar-title {
  margin-top: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.pillar-body {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--muted-foreground);
}

/* Programs Section */
.programs-grid {
  margin-top: 3rem;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .programs-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.program-card {
  border: 1px solid var(--border);
  background-color: var(--card);
  overflow: hidden;
  transition: border-color 0.2s;
}

.program-card:hover {
  border-color: var(--primary);
}

.program-media {
  position: relative;
  height: 14rem;
  overflow: hidden;
}

.program-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.program-card:hover .program-img {
  transform: scale(1.05);
}

.program-badge {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.program-content {
  padding: 1.5rem;
}

.program-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.program-title {
  margin-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.program-body {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--muted-foreground);
}

/* Schedule Section */
.table-wrapper {
  margin-top: 3rem;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.schedule-table {
  width: 100%;
  min-width: 50rem;
  border-collapse: collapse;
  text-align: start;
}

.schedule-table thead {
  background-color: var(--primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--primary-foreground);
}

.schedule-table th {
  padding: 1rem 1.5rem;
  text-align: start;
  font-weight: 700;
}

.schedule-table td {
  padding: 1.25rem 1.5rem;
  font-size: 0.875rem;
}

.schedule-table tbody tr:nth-child(even) {
  background-color: var(--secondary);
}

.schedule-table tbody tr:nth-child(odd) {
  background-color: var(--background);
}

.td-day {
  border-inline-start: 4px solid var(--accent);
  font-weight: 800;
  white-space: nowrap;
  color: var(--accent);
}

.td-session {
  font-weight: 600;
  color: var(--primary);
}

.td-time-val {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--primary);
  direction: ltr;
}

.td-time-val svg {
  color: var(--accent);
  flex-shrink: 0;
}

.td-remark {
  color: var(--muted-foreground);
}

/* Contact Section */
.contact-grid {
  display: grid;
  gap: 3.5rem;
}

@media (min-width: 1024px) {
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.contact-body {
  margin-top: 1.5rem;
  max-width: 36rem;
  line-height: 1.75;
  color: var(--muted-foreground);
}

.reps-heading {
  margin-top: 2.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.reps-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .reps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.contact-card {
  border: 1px solid var(--border);
  padding: 1.25rem;
  transition: border-color 0.2s;
  display: block;
}

.contact-card:hover {
  border-color: var(--primary);
}

.rep-name {
  display: block;
  font-weight: 700;
  color: var(--primary);
}

.rep-phone {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.rep-phone svg {
  color: var(--accent);
}

.location-box {
  margin-top: 2rem;
  border-inline-start: 4px solid var(--accent);
  background-color: var(--secondary);
  padding: 1.5rem;
}

.location-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.location-place {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--primary);
}

.location-place svg {
  color: var(--accent);
}

.location-link {
  margin-top: 0.75rem;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
}

.location-link:hover {
  text-decoration: underline;
}

/* Contact Form */
.contact-form {
  border: 1px solid var(--border);
  background-color: var(--secondary);
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .contact-form {
    padding: 2.25rem;
  }
}

.form-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sm-col-span-2 {
    grid-column: span 2 / span 2;
  }
}

.form-label {
  display: block;
}

.form-label-text {
  margin-bottom: 0.5rem;
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
}

.form-input, .form-textarea {
  width: 100%;
  border: 1px solid var(--input);
  background-color: var(--background);
  padding: 0.75rem 1rem;
  outline: none;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: border-color 0.2s, box-shadow 0.2s;
  border-radius: 0;
}

.form-input {
  height: 3rem;
}

.form-textarea {
  resize: none;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.btn-form-submit {
  width: 100%;
  margin-top: 1.5rem;
}

.btn-form-submit.submitted {
  background-color: var(--primary);
}

/* Footer */
.site-footer {
  background-color: var(--primary);
  padding-top: 3rem;
  padding-bottom: 3rem;
  color: var(--primary-foreground);
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-container {
    flex-direction: row;
    text-align: start;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-logo {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 2px;
  background-color: var(--background);
  object-fit: contain;
  padding: 0.25rem;
}

.footer-brand-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

[dir="rtl"] .footer-brand-title {
  font-family: "Alexandria", sans-serif;
}

.footer-tagline {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.footer-phones {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
}

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

.footer-bullet {
  margin-left: 0.75rem;
  margin-right: 0.75rem;
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 768px) {
  .footer-right {
    align-items: flex-end;
  }
}

.footer-lang-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.footer-lang-btn {
  height: 1.75rem;
  padding: 0 0.5rem;
  border: none;
  background: transparent;
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.2s;
}

.footer-lang-btn:hover {
  color: var(--accent);
}

.footer-copyright {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

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