/* =========================================================
   CSCCR — Comité de Seguridad Comunitaria
   Portal de control de acceso al Centro Israelita Sionista
   ========================================================= */

:root {
  /* Brand colors (extracted from official CSC logo SVG) */
  --csc-blue: #0071CE;
  --csc-navy: #001689;
  --csc-blue-hover: #005EAC;

  /* Text */
  --text-primary: #0E1538;
  --text-body: #383840;
  --text-muted: #6B7280;

  /* Surfaces & borders */
  --bg-white: #FFFFFF;
  --bg-subtle: #F7F9FC;
  --border-light: #E5E7EB;
  --border-medium: #D5DAE2;

  /* Spacing scale (4px-based) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 40px;
  --s-8: 48px;
  --s-10: 64px;
  --s-12: 80px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;

  /* Layout */
  --max-content: 760px;
  --max-header: 1100px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-hebrew: "SF Hebrew", "Arial Hebrew", "Frank Ruehl CLM", "David", system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

html[lang="he"] body,
html[dir="rtl"] body {
  font-family: var(--font-hebrew);
}

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

a {
  color: var(--csc-blue);
  text-decoration: none;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p { margin: 0; }

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--csc-blue);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ========== HEADER ========== */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-header);
  margin: 0 auto;
  padding: var(--s-4) var(--s-6);
  display: flex;
  align-items: center;
  gap: var(--s-5);
}

.logo-link {
  display: block;
  flex-shrink: 0;
}

.logo-link:focus-visible {
  outline-offset: 6px;
}

.logo-lockup {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}

.logo-csc {
  height: 54px;
  width: auto;
  flex-shrink: 0;
}

.logo-divider {
  width: 1px;
  height: 40px;
  background: var(--border-medium);
  display: block;
  flex-shrink: 0;
}

.logo-cis {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.9;
}

.lang-switch {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.lang-switch:hover { color: var(--csc-navy); }

/* ========== HEADER NAV (Eventos + lang-switch wrapper) ========== */
.header-nav {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--s-5);
}

.nav-eventos {
  color: var(--csc-blue);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav-eventos:hover { color: var(--csc-navy); }

/* ========== MAIN ========== */
.page-main {
  flex: 1;
  padding: var(--s-10) var(--s-6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.content {
  width: 100%;
  max-width: var(--max-content);
}

.page-title {
  font-size: 28px;
  font-weight: 500;
  color: var(--csc-navy);
  letter-spacing: -0.02em;
  margin-bottom: var(--s-3);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--s-8);
}

.page-body {
  font-size: 17px;
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: var(--s-8);
  max-width: 640px;
}

/* ========== HOME — LANGUAGE SELECTOR ========== */
.language-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
}

.language-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-6) var(--s-4);
  background: var(--bg-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-lg);
  color: var(--csc-navy);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
  min-height: 110px;
  gap: var(--s-2);
}

.language-card:hover {
  border-color: var(--csc-blue);
  background: var(--bg-subtle);
}

.language-card:active { transform: translateY(1px); }

.language-code {
  font-size: 11px;
  color: var(--csc-blue);
  letter-spacing: 1.5px;
  font-weight: 500;
}

.language-name {
  font-size: 18px;
  font-weight: 500;
}

/* ========== CTA BUTTON (used on language pages) ========== */
.cta-button {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  background: var(--csc-blue);
  color: var(--bg-white);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--r-md);
  transition: background-color 0.15s ease, transform 0.15s ease;
  letter-spacing: 0.01em;
}

.cta-button:hover { background: var(--csc-blue-hover); }
.cta-button:active { transform: translateY(1px); }

.cta-arrow {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}

/* In RTL, flip the arrow to point in the reading direction */
html[dir="rtl"] .cta-arrow { transform: scaleX(-1); }

/* ========== EVENTOS — FORM GRID ========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}

.form-card {
  display: flex;
  flex-direction: column;
  padding: var(--s-6);
  background: var(--bg-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-lg);
  color: var(--text-body);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
  min-height: 180px;
}

.form-card:hover {
  border-color: var(--csc-blue);
  background: var(--bg-subtle);
}

.form-card:active { transform: translateY(1px); }

.form-card-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--csc-navy);
  margin-bottom: var(--s-3);
}

.form-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: var(--s-5);
}

.form-card-cta {
  font-size: 14px;
  color: var(--csc-blue);
  font-weight: 500;
  align-self: flex-start;
}

/* ========== RESPONSIVE — TABLET ========== */
@media (max-width: 768px) {
  .header-inner {
    padding: var(--s-3) var(--s-4);
    gap: var(--s-3);
  }

  .page-main { padding: var(--s-8) var(--s-4); }
  .page-title { font-size: 24px; }
  .page-body { font-size: 16px; }
}

/* ========== RESPONSIVE — MOBILE ========== */
@media (max-width: 540px) {
  .header-inner {
    padding: var(--s-3) var(--s-4);
    gap: var(--s-3);
    flex-wrap: wrap;
  }

  .logo-csc { height: 42px; }
  .logo-cis { height: 28px; }
  .logo-divider { height: 32px; }
  .logo-lockup { gap: var(--s-4); }

  .lang-switch {
    font-size: 12px;
  }

  .header-nav {
    margin-inline-start: 0;
    width: 100%;
    padding-top: var(--s-2);
    border-top: 1px solid var(--border-light);
    margin-top: var(--s-1);
    justify-content: flex-end;
    gap: var(--s-4);
  }

  .page-main { padding: var(--s-6) var(--s-4); }

  .page-title { font-size: 22px; }
  .page-body { font-size: 16px; }

  .language-grid {
    grid-template-columns: 1fr;
    gap: var(--s-2);
  }

  .language-card {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--s-5);
    min-height: 60px;
    padding: var(--s-4) var(--s-5);
  }

  .language-code { margin-bottom: 0; min-width: 22px; }
  .language-name { font-size: 17px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-card { min-height: auto; }
}

/* ========== V2 — Background enhancement ========== */
body {
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF5FB 100%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  bottom: -140px;
  right: -140px;
  width: 520px;
  height: 520px;
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%230071CE' stroke-opacity='0.10' stroke-width='2'%3E%3Cpolygon points='50,8 90,72 10,72'/%3E%3Cpolygon points='50,92 10,28 90,28'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  pointer-events: none;
  z-index: -1;
}

/* Mirror watermark to the left for RTL */
html[dir="rtl"] body::before {
  right: auto;
  left: -140px;
}

.site-header {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ========== FOOTER ========== */
.site-footer {
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.footer-inner {
  max-width: var(--max-header);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.footer-link {
  color: var(--csc-blue);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.footer-link:hover { color: var(--csc-navy); }

.footer-text {
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 540px) {
  .site-footer { padding: var(--s-3) var(--s-4); }
  .footer-inner { gap: var(--s-2); }
  .footer-text { font-size: 11px; }

  body::before {
    width: 300px;
    height: 300px;
    bottom: -80px;
    right: -80px;
  }
  html[dir="rtl"] body::before { left: -80px; }
}
