/* ============================================================
   MAIN.CSS — Mobile-First Global Styles
   MindCheck | Mental Health Quiz Website
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --color-primary:    #2A9D8F;
  --color-primary-dk: #21867a;
  --color-accent:     #E9C46A;
  --color-dark:       #264653;
  --color-dark-soft:  #3d5a68;
  --color-text:       #1a1a2e;
  --color-text-muted: #6b7280;
  --color-bg:         #F8F9FA;
  --color-bg-card:    #ffffff;
  --color-border:     #e5e7eb;
  --color-success:    #10b981;
  --color-warn:       #f59e0b;
  --color-danger:     #ef4444;

  --font-base: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  32px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.1);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);

  --transition: 0.22s ease;
  --max-w:      480px;
  --sticky-h:   60px; /* sticky footer ad height */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  padding-bottom: var(--sticky-h);
  min-height: 100vh;
}
img, picture { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 1rem; }

/* ---------- Typography ---------- */
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.1rem, 3vw, 1.3rem); font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ---------- Layout Helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.container--wide { max-width: 960px; }
.section { padding-block: 2.5rem; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}
.logo svg { width: 28px; height: 28px; }
.nav-links {
  display: none; /* shown on desktop */
  gap: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--color-text-muted);
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--color-primary); }

/* Hamburger */
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.nav-toggle:hover { background: var(--color-bg); }
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--color-dark);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.nav-drawer {
  display: none;
  flex-direction: column;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  gap: 0.25rem;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  padding: 0.6rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition);
}
.nav-drawer a:last-child { border-bottom: none; }
.nav-drawer a:hover, .nav-drawer a.active { color: var(--color-primary); }
.lang-drawer a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.lang-drawer a:hover { color: var(--color-primary); }
.lang-drawer a:last-child { border-bottom: none; }

/* Language switcher (desktop) */
.lang-switcher {
  position: relative;
  margin-left: 0.5rem;
}
.lang-switcher__btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.lang-switcher__btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.lang-switcher__list {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 140px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none;
  padding: 0.35rem 0;
  z-index: 110;
}
.lang-switcher__list.lang-switcher__list--open { display: block; }
.lang-switcher__list a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text);
  transition: background var(--transition);
}
.lang-switcher__list a:hover { background: var(--color-bg); color: var(--color-primary); }
.lang-switcher__list a[aria-current="true"] { font-weight: 600; color: var(--color-primary); }
@media (max-width: 767px) {
  .lang-switcher { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  border: none;
  text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(42,157,143,.35);
}
.btn--primary:hover { background: var(--color-primary-dk); box-shadow: 0 6px 18px rgba(42,157,143,.4); }
.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn--secondary:hover { background: rgba(42,157,143,.08); }
.btn--dark {
  background: var(--color-dark);
  color: #fff;
}
.btn--dark:hover { background: var(--color-dark-soft); }
.btn--full { width: 100%; }
.btn--lg { min-height: 58px; font-size: 1.1rem; padding: 1rem 2rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card__body { padding: 1.5rem; }
.card__img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-primary) 100%);
  color: #fff;
  text-align: center;
  padding-block: 3.5rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.hero .container { position: relative; z-index: 1; }
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(4px);
  border-radius: 100px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.hero__title { margin-bottom: 1rem; color: #fff; }
.hero__sub {
  font-size: 1.05rem;
  opacity: 0.88;
  margin-bottom: 2rem;
  max-width: 38ch;
  margin-inline: auto;
}
.hero__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.75rem;
  font-size: 0.82rem;
  opacity: 0.75;
}
.hero__meta span { display: flex; align-items: center; gap: 0.3rem; }

/* ---------- Trust Bar ---------- */
.trust-bar {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding-block: 0.85rem;
  text-align: center;
}
.trust-bar__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 2rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}
.trust-bar__inner span { display: flex; align-items: center; gap: 0.35rem; }

/* ---------- Section Headings ---------- */
.section-heading {
  text-align: center;
  margin-bottom: 2rem;
}
.section-heading h2 { color: var(--color-dark); margin-bottom: 0.5rem; }
.section-heading p  { color: var(--color-text-muted); font-size: 0.95rem; }

/* ---------- Quiz Cards (home) ---------- */
.quiz-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.quiz-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.quiz-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.quiz-card__banner {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.quiz-card__body { padding: 1.25rem; }
.quiz-card__tag {
  display: inline-block;
  background: rgba(42,157,143,.12);
  color: var(--color-primary);
  border-radius: 100px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.quiz-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.quiz-card__meta { font-size: 0.8rem; color: var(--color-text-muted); }

/* ---------- Benefits / Feature List ---------- */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.feature-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.feature-item__icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: rgba(42,157,143,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.feature-item__text h4 { margin-bottom: 0.15rem; }
.feature-item__text p  { font-size: 0.88rem; color: var(--color-text-muted); margin: 0; }

/* ---------- Ad Slots ---------- */
/* Reserve fixed space from first paint so layout never shifts when an ad loads or has no fill */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-inline: auto;
  flex-shrink: 0;
  box-sizing: border-box;
}
.ad-slot--rect {
  width: 300px;
  height: 250px;
  min-width: 300px;
  min-height: 250px;
}
.ad-slot--footer {
  width: 300px;
  height: 50px;
  min-width: 300px;
  min-height: 50px;
}
/* Keep ad iframe/ins from collapsing; slot size stays fixed even with no fill */
.ad-slot--rect .adsbygoogle {
  min-width: 300px;
  min-height: 250px;
  display: block;
}
.ad-slot--footer .adsbygoogle {
  min-width: 300px;
  min-height: 50px;
  display: block;
}
.ad-slot-wrap {
  display: flex;
  justify-content: center;
  padding-block: 1rem;
  min-height: 0;
}

/* Sticky footer ad */
.sticky-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--sticky-h);
  padding-block: 5px;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
}
/* sticky ad close button removed — ad is always visible */

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-dark);
  color: rgba(255,255,255,.75);
  padding-block: 2.5rem 1.5rem;
  font-size: 0.875rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-brand .logo { color: #fff; margin-bottom: 0.75rem; }
.footer-brand p { font-size: 0.85rem; opacity: 0.7; }
.footer-col h4 { color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.85rem; }
.footer-col a {
  display: block;
  color: rgba(255,255,255,.65);
  padding-block: 0.3rem;
  font-size: 0.85rem;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--color-primary); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  opacity: 0.6;
}
.footer-links { display: flex; gap: 1rem; }

/* ---------- Badges / Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge--green  { background: rgba(16,185,129,.12); color: #059669; }
.badge--yellow { background: rgba(245,158,11,.12);  color: #d97706; }
.badge--red    { background: rgba(239,68,68,.12);   color: #dc2626; }
.badge--blue   { background: rgba(42,157,143,.12);  color: var(--color-primary); }

/* ---------- Form Elements ---------- */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-dark);
}
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(42,157,143,.15);
}
textarea.form-control { resize: vertical; min-height: 120px; }

/* ---------- Alert / Notice ---------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.alert--info { background: rgba(42,157,143,.1); color: var(--color-primary-dk); }
.alert--warn { background: rgba(245,158,11,.1);  color: #92400e; }

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--color-border);
  margin-block: 2rem;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding-block: 0.75rem;
}
.breadcrumb a { color: var(--color-primary); }
.breadcrumb__sep { opacity: 0.4; }

/* ---------- Blog Card ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.blog-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: block;
  color: inherit;
  text-decoration: none;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.blog-card__img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--color-dark), var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.blog-card__body { padding: 1.25rem; }
.blog-card__date { font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 0.4rem; }
.blog-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--color-dark); }
.blog-card__excerpt { font-size: 0.875rem; color: var(--color-text-muted); }

/* ---------- Page Header ---------- */
.page-header {
  background: linear-gradient(135deg, var(--color-dark) 0%, #1e6b7a 100%);
  color: #fff;
  padding-block: 2.5rem;
  text-align: center;
}
.page-header h1 { color: #fff; margin-bottom: 0.5rem; }
.page-header p { opacity: 0.8; font-size: 0.95rem; }

/* ---------- Scroll to top ---------- */
.scroll-top {
  position: fixed;
  bottom: calc(var(--sticky-h) + 12px);
  right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 150;
  border: none;
  font-size: 1rem;
}
.scroll-top.visible { opacity: 1; transform: translateY(0); }

/* ---------- Skip link (a11y) ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 9999;
  border-radius: 0 0 var(--radius-sm) 0;
  font-size: 0.875rem;
}
.skip-link:focus { top: 0; }

/* ---------- Responsive Overrides ---------- */
@media (min-width: 480px) {
  .quiz-grid { grid-template-columns: 1fr 1fr; }
  .blog-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Desktop: Force Mobile-View Frame ---------- */
/* On screens wider than 520px, show the site as a centered 480px phone frame */
@media (min-width: 520px) {
  html {
    background: #c8d0d8;
    background-image: linear-gradient(160deg, #d8dfe6 0%, #b8c4ce 100%);
    min-height: 100%;
  }

  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 8px 80px rgba(0,0,0,.22);
    position: relative;
  }

  /* Constrain sticky footer ad to the 480px frame */
  .sticky-ad {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 480px;
    max-width: 100vw;
  }

  /* Align scroll-to-top button to right edge of the frame */
  .scroll-top {
    right: calc(50% - 224px); /* 480/2 - 40/2 + 8 = 216 ≈ right edge */
  }
}

/* ---------- RTL (e.g. Arabic) ---------- */
[dir="rtl"] .lang-switcher { margin-left: 0; margin-right: 0.5rem; }
[dir="rtl"] .lang-switcher__list { right: auto; left: 0; }
[dir="rtl"] .answer-btn:hover { transform: translateX(-3px); }
[dir="rtl"] .breadcrumb__sep { transform: scaleX(-1); }
[dir="rtl"] .scroll-top { right: auto; left: 16px; }
@media (min-width: 520px) {
  [dir="rtl"] .scroll-top { left: calc(50% - 224px); right: auto; }
}
