:root {
  --bg: #fafbfc;
  --panel: #ffffff;
  --panel2: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --light: #94a3b8;
  --border: rgba(0,0,0,.08);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --link: #2563eb;
  --teal: #0d9488;
  --emerald: #10b981;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-lg: 20px;
  --max: 960px;
  --focus: 0 0 0 3px rgba(59,130,246,.3);
  --transition: 0.2s ease;
}

/* CSS Reset / Normalize for cross-browser consistency */
*, *::before, *::after { 
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html, body { 
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background: #fafbfc; /* Fallback */
  background: -webkit-linear-gradient(315deg, #f0f9ff 0%, #fafbfc 50%, #f0fdf4 100%);
  background: linear-gradient(135deg, #f0f9ff 0%, #fafbfc 50%, #f0fdf4 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ensure images and media are responsive */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}

/* Inherit fonts for form elements */
input, button, textarea, select {
  font: inherit;
}

/* Remove animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    -webkit-animation-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    -webkit-animation-iteration-count: 1 !important;
    animation-iteration-count: 1 !important;
    -webkit-transition-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Links */
a { 
  color: var(--link); 
  text-decoration: none;
  -webkit-transition: color var(--transition);
  transition: color var(--transition);
}
a:hover { 
  color: var(--accent-hover);
}

/* Container */
.container { 
  max-width: var(--max); 
  margin: 0 auto; 
  padding: 0 24px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
  z-index: 100;
}

/* Header */
header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {
  header {
    background: rgba(255,255,255,.98);
  }
}
.header-inner {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 80px;
  height: 80px;
  border-radius: 14px;
  background-color: var(--panel);
  background-image: url("./logo.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border: 1px solid var(--border);
  -webkit-box-shadow: var(--shadow-sm);
  box-shadow: var(--shadow-sm);
  -webkit-flex-shrink: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand p {
  margin: 0;
  font-size: 12px;
  color: var(--light);
  font-weight: 400;
}

/* Navigation */
nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 4px;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.navlink {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  -webkit-transition: all var(--transition);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.navlink:hover {
  color: var(--text);
  background: rgba(0,0,0,.03);
  text-decoration: none;
}
.navlink[aria-current="page"] {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
  -webkit-box-shadow: var(--shadow-sm);
  box-shadow: var(--shadow-sm);
}

/* Language selector */
.lang {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  position: relative;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-left: 8px;
}
.lang .small {
  /* Visually hidden, but available to assistive technologies */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
select {
  background: transparent;
  color: var(--text);
  border: 0;
  outline: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding-right: 4px;
}

/* Main content */
main {
  padding: 32px 0 60px;
  min-height: calc(100vh - 200px);
}

/* Hero section */
.hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.hero h2 {
  margin: 12px 0 16px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
}
.hero > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  max-width: 680px;
}

/* Notice badge */
.notice {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(16,185,129,.1); /* Fallback */
  background: -webkit-linear-gradient(315deg, rgba(16,185,129,.1) 0%, rgba(59,130,246,.1) 100%);
  background: linear-gradient(135deg, rgba(16,185,129,.1) 0%, rgba(59,130,246,.1) 100%);
  border: 1px solid rgba(16,185,129,.2);
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Callout */
.callout {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--panel2);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--muted);
}
.callout strong {
  color: var(--text);
  font-weight: 600;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .grid { grid-template-columns: 1fr 1fr }
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  -webkit-transition: box-shadow var(--transition), -webkit-transform var(--transition);
  transition: box-shadow var(--transition), transform var(--transition);
}

/* Lists inside cards (global reset removes markers) */
.card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  list-style: disc;
}
.card li {
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.6;
}
.card:hover {
  -webkit-box-shadow: var(--shadow);
  box-shadow: var(--shadow);
  -webkit-transform: translateY(-2px);
  -ms-transform: translateY(-2px);
  transform: translateY(-2px);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Sections */
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.section h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.section ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  list-style: disc;
}
.section li {
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.6;
}
.section li strong {
  color: var(--text);
  font-weight: 500;
}

/* Separator */
hr.sep {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* Quick links (kv) */
.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .kv { grid-template-columns: 1fr 1fr }
}
.kv .item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  -webkit-transition: all var(--transition);
  transition: all var(--transition);
}
.kv .item:hover {
  border-color: var(--accent);
  -webkit-box-shadow: var(--shadow);
  box-shadow: var(--shadow);
}
.kv .item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.kv .item .small {
  color: var(--muted);
  line-height: 1.5;
}
.kv .item a {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  -webkit-transition: gap var(--transition);
  transition: gap var(--transition);
}
.kv .item a:hover {
  gap: 8px;
}

/* Templates */
.template {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  margin-bottom: 16px;
}
.template-head {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}
.template-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Buttons */
button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  -webkit-transition: all var(--transition);
  transition: all var(--transition);
}
button:hover {
  background: var(--panel2);
  border-color: var(--accent);
}
button:focus {
  outline: none;
  box-shadow: var(--focus);
}
button.secondary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.secondary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Textarea */
textarea {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  resize: vertical;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
}
textarea:focus { outline: none }

/* Utility classes */
.small {
  font-size: 12px;
  color: var(--muted);
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  color: var(--light);
  font-size: 13px;
  text-align: center;
}

/* RTL support */
.rtl { direction: rtl }
.rtl nav { justify-content: flex-start }
.rtl .brand { flex-direction: row-reverse }
.rtl .header-inner { flex-direction: row-reverse }
.rtl .template-head { flex-direction: row-reverse }
.rtl .callout { 
  border-left: 0;
  border-right: 3px solid var(--teal);
  border-radius: var(--radius) 0 0 var(--radius);
}
.rtl .section ul { padding-left: 0; padding-right: 20px }

/* Mobile responsive */
@media (max-width: 767px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  nav {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .navlink {
    padding: 6px 10px;
    font-size: 13px;
  }
  .lang { margin-left: 0 }
  .hero {
    padding: 24px;
  }
  .hero h2 {
    font-size: 22px;
  }
  .card, .section, .kv .item {
    padding: 18px;
  }
  
  /* RTL mobile */
  .rtl .header-inner {
    align-items: flex-end;
  }
  .rtl nav {
    justify-content: flex-end;
  }
}

/* Print styles */
@media print {
  header { position: static; background: #fff }
  .skip-link, nav, .lang, button { display: none }
  body { background: #fff }
  .card, .section, .hero { box-shadow: none; border: 1px solid #ddd }
}
