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

/* Design tokens */
:root {
  /* Colors */
  --color-cp-black:       #161616;
  --color-lightest-grey:  #F7F7F7;
  --color-mid-grey:       #E0E0E0;
  --color-dark-grey:      #5C5C5C;
  --color-white:          #FFFFFF;
  --color-score-c:        #A87E00;
  --color-score-d:        #FF541F;
  --color-score-d-minus:  #DE481B;
  --color-score-f:        #961D14;
  --color-error-bg:       #fef2f2;
  --color-error-border:   #fca5a5;
  --color-error-text:     #991b1b;

  /* Typography */
  --font-serif: "meno-text", "Playfair Display", Georgia, serif;
  --font-sans:  "Chivo", system-ui, -apple-system, sans-serif;
  --font-mono:  "Roboto Mono", "Courier New", monospace;
  --font-brand: "Hanken Grotesk", system-ui, sans-serif;

  /* Spacing */
  --page-h-desktop: 91px;
  --page-h-mobile:  24px;
  --content-max:    1091px;
  --text-max:       750px;
}

/* Body */
body {
  font-family: var(--font-sans);
  color: var(--color-cp-black);
  background: var(--color-white);
  line-height: 1.3;
}

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

/* Mobile sticky nav */
.mobile-nav {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  height: 48px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-dark-grey);
  align-items: center;
  padding: 0 var(--page-h-mobile);
  gap: 16px;
}

.mobile-nav__btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.mobile-nav__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-cp-black);
  line-height: 1.3;
}

@media (max-width: 767px) {
  .mobile-nav {
    display: flex;
  }
}

/* Hamburger menu overlay */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--color-white);
  height: 592px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-100%);
  transition: transform 0.28s ease;
  overflow: hidden;
}

.mobile-menu[aria-hidden="false"] {
  transform: translateY(0);
}

.mobile-menu__close {
  position: absolute;
  top: 18px;
  right: var(--page-h-mobile);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.mobile-menu__inner {
  padding: 54px var(--page-h-mobile) 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-menu__heading {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.29;
  color: var(--color-dark-grey);
}

.mobile-menu__companies {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-menu__company-link {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-cp-black);
  text-decoration: none;
}

.mobile-menu__divider {
  border: none;
  border-top: 1px solid var(--color-score-c);
  width: 323px;
  flex-shrink: 0;
}

.mobile-menu__link {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-cp-black);
  text-decoration: none;
}

/* Backdrop */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(22, 22, 22, 0.37);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Hero */
.hero {
  position: relative;
  background: var(--color-cp-black);
  overflow: hidden;
  min-height: 441px;
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.hero__bg--mobile {
  display: none;
}

.hero__inner {
  position: relative;
  z-index: 1;
  padding: 80px clamp(var(--page-h-mobile), 6.25vw, var(--page-h-desktop));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: 76px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.15;
  color: var(--color-white);
  font-feature-settings: "lnum" 1, "pnum" 1;
  max-width: 9em;
}

.hero__subhead {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 300;
  line-height: 1.21;
  color: var(--color-white);
}

.hero__eyebrow {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-white);
}

/* Intro section */
.intro-section {
  background: var(--color-white);
  padding: 80px var(--page-h-desktop);
}

.intro-section__inner {
  max-width: var(--text-max);
  margin: 0 auto;
}

.intro-body {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-cp-black);
  margin-bottom: 30px;
}

.intro-body:last-child {
  margin-bottom: 0;
}

/* Rankings section */
.rankings-section {
  background: var(--color-white);
  padding-bottom: 80px;
}

.rankings-section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--page-h-desktop);
}

.rankings-heading {
  font-family: var(--font-serif);
  font-size: 45px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.2;
  color: var(--color-cp-black);
  font-feature-settings: "lnum" 1, "pnum" 1;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Rankings table — desktop */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#rankings-table {
  width: 100%;
  border-collapse: collapse;
}

/* Header row */
#rankings-table thead tr {
  border-bottom: 1px solid var(--color-cp-black);
  opacity: 0.36;
}

#rankings-table thead th {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-cp-black);
  text-align: left;
  padding: 12px 16px;
  white-space: nowrap;
}

/* Column widths */
.col-company  { width: 22%; }
.col-score    { width: 28%; }
.col-factors  { width: 50%; }

/* Body rows */
#rankings-table tbody td {
  font-family: var(--font-sans);
  padding: 22px 16px;
  vertical-align: middle;
}

#rankings-table tbody tr.row-odd  { background: var(--color-white); }
#rankings-table tbody tr.row-even { background: var(--color-lightest-grey); }

/* Company name */
.company-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-cp-black);
}

/* Score cell: number + bar side by side */
.score-cell__inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-number {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.bar-track {
  width: 177px;
  height: 16px;
  background: var(--color-mid-grey);
  border-radius: 1px;
  overflow: hidden;
  flex-shrink: 0;
}

.bar-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.45s ease;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}

/* Key factors text */
.key-factors {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-cp-black);
  white-space: nowrap;
}

/* Rankings table — mobile compact layout */
@media (max-width: 767px) {
  /* Restore table display */
  #rankings-table         { display: table; }
  #rankings-table tbody   { display: table-row-group; }
  #rankings-table tbody tr { display: table-row; }

  /* Show header row, reset desktop opacity */
  #rankings-table thead   { display: table-header-group; }
  #rankings-table thead tr { opacity: 1; }

  /* Header cell sizing */
  #rankings-table thead th {
    font-size: 12px;
    letter-spacing: 1.5px;
    padding: 12px 6px;
  }
  #rankings-table thead th.col-company { padding-left: 12px; }

  /* Body cell padding */
  #rankings-table tbody td {
    padding: 15px 6px;
    vertical-align: middle;
  }
  #rankings-table tbody td:first-child { padding-left: 12px; }

  /* Company: 16px bold, no wrap */
  .company-name {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
  }

  /* Score: colored number only, no bar */
  .bar-track    { display: none; }
  .score-number { font-size: 16px; }

  /* Key factors: smaller, wraps */
  .key-factors {
    font-size: 14px;
    white-space: normal;
  }
}

/* Grey background section wrapper */
.grey-bg-wrap {
  background: var(--color-lightest-grey);
}

/* How the score works */
.how-score-section {
  padding: 80px 0 45px;
}

.how-score-section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--page-h-desktop);
  display: flex;
  flex-direction: column;
  gap: 45px;
}

.how-score__intro {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: var(--text-max);
}

.section-heading {
  font-family: var(--font-serif);
  font-size: 45px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.2;
  color: var(--color-cp-black);
  font-feature-settings: "lnum" 1, "pnum" 1;
}

.section-body {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-cp-black);
}

/* Factor cards grid */
.factors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.factor {
  background: var(--color-white);
  border: 1px solid var(--color-dark-grey);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Factor eyebrow: pie icon + label */
.factor__eyebrow {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Pie chart icon — SVG asset from Figma */
.factor__icon {
  width: 58px;
  height: 63px;
  flex-shrink: 0;
  display: block;
}

.factor__label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-cp-black);
}

.factor__title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.29;
  color: var(--color-cp-black);
  font-feature-settings: "lnum" 1, "pnum" 1;
}

.factor__body {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-cp-black);
}

/* Why these two factors */
.why-factors {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: var(--text-max);
}

.why-factors__heading {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.29;
  color: var(--color-cp-black);
  font-feature-settings: "lnum" 1, "pnum" 1;
}

/* Additional Resources */
.additional-resources {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: var(--text-max);
}

.resource-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.resource-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resource-link {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: #003e99;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.resource-link:hover {
  opacity: 0.75;
  text-decoration: none;
}

.resource-meta {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-dark-grey);
}

.resource-disclaimer {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-dark-grey);
}

/* Footnotes / Citations */
.footnotes-section {
  padding: 0 0 80px;
}

.footnotes-section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--page-h-desktop);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-mid-grey);
  width: 100%;
  margin-bottom: 10px;
}

.footnotes {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: var(--text-max);
}

.footnote-item {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-cp-black);
}

.footnote-item dt {
  font-weight: 700;
  display: inline;
}

.footnote-item dd {
  display: inline;
  margin: 0;
}

/* Error state */
.error-state {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.25rem var(--page-h-desktop);
  border: 1px solid var(--color-error-border);
  background: var(--color-error-bg);
  color: var(--color-error-text);
  font-size: 0.9375rem;
}

/* Footer */
.site-footer {
  background: var(--color-cp-black);
  padding: 32px var(--page-h-desktop);
  min-height: 200px;
  display: flex;
  align-items: flex-start;
}

.site-footer__inner {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.footer-logos {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo-cp {
  height: 60px;
  width: auto;
}

.footer-logo-divider {
  width: 1px;
  height: 60px;
  background: var(--color-white);
  opacity: 0.5;
  flex-shrink: 0;
}

.footer-logo-cleanview {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-logo-sun {
  width: 58px;
  height: 58px;
  object-fit: cover;
}

.footer-logo-cleanview-text {
  font-family: var(--font-brand);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-white);
  white-space: nowrap;
}

.footer-tagline {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-white);
}

.footer-legal {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--color-white);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.footer-legal__sep {
  opacity: 0.5;
}

.footer-privacy {
  color: var(--color-white);
  text-underline-offset: 2px;
}

.footer-privacy:hover {
  text-decoration: none;
}

@media (min-width: 768px) {
  .footer-legal {
    align-self: flex-end;
  }
}

/* Mobile responsive */
@media (max-width: 767px) {
  /* Hero */
  .hero {
    min-height: 451px;
  }

  .hero__bg--desktop { display: none; }
  .hero__bg--mobile  { display: block; }

  .hero__inner {
    padding: 90px var(--page-h-mobile) 80px;
    gap: 12px;
  }

  .hero__title {
    font-size: 48px;
    max-width: none;
  }

  .hero__subhead {
    font-size: 22px;
  }

  .hero__eyebrow {
    font-size: 12px;
    letter-spacing: 1.5px;
  }

  /* Intro */
  .intro-section {
    padding: 40px var(--page-h-mobile);
  }

  .intro-body {
    font-size: 16px;
    margin-bottom: 20px;
  }

  /* Rankings */
  .rankings-section {
    padding-bottom: 40px;
  }

  .rankings-section__inner {
    padding: 24px var(--page-h-mobile) 0;
  }

  .rankings-heading {
    font-size: 32px;
    margin-bottom: 10px;
  }

  /* How the score works */
  .how-score-section {
    padding: 80px 0 40px;
  }

  .how-score-section__inner {
    padding: 0 var(--page-h-mobile);
    gap: 25px;
  }

  .section-heading {
    font-size: 40px;
  }

  .section-body {
    font-size: 16px;
  }

  .factors-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .factor {
    padding: 20px 15px;
    gap: 12px;
  }

  .factor__title {
    font-size: 24px;
  }

  .factor__body {
    font-size: 16px;
  }

  .why-factors__heading {
    font-size: 24px;
  }

  /* Additional Resources */
  .resource-link {
    font-size: 16px;
  }

  .resource-meta,
  .resource-disclaimer {
    font-size: 14px;
  }

  /* Footnotes */
  .footnotes-section {
    padding: 0 0 40px;
  }

  .footnotes-section__inner {
    padding: 0 var(--page-h-mobile);
  }

  .footnote-item {
    font-size: 14px;
  }

  /* Footer */
  .site-footer {
    padding: 33px var(--page-h-mobile);
    min-height: 209px;
    align-items: center;
  }

  .site-footer__inner {
    align-items: center;
    text-align: center;
  }

  .footer-logos {
    gap: 8px;
  }

  .footer-logo-cp {
    height: 42px;
  }

  .footer-logo-sun {
    width: 41px;
    height: 41px;
  }

  .footer-logo-cleanview-text {
    font-size: 19px;
  }

  .footer-tagline {
    font-size: 16px;
    text-align: center;
  }

  .footer-legal {
    font-size: 14px;
    justify-content: center;
    gap: 12px;
  }
}
