/* Daily Auto News — shared UI (responsive, accessible) */
:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --shadow-card: 0 4px 6px -1px rgb(15 23 42 / 0.06), 0 12px 24px -8px rgb(15 23 42 / 0.08);
  --shadow-card-hover: 0 20px 40px -12px rgb(15 23 42 / 0.12);
  --header-h: 4rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  background-color: var(--color-bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgb(237 233 254 / 0.5), transparent 50%);
  color: var(--color-text);
  overflow-x: clip;
  scroll-behavior: smooth;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.glass-nav {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow-card);
}

.page-view {
  display: none;
}
.page-view.active {
  display: block;
  animation: fadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.text-gradient {
  background: linear-gradient(135deg, #4f46e5, #db2777);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.news-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  border-radius: var(--radius-2xl);
}
.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: #e2e8f0;
}
@media (hover: none) {
  .news-card:hover {
    transform: none;
  }
}

.news-card-media {
  aspect-ratio: 16 / 10;
  min-height: 10rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid #f1f5f9;
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Blob animation delays (used with Tailwind animate-blob) */
.animation-delay-2000 {
  animation-delay: 2s;
}
.animation-delay-4000 {
  animation-delay: 4s;
}

/* Article body (replaces @tailwindcss/typography dependency on CDN) */
.article-body {
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  line-height: 1.75;
  color: #334155;
}
.article-body p {
  margin-bottom: 1.25rem;
}
.article-body p:last-child {
  margin-bottom: 0;
}
.article-body strong {
  color: #0f172a;
  font-weight: 800;
}
.article-body a {
  color: var(--brand-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-body a:hover {
  color: #6d28d9;
}

/* Focus visibility for keyboard users */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Mobile menu panel */
#mobileMenu:not(.hidden) {
  padding-bottom: var(--safe-bottom);
}

body.menu-open {
  overflow: hidden;
}

/* Fallback layout if Tailwind misses injected header utilities */
@media (max-width: 767px) {
  /* Hard fallback: always show hamburger on mobile */
  #desktopNav,
  #desktopActions {
    display: none !important;
  }
  #mobileMenuBtn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  #mobileMenu:not(.hidden) {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--header-h) + var(--safe-top));
    z-index: 120;
    max-height: calc(100svh - var(--header-h) - var(--safe-top));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 768px) {
  #mobileMenuBtn,
  #mobileMenu {
    display: none !important;
  }
  #desktopNav,
  #desktopActions {
    display: flex !important;
  }
}

/*
 * Footer/header partials: if Tailwind CDN has not yet rescanned injected HTML,
 * keep a readable multi-column layout (Connect column was collapsing / off-grid).
 */
.footer-injected-grid {
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 640px) {
  .footer-injected-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .footer-injected-grid > .footer-brand-col {
    grid-column: span 2;
  }
}
@media (min-width: 1024px) {
  .footer-injected-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .footer-injected-grid > .footer-brand-col {
    grid-column: span 2;
  }
}
