/* ============================================
   normalornot.net — Global Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #08080f;
  --bg-card: #0d0d1a;
  --bg-card-hover: #111125;
  --border-color: #1a1a2e;
  --border-light: #252540;
  --text-primary: #e8e8e8;
  --text-secondary: #888888;
  --text-dim: #555555;
  --accent: #D85A30;
  --accent-hover: #e6693f;
  --accent-glow: rgba(216, 90, 48, 0.15);
  --success: #1D9E75;
  --warning: #E8A32E;
  --danger: #D84040;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-main: 'DM Sans', sans-serif;
  --transition-fast: 0.2s ease;
  --transition-med: 0.35s ease;
  --max-width: 1100px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

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

ul, ol {
  list-style: none;
}

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

.section {
  padding: 60px 0;
}

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p {
  color: var(--text-secondary);
  font-size: 1rem;
}

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

/* --- Header / Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
}

.logo-normal, .logo-not {
  color: var(--text-primary);
}

.logo-or {
  color: var(--accent);
}

.logo-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 6px;
}

/* Language Selector */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.lang-selector a {
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.lang-selector a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.lang-selector a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.lang-separator {
  color: var(--text-dim);
  opacity: 0.3;
  user-select: none;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 80px 0 40px;
}

.hero h1 {
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* --- Topic Cards Grid --- */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 40px 0 60px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-decoration: none;
  transition: all var(--transition-med);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.topic-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.topic-card:hover::before {
  opacity: 1;
}

.topic-card-emoji {
  font-size: 2rem;
  line-height: 1;
}

.topic-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topic-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.topic-card-arrow {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  opacity: 0;
  transform: translateX(-8px);
  transition: all var(--transition-med);
}

.topic-card:hover .topic-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 14px 32px;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(216, 90, 48, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--border-light);
  background: rgba(255,255,255,0.03);
}

.btn-sm {
  font-size: 0.85rem;
  padding: 10px 20px;
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* --- Slider Component --- */
.slider-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.slider-value-display {
  text-align: center;
  margin-bottom: 20px;
}

.slider-value-number {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.slider-value-unit {
  font-size: 1.2rem;
  color: var(--text-dim);
  margin-left: 8px;
}

.slider-track {
  position: relative;
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  position: relative;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(216, 90, 48, 0.4);
  transition: box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 20px rgba(216, 90, 48, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 10px rgba(216, 90, 48, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* --- Country Selector --- */
.country-detect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.country-flag {
  font-size: 1.3rem;
}

.country-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition-fast);
  max-width: 200px;
}

.country-select:hover,
.country-select:focus {
  border-color: var(--accent);
  outline: none;
}

[dir="rtl"] .country-select {
  padding: 6px 10px 6px 28px;
  background-position: left 10px center;
}

/* --- Results Section --- */
.results-section {
  display: none;
}

.results-section.visible {
  display: block;
  animation: fadeUp 0.5s ease forwards;
}

/* Percentile Score */
.percentile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 32px;
}

.percentile-number {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.percentile-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.percentile-detail {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 12px;
}

/* Bell Curve */
.bell-curve-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.bell-curve-container h3 {
  margin-bottom: 20px;
}

.bell-curve-svg {
  width: 100%;
  height: auto;
}

/* Country Bars */
.country-bars-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.country-bars-section h3 {
  margin-bottom: 24px;
}

.country-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards;
}

.country-bar-row .country-flag {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.country-bar-row .country-name {
  width: 110px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-bar-track {
  flex: 1;
  height: 28px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.country-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  min-width: 50px;
}

.bar-lower { background: var(--success); }
.bar-similar { background: var(--warning); }
.bar-higher { background: var(--danger); }
.bar-user { background: var(--accent); }

.country-bar-value {
  width: 50px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.show-more-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: rgba(255,255,255,0.02);
}

.data-source-note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Cultural Context --- */
.cultural-context {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.cultural-context h3 {
  margin-bottom: 20px;
}

.context-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.context-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.context-item strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.context-item p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Share Card --- */
.share-section {
  margin-bottom: 32px;
}

.share-card {
  background: linear-gradient(145deg, #0d0d1a 0%, #141428 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.share-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(216,90,48,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.share-card-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

.share-card-result {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.share-card-comparisons {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.7;
}

.share-card-brand {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}

.share-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* --- Other Topics --- */
.other-topics {
  padding: 40px 0;
}

.other-topics h3 {
  margin-bottom: 24px;
}

.other-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* --- SEO Content Section --- */
.seo-content {
  padding: 60px 0;
  border-top: 1px solid var(--border-color);
}

.seo-content h2 {
  margin-bottom: 20px;
}

.seo-content h3 {
  margin-top: 36px;
  margin-bottom: 12px;
}

.seo-content p {
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.75;
}

/* --- Data Table --- */
.data-table-section {
  padding: 40px 0;
}

.data-table-section h3 {
  margin-bottom: 20px;
}

.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table thead {
  background: rgba(255,255,255,0.03);
}

table.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr {
  transition: background var(--transition-fast);
}

table.data-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

table.data-table .table-source {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.table-hidden-rows {
  display: none;
}

.table-hidden-rows.visible {
  display: table-row-group;
}

/* --- FAQ Accordion --- */
.faq-section {
  padding: 40px 0;
}

.faq-section h2 {
  margin-bottom: 24px;
}

details.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all var(--transition-fast);
}

details.faq-item[open] {
  border-color: var(--border-light);
}

details.faq-item summary {
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

details.faq-item summary::-webkit-details-marker {
  display: none;
}

details.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

details.faq-item[open] summary::after {
  content: '−';
}

.faq-answer {
  padding: 0 24px 18px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 20px 0;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
}

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

.breadcrumb-sep {
  color: var(--text-dim);
  opacity: 0.4;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-secondary);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.footer-disclaimer {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* --- Cookie Banner --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 18px 24px;
  z-index: 200;
  display: none;
  animation: slideUp 0.3s ease;
}

.cookie-banner.visible {
  display: block;
}

.cookie-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 200px;
}

.cookie-text a {
  color: var(--accent);
  text-decoration: underline;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* --- Scroll To Top --- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 50;
  box-shadow: 0 4px 16px rgba(216, 90, 48, 0.3);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(216, 90, 48, 0.4);
}

/* --- Animations --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animation delays for country bars */
.country-bar-row:nth-child(1) { animation-delay: 0.05s; }
.country-bar-row:nth-child(2) { animation-delay: 0.1s; }
.country-bar-row:nth-child(3) { animation-delay: 0.15s; }
.country-bar-row:nth-child(4) { animation-delay: 0.2s; }
.country-bar-row:nth-child(5) { animation-delay: 0.25s; }
.country-bar-row:nth-child(6) { animation-delay: 0.3s; }
.country-bar-row:nth-child(7) { animation-delay: 0.35s; }
.country-bar-row:nth-child(8) { animation-delay: 0.4s; }
.country-bar-row:nth-child(9) { animation-delay: 0.45s; }
.country-bar-row:nth-child(10) { animation-delay: 0.5s; }
.country-bar-row:nth-child(11) { animation-delay: 0.55s; }
.country-bar-row:nth-child(12) { animation-delay: 0.6s; }
.country-bar-row:nth-child(13) { animation-delay: 0.65s; }
.country-bar-row:nth-child(14) { animation-delay: 0.7s; }
.country-bar-row:nth-child(15) { animation-delay: 0.75s; }
.country-bar-row:nth-child(16) { animation-delay: 0.8s; }
.country-bar-row:nth-child(17) { animation-delay: 0.85s; }
.country-bar-row:nth-child(18) { animation-delay: 0.9s; }
.country-bar-row:nth-child(19) { animation-delay: 0.95s; }
.country-bar-row:nth-child(20) { animation-delay: 1.0s; }

/* --- Two Column Layout (Topic Pages Desktop) --- */
.topic-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding: 40px 0;
}

.topic-input-panel {
  position: relative;
}

.topic-results-panel {
  min-width: 0;
}

/* --- RTL Support (Arabic) --- */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .navbar-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .breadcrumb {
  flex-direction: row-reverse;
}

[dir="rtl"] .breadcrumb-sep {
  transform: scaleX(-1);
}

[dir="rtl"] .country-bar-row {
  flex-direction: row-reverse;
}

[dir="rtl"] .country-bar-row .country-name {
  text-align: right;
}

[dir="rtl"] .country-bar-fill {
  justify-content: flex-start;
  padding-left: 10px;
  padding-right: 0;
}

[dir="rtl"] .country-bar-value {
  text-align: left;
}

[dir="rtl"] table.data-table th,
[dir="rtl"] table.data-table td {
  text-align: right;
}

[dir="rtl"] details.faq-item summary {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .topic-card-arrow {
  transform: translateX(8px) scaleX(-1);
}

[dir="rtl"] .topic-card:hover .topic-card-arrow {
  transform: translateX(0) scaleX(-1);
}

/* --- Responsive --- */
@media (min-width: 768px) {
  .topic-layout {
    grid-template-columns: 400px 1fr;
  }

  .topic-input-panel {
    position: sticky;
    top: 88px;
    align-self: start;
  }
}

@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }

  .navbar {
    padding: 0 16px;
  }

  .hero {
    padding: 48px 0 24px;
  }

  .topics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px 0 40px;
  }

  .topic-card {
    padding: 24px 20px;
  }

  .percentile-card {
    padding: 28px 20px;
  }

  .country-bars-section,
  .bell-curve-container,
  .cultural-context,
  .share-card {
    padding: 24px 16px;
  }

  .country-bar-row .country-name {
    width: 80px;
    font-size: 0.78rem;
  }

  .share-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

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

  .cookie-inner {
    flex-direction: column;
    text-align: center;
  }

  .cookie-buttons {
    width: 100%;
    justify-content: center;
  }

  .lang-selector {
    font-size: 0.7rem;
    gap: 2px;
  }

  .lang-selector a {
    padding: 4px 5px;
  }
}

@media (max-width: 400px) {
  .lang-selector .lang-separator {
    display: none;
  }
}

/* --- Noscript Fallback --- */
noscript .data-table-wrapper {
  display: block !important;
}

noscript .results-section {
  display: none !important;
}

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

.hidden {
  display: none !important;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
