*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #F7941D; --orange-dark: #d97b0e; --orange-light: #fff4e6;
  --dark: #1a1a1a; --dark2: #2d2d2d; --gray: #64748b; --light: #f8f8f8; --white: #ffffff;
}
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; color: var(--dark); background: var(--white); }

/* ── ACCESSIBILITY WIDGET ── */
#a11y-widget {
  position: fixed; bottom: 24px; left: 24px; z-index: 9999;
  font-family: 'Inter', sans-serif;
  display: block !important;
}
#a11y-trigger {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--orange); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background 0.2s, transform 0.2s;
}
#a11y-trigger:hover, #a11y-trigger.active { background: var(--orange-dark); transform: scale(1.08); }

#a11y-panel {
  position: absolute; bottom: 64px; left: 0;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 240px; overflow: hidden;
  border: 1px solid #e5e7eb;
}
.a11y-header {
  background: var(--dark); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; font-weight: 600;
}
.a11y-header button {
  background: none; border: none; color: rgba(255,255,255,0.7);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 4px;
}
.a11y-header button:hover { color: #fff; }
.a11y-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.a11y-section { background: #f9fafb; border-radius: 8px; padding: 10px 12px; }
.a11y-label { font-size: 0.72rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.a11y-row span { font-size: 0.82rem; font-weight: 600; color: var(--dark); }
.a11y-btn {
  background: #fff; border: 1.5px solid #e5e7eb; border-radius: 6px;
  padding: 5px 10px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; color: var(--dark); transition: border-color 0.15s;
}
.a11y-btn:hover { border-color: var(--orange); color: var(--orange); }
.a11y-toggle {
  width: 100%; text-align: left; background: #f9fafb;
  border: 1.5px solid #e5e7eb; border-radius: 8px;
  padding: 9px 12px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; color: var(--dark); transition: border-color 0.15s, background 0.15s;
}
.a11y-toggle:hover { border-color: var(--orange); }
.a11y-toggle.on { background: var(--orange-light); border-color: var(--orange); color: var(--orange-dark); }
.a11y-reset {
  width: 100%; background: none; border: none;
  font-size: 0.78rem; color: #9ca3af; cursor: pointer;
  padding: 4px; text-align: center; transition: color 0.15s;
}
.a11y-reset:hover { color: var(--dark); }

/* Accessibility body classes */
.a11y-high-contrast { filter: contrast(1.6) !important; }
.a11y-grayscale { filter: grayscale(1) !important; }
.a11y-high-contrast.a11y-grayscale { filter: contrast(1.6) grayscale(1) !important; }
.a11y-underline-links a { text-decoration: underline !important; }
.a11y-dyslexia, .a11y-dyslexia * { font-family: 'Arial', sans-serif !important; letter-spacing: 0.05em !important; line-height: 1.8 !important; }

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(26,26,26,0.97); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5%; height: 84px;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo img { height: 68px; width: auto; }
.logo-text { color: white; font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.logo-text span { color: var(--orange); font-size: 0.72rem; font-weight: 400; display: block; }
.nav-links { display: flex; gap: 4px; list-style: none; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: rgba(255,255,255,0.75); font-size: 0.82rem; font-weight: 500;
  padding: 7px 11px; border-radius: 6px; transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--orange); background: rgba(247,148,29,0.1); }
.nav-cta { background: var(--orange) !important; color: var(--dark) !important; font-weight: 700 !important; border-radius: 8px !important; }
.nav-cta:hover { background: var(--orange-dark) !important; }

/* PAGE HEADER */
.page-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1f0a 100%);
  padding: 140px 5% 60px; text-align: center;
}
.page-header h1 { color: white; font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; margin-bottom: 12px; }
.page-header p { color: rgba(255,255,255,0.6); font-size: 1rem; }
.page-header .section-label { margin-bottom: 16px; }

/* GENERAL */
.section-label {
  display: inline-block; color: var(--orange); font-size: 0.78rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px;
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.container { max-width: 1100px; margin: 0 auto; padding: 80px 5%; }

/* CARD */
.card {
  background: white; border-radius: 14px; padding: 28px;
  border: 1px solid #e8e8e8; margin-bottom: 16px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(247,148,29,0.15);
  border-color: var(--orange);
}
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; color: var(--dark); }
.card .meta { color: var(--orange); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.card p { color: var(--gray); font-size: 0.9rem; line-height: 1.6; }
.card a.doc-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--orange); font-size: 0.85rem; font-weight: 600;
  text-decoration: none; margin-top: 10px;
}
.card a.doc-link:hover { text-decoration: underline; }

/* CERT BAR */
.cert-bar {
  background: var(--dark); padding: 24px 5%;
  display: flex; align-items: center; justify-content: center; gap: 48px; flex-wrap: wrap;
}
.cert-bar span { color: rgba(255,255,255,0.4); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 2px; }
.cert-badge {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: white; padding: 6px 16px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
}

/* FOOTER */
footer { background: #111; color: rgba(255,255,255,0.5); padding: 40px 5% 28px; }
.footer-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 32px; padding-bottom: 32px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-logo img { height: 44px; }
.footer-logo p { color: rgba(255,255,255,0.45); font-size: 0.8rem; margin-top: 10px; max-width: 280px; line-height: 1.6; }
.footer-info { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; }
.footer-info strong { color: rgba(255,255,255,0.7); }
.footer-bottom { display: flex; justify-content: space-between; padding-top: 24px; font-size: 0.8rem; flex-wrap: wrap; gap: 12px; }

/* ── HAMBURGER BUTTON ── */
.nav-hamburger {
  display: none;
  background: none; border: none; color: white;
  font-size: 1.6rem; cursor: pointer; padding: 8px; line-height: 1;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Desktop explicit – hamburger ascuns, linkuri vizibile */
@media (min-width: 769px) {
  .nav-hamburger { display: none !important; }
  .nav-links { display: flex !important; }
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  nav { height: 64px; padding: 0 4%; }
  .logo img { height: 48px; }
  .nav-hamburger { display: flex !important; align-items: center; }

  .nav-links {
    display: none;
    position: fixed; top: 64px; left: 0; right: 0;
    background: rgba(22,22,22,0.99);
    flex-direction: column; gap: 0;
    padding: 8px 0 16px;
    max-height: calc(100vh - 64px); overflow-y: auto;
    z-index: 500; border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav-links.open { display: flex !important; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block; padding: 13px 5%;
    border-radius: 0; font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .nav-cta { margin: 8px 5% 0 !important; border-radius: 8px !important; text-align: center; }

  .page-header { padding: 96px 4% 36px; }
  .page-header h1 { font-size: 1.8rem; }

  .container { padding: 40px 4%; }

  .card { padding: 18px; }
  .card h3 { font-size: 1rem; }

  .cert-bar { gap: 10px; padding: 20px 4%; justify-content: flex-start; }

  .footer-top { flex-direction: column; gap: 20px; }
  .footer-bottom { flex-direction: column; gap: 6px; }
}

/* ── EXTRA MOBILE – grids & tables ── */
@media (max-width: 768px) {
  /* Force single column on all auto-fill grids */
  [style*="grid-template-columns"],
  .dotari-grid,
  .decl-grid {
    grid-template-columns: 1fr !important;
  }

  /* Flex rows → stack */
  [style*="display:flex"],
  [style*="display: flex"] {
    flex-wrap: wrap !important;
  }

  /* Year toggles full width */
  .year-toggle, .sec-toggle, .arch-person-hdr {
    padding: 12px 16px;
  }

  /* Hist rows wrap nicely */
  .hist-row { flex-wrap: wrap; gap: 6px; }
  .hist-row .yr { min-width: auto; }

  /* Person/decl cards full width */
  .person-card, .decl-card {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Dotari 2-col back to 1 col on very small */
  .category-body[style*="columns:2"] {
    columns: 1 !important;
  }

  /* Arch person header stacks */
  .arch-person-hdr { flex-wrap: wrap; gap: 6px; }
  .arch-period { align-self: flex-start; }

  /* Plan administrare cards stack */
  .card[style*="min-width:260px"] {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Page header smaller */
  .page-header { padding: 80px 4% 28px; }
  .page-header h1 { font-size: 1.5rem; }

  .container { padding: 32px 4%; }

  /* Footer */
  .cert-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
