/*
  Auri Research — data-forward extensions to the Guides reading surface.
*/

.research-page {
  --research-content: 50rem;
  --research-frame: 66rem;
  --score-track: rgb(23 25 28 / 12%);
  --score-fill: #555d64;
  --auri-row: rgb(184 67 56 / 8%);
}

@media (prefers-color-scheme: dark) {
  .research-page {
    --score-track: rgb(255 255 255 / 11%);
    --score-fill: #8e959b;
    --auri-row: rgb(223 103 91 / 10%);
  }
}

.research-page ::selection {
  color: var(--ink);
  background: rgb(184 67 56 / 30%);
}

.research-page {
  scrollbar-color: var(--quiet) transparent;
  scrollbar-width: thin;
}

.research-shell {
  width: min(var(--shell-width), calc(100% - 48px));
  margin-inline: auto;
}

.research-body-shell {
  width: min(var(--shell-width), calc(100% - 48px));
}

.research-header {
  padding-top: 132px;
}

.research-header .breadcrumb {
  margin-bottom: 30px;
}

.research-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "title finding"
    "standings standings";
  column-gap: clamp(44px, 6vw, 72px);
  row-gap: 38px;
  align-items: start;
  padding-bottom: 52px;
  border-bottom: 1px solid var(--hairline);
}

.research-title-block {
  grid-area: title;
}

.research-title-block h1 {
  margin: 0;
  font-size: clamp(3rem, 4.8vw, 4rem);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1;
}

.research-title-block h1 span {
  display: block;
  white-space: nowrap;
}

.research-title-block,
.research-finding-block,
.standings,
.score-board {
  min-width: 0;
}

.research-subtitle {
  max-width: 34rem;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  font-style: italic;
  line-height: 1.55;
}

.research-finding {
  max-width: 38rem;
  margin: 0;
  font-size: clamp(1.12rem, 1.8vw, 1.35rem);
  font-weight: 520;
  letter-spacing: -0.018em;
  line-height: 1.5;
}

.research-finding-block {
  grid-area: finding;
  padding-top: 5px;
}

.research-finding-block .article-meta {
  margin-top: 24px;
}

.standings {
  grid-area: standings;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(38px, 6vw, 72px);
  padding-top: 30px;
  border-top: 1px solid var(--hairline);
}

.score-board h2 {
  margin: 0 0 19px;
  font-size: 0.82rem;
  font-weight: 720;
  letter-spacing: 0.025em;
}

.score-board ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-board li + li {
  margin-top: 12px;
}

.standing-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
  font-size: 0.82rem;
}

.standing-label span {
  color: var(--muted);
}

.standing-label strong {
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.standing-track {
  height: 4px;
  overflow: hidden;
  background: var(--score-track);
}

.standing-track i {
  display: block;
  width: var(--score);
  height: 100%;
  background: var(--score-fill);
  transform-origin: left center;
}

.score-board li.is-auri .standing-track i {
  background: var(--accent);
}

.score-board > p {
  margin: 18px 0 0;
  color: var(--quiet);
  font-size: 0.75rem;
  line-height: 1.45;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--research-content)) minmax(180px, 13rem);
  grid-template-areas:
    "preface toc"
    "article toc";
  gap: 48px;
  align-items: start;
  width: min(100%, var(--research-frame));
  margin-inline: auto;
  padding: 54px 0 44px;
}

.research-prose {
  grid-area: article;
  max-width: var(--research-content);
  min-width: 0;
}

.research-preface {
  grid-area: preface;
  max-width: var(--research-content);
}

.research-prose > p,
.research-prose > ul,
.research-prose > blockquote,
.research-prose > h2,
.research-prose > h3,
.research-prose > .research-intro,
.research-prose > .research-disclosure,
.research-prose > .evidence-status,
.research-prose > .table-note {
  max-width: var(--research-content);
}

.research-intro {
  margin-bottom: 28px;
}

.research-intro p {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.research-disclosure {
  margin: 0 0 46px;
  padding: 18px 0;
  border-block: 1px solid var(--hairline);
}

.research-disclosure strong {
  font-size: 0.82rem;
  font-weight: 720;
}

.research-disclosure p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.58;
}

.research-prose > h2 {
  margin-top: 3.8rem;
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  letter-spacing: -0.035em;
  scroll-margin-top: 110px;
}

.research-prose > h2:first-of-type {
  margin-top: 0;
}

.research-prose > h3 {
  margin-top: 2.1rem;
  font-size: 1.18rem;
  scroll-margin-top: 110px;
}

.research-prose code {
  padding: 0.08em 0.28em;
  border-radius: 4px;
  background: var(--score-track);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.89em;
}

.research-prose blockquote {
  margin: 1.2rem 0;
  padding: 3px 0 3px 20px;
  border-left: 1px solid var(--quiet);
}

.research-prose blockquote p {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.table-scroll {
  width: 100%;
  margin: 1.25rem 0 1.8rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--quiet) transparent;
  scrollbar-width: thin;
}

.table-scroll:focus-visible {
  border-radius: 8px;
  outline-offset: 6px;
}

.research-table {
  min-width: 620px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.research-table[data-table="what-we-tested"] {
  min-width: 760px;
}

.score-table {
  min-width: var(--research-content);
  table-layout: fixed;
}

.table-hint {
  display: none;
}

.research-prose .research-table th,
.research-prose .research-table td {
  padding: 10px 8px;
  border-color: var(--hairline);
}

.research-prose .score-table th,
.research-prose .score-table td {
  padding-inline: 6px;
}

.research-prose .score-table thead th {
  line-height: 1.3;
  white-space: normal;
}

.research-prose .score-table th:first-child {
  width: 17%;
}

.research-table[data-table="touch-results"] th:nth-child(1) { width: 20%; }
.research-table[data-table="touch-results"] th:nth-child(2) { width: 14%; }
.research-table[data-table="touch-results"] th:nth-child(3) { width: 14%; }
.research-table[data-table="touch-results"] th:nth-child(4) { width: 15%; }
  .research-table[data-table="touch-results"] th:nth-child(5) { width: 10%; }
  .research-table[data-table="touch-results"] th:nth-child(6) { width: 15%; }
  .research-table[data-table="touch-results"] th:nth-child(7) { width: 12%; }

.research-table[data-table="voice-results"] th:nth-child(1) { width: 20%; }
  .research-table[data-table="voice-results"] th:nth-child(2) { width: 12%; }
  .research-table[data-table="voice-results"] th:nth-child(3) { width: 18%; }
  .research-table[data-table="voice-results"] th:nth-child(4) { width: 12%; }
  .research-table[data-table="voice-results"] th:nth-child(5) { width: 12%; }
  .research-table[data-table="voice-results"] th:nth-child(6) { width: 14%; }
  .research-table[data-table="voice-results"] th:nth-child(7) { width: 12%; }

.research-prose .research-table tbody th {
  min-width: 126px;
  font-size: 0.94rem;
  font-weight: 650;
  text-align: left;
}

.research-prose .research-table td {
  color: var(--muted);
  font-size: 0.88rem;
}

.research-prose .research-table .numeric {
  text-align: right;
}

.research-prose .research-table .is-leader th,
.research-prose .research-table .is-leader td {
  color: var(--ink);
}

.research-prose .research-table .is-auri {
  background: var(--auri-row);
}

.research-prose .table-note {
  margin-top: -0.45rem;
  color: var(--quiet);
  font-size: 0.88rem;
}

.evidence-unavailable {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
  cursor: help;
}

.research-toc ol {
  max-height: calc(100vh - 168px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.research-toc {
  grid-area: toc;
}

.research-toc a {
  display: block;
  padding: 2px 0;
}

@media (prefers-reduced-motion: no-preference) {
  .standing-track i {
    animation: standing-fill 900ms var(--ease-out) both;
  }

  .score-board:nth-child(2) .standing-track i {
    animation-delay: 100ms;
  }
}

@keyframes standing-fill {
  from {
    transform: scaleX(0.12);
  }

  to {
    transform: scaleX(1);
  }
}

@media (max-width: 1040px) {
  .research-hero {
    column-gap: 44px;
  }

  .standings {
    gap: 26px;
  }
}

@media (max-width: 1103px) {
  .research-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "preface"
      "toc"
      "article";
    gap: 18px;
    width: min(100%, var(--research-content));
  }

  .research-toc {
    position: static;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--hairline);
  }

  .research-toc ol {
    columns: 2;
    max-height: none;
    column-gap: 32px;
  }

  .research-toc li {
    break-inside: avoid;
  }
}

@media (max-width: 900px) {
  .research-hero {
    grid-template-columns: 1fr;
  }

  .research-hero {
    grid-template-areas:
      "title"
      "finding"
      "standings";
  }

  .standings {
    max-width: 46rem;
  }
}

@media (max-width: 720px) {
  .research-shell {
    width: min(100% - 28px, var(--shell-width));
  }

  .research-header {
    padding-top: 112px;
  }

  .research-hero {
    gap: 38px;
    padding-bottom: 38px;
  }

  .research-title-block h1 {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
  }

  .standings {
    grid-template-columns: 1fr;
  }

  .research-layout {
    padding-top: 38px;
  }

  .research-toc ol {
    columns: 1;
  }

  .research-prose > h2 {
    margin-top: 3.25rem;
  }

  .table-scroll {
    width: calc(100vw - 28px);
    margin-right: calc((100vw - 28px - 100%) * -1);
  }

  .table-hint {
    position: sticky;
    left: 0;
    display: block;
    width: max-content;
    margin: 0 0 8px;
    color: var(--quiet);
    font-size: 0.75rem;
    font-weight: 610;
  }

  .research-prose .research-table tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    border-right: 1px solid var(--hairline);
    background: var(--page);
  }

  .research-prose .research-table .is-auri th {
    background: color-mix(in srgb, var(--page) 92%, var(--accent));
  }
}
