/* ============================================
   Chart.biz — Main Stylesheet
   Industrial Utility Design System
   ============================================ */

/* Variables defined in inline critical CSS */

/* ============================================
   BASE & RESET
   ============================================ */
a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input {
  font: inherit;
}

ul {
  list-style: none;
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.logo__icon {
  color: var(--accent);
  font-size: 1.5rem;
}

.logo__accent {
  color: var(--text-muted);
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav__link {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav__link--finance:hover { color: var(--finance); }
.nav__link--health:hover { color: var(--health); }
.nav__link--sports:hover { color: var(--sports); }
.nav__link--education:hover { color: var(--education); }
.nav__link--lifestyle:hover { color: var(--lifestyle); }

@media (max-width: 768px) {
  .nav { display: none; }
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(0, 212, 170, 0.08) 0%, transparent 60%),
    var(--bg);
}

.hero__inner {
  max-width: 720px;
  margin: 0 auto;
}

.hero__title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero__small {
  display: block;
  font-size: 0.4em;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.hero__sub {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* Search */
.search {
  position: relative;
  max-width: 560px;
  margin: 0 auto 2rem;
}

.search__input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s;
}

.search__input::placeholder {
  color: var(--text-muted);
}

.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 212, 170, 0.15);
}

.search__btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.search__btn:hover {
  color: var(--accent);
}

.search__results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.search__result {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search__result:last-child { border-bottom: none; }
.search__result:hover { background: var(--surface-2); }

/* Quick Tags */
.hero__quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.hero__quick-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.tag {
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
}

.tag:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.tag--finance:hover { border-color: var(--finance); color: var(--finance); }
.tag--health:hover { border-color: var(--health); color: var(--health); }
.tag--sports:hover { border-color: var(--sports); color: var(--sports); }
.tag--education:hover { border-color: var(--education); color: var(--education); }
.tag--lifestyle:hover { border-color: var(--lifestyle); color: var(--lifestyle); }

/* ============================================
   AD SLOTS
   ============================================ */
.ad-slot {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  min-height: 90px;
}

.ad-slot--leaderboard {
  text-align: center;
}

.ad-slot--rectangle {
  max-width: 336px;
}

.ad-slot--sidebar {
  position: sticky;
  top: 5rem;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section--alt {
  background: var(--surface);
  max-width: none;
  padding: 3rem 1.5rem;
}

.section--alt > * {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.section__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section__title {
  font-size: 1.25rem;
  font-weight: 600;
}

.section__badge {
  padding: 0.25rem 0.625rem;
  background: var(--accent-dim);
  color: var(--bg);
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   CHART CARDS
   ============================================ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.chart-card {
  position: relative;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: all 0.2s;
}

.chart-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.chart-card__category {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

[data-category="finance"] .chart-card__category { color: var(--finance); }
[data-category="health"] .chart-card__category { color: var(--health); }
[data-category="sports"] .chart-card__category { color: var(--sports); }
[data-category="education"] .chart-card__category { color: var(--education); }
[data-category="lifestyle"] .chart-card__category { color: var(--lifestyle); }

.chart-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.chart-card__meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.chart-card__type {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.125rem 0.5rem;
  background: var(--surface-2);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ============================================
   CATEGORY CARDS
   ============================================ */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.category-card {
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: all 0.2s;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.category-card--finance:hover { border-color: var(--finance); }
.category-card--health:hover { border-color: var(--health); }
.category-card--sports:hover { border-color: var(--sports); }
.category-card--education:hover { border-color: var(--education); }
.category-card--lifestyle:hover { border-color: var(--lifestyle); }

.category-card__icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.category-card--finance .category-card__icon { color: var(--finance); }
.category-card--health .category-card__icon { color: var(--health); }
.category-card--sports .category-card__icon { color: var(--sports); }
.category-card--education .category-card__icon { color: var(--education); }
.category-card--lifestyle .category-card__icon { color: var(--lifestyle); }

.category-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.category-card__count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.category-card__list {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.category-card__list li {
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.category-card__list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--border);
}

/* ============================================
   FEATURES
   ============================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  text-align: center;
}

.feature__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.feature__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature__text {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 240px;
  margin: 0 auto;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}

.footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.footer__nav {
  display: flex;
  gap: 1.5rem;
}

.footer__nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

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

.footer__copy {
  width: 100%;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* ============================================
   CHART PAGE LAYOUT
   ============================================ */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page--with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .page--with-sidebar {
    grid-template-columns: 1fr;
  }
}

.page__main {
  min-width: 0;
}

.page__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.breadcrumbs a {
  color: var(--text-muted);
}

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

.breadcrumbs__sep {
  color: var(--border);
}

.breadcrumbs__current {
  color: var(--text);
}

/* Hero Chart Block */
.chart-hero {
  margin-bottom: 2rem;
}

.chart-hero__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-hero__title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
}

.chart-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.chart-hero__badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chart-hero__updated {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* The Chart Container */
.chart-embed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.chart-embed__inner {
  aspect-ratio: 16/9;
  min-height: 400px;
}

.chart-embed__img {
  width: 100%;
  height: auto;
}

/* At a Glance */
.glance {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.glance__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.glance__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.glance__item {
  text-align: center;
}

.glance__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.glance__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* How to Read */
.howto {
  margin-bottom: 1.5rem;
}

.howto__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.howto__text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Download Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
}

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

.btn--primary:hover {
  background: var(--accent-dim);
}

.btn--secondary {
  background: var(--surface);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--text-muted);
  background: var(--surface-2);
}

/* Related Charts */
.related {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.related__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

/* Sidebar Widgets */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.widget__title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.widget__list a {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: color 0.15s;
}

.widget__list a:last-child {
  border-bottom: none;
}

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

/* Source Citation */
.source {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.source__badge {
  padding: 0.125rem 0.5rem;
  background: var(--surface-2);
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ============================================
   CALCULATOR STYLES
   ============================================ */
.calculator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.calculator__form {
  display: grid;
  gap: 1rem;
}

.calculator__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calculator__label {
  font-size: 0.875rem;
  font-weight: 500;
}

.calculator__input {
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1rem;
}

.calculator__input:focus {
  outline: none;
  border-color: var(--accent);
}

.calculator__result {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: 0.5rem;
  text-align: center;
}

.calculator__result-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.calculator__result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============================================
   DATA TABLES (Sports)
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface);
}

.data-table tr:hover td {
  background: var(--surface);
}

.data-table__position {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  :root {
    --bg: #fff;
    --surface: #f8f8f8;
    --text: #000;
    --text-muted: #666;
    --border: #ddd;
    --accent: #000;
  }
  
  body {
    background: #fff;
    color: #000;
  }
  
  .header,
  .footer,
  .ad-slot,
  .search,
  .nav,
  .hero__quick,
  .actions .btn--secondary,
  .related,
  .widget {
    display: none !important;
  }
  
  .page {
    max-width: none;
    padding: 0;
  }
  
  .page--with-sidebar {
    display: block;
  }
  
  .page__sidebar {
    display: none;
  }
  
  .chart-embed {
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
  
  .glance {
    page-break-inside: avoid;
  }
  
  a {
    color: inherit;
  }
  
  .btn--primary {
    display: none;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.25rem;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .hero {
    padding: 2.5rem 1rem 2rem;
  }
  
  .section {
    padding: 2rem 1rem;
  }
  
  .chart-grid {
    grid-template-columns: 1fr;
  }
  
  .glance__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .actions {
    flex-direction: column;
  }
  
  .btn {
    justify-content: center;
  }
}
