/* YearlyRank www homepage
   Brand: JD red #e1251b, navy #0f2347, gold #f2b632, Rank-on-dark #ff8a80
   Logo lockup: H = 38px (32px on narrow screens), clear space 0.5H
*/
:root {
  --red: #e1251b;
  --navy: #0f2347;
  --gold: #f2b632;
  --rank-dark: #ff8a80;
  --white: #ffffff;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #0f2347;
  --muted: #5c6778;
  --muted-2: #8a919c;
  --line: #e2e6ee;
  --line-strong: #cfd5e0;
  --available-bg: #e7f6ed;
  --available-text: #157347;
  --hero-muted: rgba(255, 255, 255, 0.86);
  --hero-line: rgba(255, 255, 255, 0.38);
  --shadow: 0 1px 2px rgba(15, 35, 71, 0.05);
  --shadow-hover: 0 8px 24px rgba(15, 35, 71, 0.10);
  --wrap: 1120px;
  --H: 38px;
  --clear: 19px;
  --header-h: 76px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans TC",
    "Noto Sans JP", "Noto Sans KR", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans Thai",
    sans-serif;
  --cbar-h: 0px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: var(--cbar-h);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
.sr, .visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.wrap {
  max-width: calc(var(--wrap) + 64px);
  margin-inline: auto;
  padding-inline: 32px;
}

/* Header */
header.top {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
header.top .wrap {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: var(--clear);
}
.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-inline-end: var(--clear);
}
.brand img { height: var(--H); width: auto; }
nav.links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
nav.links a {
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
nav.links a:hover { border-color: var(--navy); }
nav.links a:focus-visible,
.brand:focus-visible,
.langbtn:focus-visible,
.menubtn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}
.langbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}
.langbtn:hover { color: var(--navy); }
.langbtn .chev { font-size: 10px; line-height: 1; }
.menubtn {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.mmenu { display: none; }

/* Language panel */
.lang-panel {
  position: absolute;
  inset-inline-end: 32px;
  top: calc(100% + 8px);
  width: min(560px, calc(100vw - 32px));
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 16px 16px 12px;
  z-index: 40;
}
.lang-panel h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}
.langs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}
.langs a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--navy);
}
.langs a:hover { background: var(--bg); }
.langs a.cur { background: #eef2f8; font-weight: 700; }
.langs a i { font-style: normal; color: var(--muted-2); font-size: 12px; }
.langs a:focus-visible { outline: 2px solid var(--red); outline-offset: 0; }
header.top { position: sticky; }

/* Suggestion bar */
.sug {
  background: #fff6e8;
  color: var(--navy);
  border-bottom: 1px solid #f0dfc0;
  padding: 8px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}
.sug[hidden] { display: none !important; }
.sug .btn, .sug button {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sug a.btn { background: var(--navy); color: var(--white); }
.sug button.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--navy);
}

/* Hero */
.hero {
  background: var(--red);
  color: var(--white);
  padding: 64px 0 68px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 48px;
  align-items: center;
}
.kicker {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  color: var(--white);
}
.hero h1 {
  font-size: 64px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.hero .lede {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--hero-muted);
  max-width: 36em;
}
.hero-card {
  padding-inline-start: 36px;
  border-inline-start: 1px solid var(--hero-line);
}
.hero-card h2 {
  font-size: 28px;
  font-weight: 750;
  line-height: 1.3;
  margin-bottom: 12px;
}
.hero-card p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--hero-muted);
}
.hero-card .browse {
  display: inline-block;
  margin-top: 16px;
  font-weight: 700;
  color: var(--white);
  border-bottom: 2px solid transparent;
}
.hero-card .browse:hover { border-color: var(--white); }
.hero-card .browse:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

/* Directory */
.directory { padding: 56px 0 72px; }
.directory h2, .method h2, .doc h1, .legal h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.sec-lead, .method-lead {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}
.rows {
  list-style: none;
  margin-top: 28px;
}
.rank-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px 24px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 22px 22px 0;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.rank-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--red);
  border-start-start-radius: 12px;
  border-end-start-radius: 12px;
}
.rank-card:hover,
.rank-card:has(.rank-main:hover) {
  box-shadow: var(--shadow-hover);
  border-color: #b7c0d0;
  transform: translateY(-2px);
}
.rank-card:hover .btn-view,
.rank-card:has(.rank-main:hover) .btn-view {
  background: #17305c;
}
.rank-main:focus,
.rank-main:focus-visible {
  outline: none;
}
.rank-card:has(.rank-main:focus),
.rank-card:has(.rank-main:focus-visible) {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
  box-shadow: var(--shadow-hover);
}
.rank-kicker {
  padding-inline-start: 28px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.4;
  white-space: nowrap;
}
.rank-body { min-width: 0; }
.rank-body h3 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
/* Stretched-link: heading <a> covers the whole card; chips sit above it.
   .rank-main and h3 stay static so ::after positions against .rank-card. */
.rank-card { isolation: isolate; }
.rank-body h3,
.rank-main { position: static; }
.rank-main {
  color: var(--navy);
}
.rank-main::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 12px;
}
.rank-card:hover .rank-main {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.subtypes {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  margin-top: 8px;
  list-style: none;
  align-items: center;
}
.subtypes li { display: inline-flex; align-items: center; gap: 6px; }
.subtypes li + li::before {
  content: "·";
  color: var(--muted-2);
  margin-inline-end: 6px;
  pointer-events: none;
}
.subtypes a {
  position: relative;
  z-index: 2;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
}
.subtypes a:hover { border-color: var(--navy); }
.subtypes a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}
.rank-aside {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-inline-end: 4px;
  flex: 0 0 auto;
}
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--available-bg);
  color: var(--available-text);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.btn-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none; /* visual only; card link handles the click */
}

/* Official-score preview ticker: desktop/iPad only, under the stretched link. */
.rank-preview {
  display: none;
}
@media (min-width: 768px) {
  .rank-card {
    grid-template-columns: auto minmax(0, 1fr) minmax(200px, 260px) auto;
  }
  .rank-preview {
    display: block;
    position: relative;
    z-index: 0;
    pointer-events: none;
    height: 76px;
    overflow: hidden;
    min-width: 0;
    mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }
  .rank-preview-track {
    animation: yr-preview-scroll 42s linear infinite;
    will-change: transform;
  }
  .rank-card:hover .rank-preview-track,
  .rank-card:focus-within .rank-preview-track {
    animation-play-state: paused;
  }
  .rank-preview ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
  }
  .rank-preview li {
    display: grid;
    grid-template-columns: minmax(0, 7.2em) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: baseline;
    padding: 5px 0;
    font-size: 13px;
    line-height: 1.3;
    color: var(--navy);
  }
  .pv-type {
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pv-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pv-score {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 13px;
    color: var(--navy);
  }
  @keyframes yr-preview-scroll {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
  }
  @media (prefers-reduced-motion: reduce) {
    .rank-preview-track { animation: none; }
    .rank-preview-track ul + ul { display: none; }
  }
}

/* Methodology */
.method { padding: 12px 0 72px; }
.method-note {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
  max-width: 46em;
}
.method-note a {
  color: var(--navy);
  font-weight: 700;
  border-bottom: 2px solid var(--gold);
  text-underline-offset: 3px;
}
.method-note a:hover { color: var(--red); border-color: var(--red); }
.method-note a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
.method-box {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 36px;
}
.method-copy p + p { margin-top: 12px; }
.method-copy p, .sources li, .sources p { color: var(--text); font-size: 15px; line-height: 1.7; }
.signals {
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}
.signals h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
}
.signals p { font-size: 14px; color: var(--muted); line-height: 1.6; }
.method-link {
  display: inline-block;
  margin-top: 16px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 2px solid var(--gold);
}
.method-link:hover { color: var(--red); }
.method-link:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.sources h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
}
.sources ol {
  padding-inline-start: 1.15em;
  display: grid;
  gap: 10px;
}
.sources a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
.sources .attr {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}
.rule-note {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

/* Footer */
footer.site {
  background: var(--navy);
  color: rgba(255,255,255,0.86);
  padding: 36px 0 40px;
}
footer.site .wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px 32px;
  align-items: center;
}
.foot-brand img { height: var(--H); width: auto; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}
.foot-links a, .foot-links button {
  color: rgba(255,255,255,0.86);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.foot-links a:hover, .foot-links button:hover { color: var(--white); text-decoration: underline; }
.foot-links a:focus-visible, .foot-links button:focus-visible {
  outline: 2px solid var(--rank-dark);
  outline-offset: 3px;
}
.foot-meta { font-size: 13px; color: rgba(255,255,255,0.64); text-align: end; }
.foot-meta p + p { margin-top: 4px; }

/* Legal / 404 pages */
.doc, .legal {
  background: var(--white);
  max-width: calc(var(--wrap) + 64px);
  margin: 32px auto 64px;
  padding: 36px 32px 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.doc h1, .legal h1 { margin-bottom: 12px; }
.doc h2, .legal h2 {
  font-size: 20px;
  margin: 28px 0 10px;
}
.doc p, .legal p, .doc li, .legal li {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
}
.doc ul, .legal ul { padding-inline-start: 1.2em; margin: 8px 0; }
.doc a, .legal a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
.doc .tbd, .legal .tbd { color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--navy); text-decoration: underline; }

/* Cookie bar */
.cbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  background: var(--white);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -8px 24px rgba(15, 35, 71, 0.08);
  padding: 12px 20px;
  z-index: 80;
  color: var(--navy);
}
.cbar-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin-inline: auto;
}
.cbar-text { color: var(--muted); font-size: 13px; margin: 0; flex: 1 1 240px; min-width: 0; line-height: 1.45; }
.cbar-text a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
.cbtns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cbtns .c-eq {
  min-width: 108px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
}
.cbtns .c-eq:hover { background: #eef2f8; }
.cbtns .c-eq:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.cbtns .c-link {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}
.cprefs { margin: 8px auto 0; display: none; max-width: 1100px; max-height: 40vh; overflow: auto; }
.cprefs.open { display: block; }
.cbar-full { color: var(--muted); font-size: 13px; margin: 0 0 8px; line-height: 1.5; }
.cbar-full a { color: var(--navy); text-decoration: underline; }
.crow { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.crow .t { flex: 1; }
.crow .t b { display: block; font-size: 13px; }
.crow .t span { color: var(--muted); font-size: 12px; }
.crow input { width: 18px; height: 18px; accent-color: var(--red); margin-top: 2px; }

/* Skip link */
.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -40px;
  background: var(--navy);
  color: var(--white);
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 100;
}
.skip:focus { top: 12px; }

/* RTL: logical properties already handle most of it.
   Ensure lists and panels still feel mirrored. */
[dir="rtl"] .langs { direction: rtl; }
[dir="rtl"] .hero h1 { letter-spacing: 0; }

@media (max-width: 960px) {
  .hero { padding: 44px 0 48px; }
  .hero h1 { font-size: 44px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-card {
    padding-inline-start: 0;
    border-inline-start: 0;
    padding-top: 24px;
    border-top: 1px solid var(--hero-line);
  }
  .rank-kicker { padding-inline-start: 20px; }
  .rank-card { gap: 12px 16px; padding: 18px 16px 18px 0; }
  .method-box { grid-template-columns: 1fr; padding: 24px 22px; gap: 28px; }
  footer.site .wrap { grid-template-columns: 1fr; }
  .foot-meta { text-align: start; }
  .lang-panel { inset-inline-end: 16px; }
}

@media (max-width: 767px) {
  .rank-card { grid-template-columns: 1fr; padding: 18px; padding-inline-start: 22px; }
  .rank-kicker { padding-inline-start: 8px; white-space: normal; }
  .rank-aside { justify-content: flex-start; }
  .rank-preview { display: none !important; }
}

@media (max-width: 640px) {

  :root { --H: 32px; --clear: 16px; --header-h: 64px; }
  .wrap { padding-inline: 16px; }
  .langbtn { flex: 0 1 auto; min-width: 0; }
  .hero { padding: 32px 0 36px; }
  .hero h1 { font-size: 34px; letter-spacing: -0.025em; }
  .hero .lede { font-size: 16px; margin-top: 14px; }
  .hero-card h2 { font-size: 22px; }
  .directory { padding: 36px 0 48px; }
  .directory h2, .method h2 { font-size: 26px; }
  .rank-body h3 { font-size: 20px; }
  .rank-aside { flex-wrap: wrap; }
  .method { padding: 24px 0 56px; }
  .sug { padding: 8px 16px; }
  .doc, .legal { margin: 16px 16px 48px; padding: 24px 16px 32px; }
  .cbtns .c-eq { min-width: 96px; }
  .lang-panel {
    position: fixed;
    inset: auto 12px 12px 12px;
    top: auto;
    width: auto;
    max-height: min(70vh, 520px);
    overflow: auto;
  }
  .langs { grid-template-columns: 1fr; }
}
