:root {
  color-scheme: light;
  --bg: #fff;
  --text: #161616;
  --muted: #666;
  --faint: #f5f5f5;
  --line: #d9d9d9;
  --accent: #c91524;
  --accent-dark: #8f0f19;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 20px 0;
  border-bottom: 2px solid var(--text);
}

.topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
}

.brand {
  font-size: clamp(46px, 8vw, 86px);
  line-height: .82;
  font-weight: 900;
  letter-spacing: 0;
}

.brand::after {
  content: "";
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-left: .07em;
  background: var(--accent);
  transform: translateY(.04em);
}

.tagline {
  max-width: 360px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: right;
}

.nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid var(--line);
}

.nav a {
  display: block;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 800;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 16px 0 28px;
  border-bottom: 4px solid var(--accent);
}

.hero h1,
.page-title h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.08;
  font-weight: 900;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  border: 1px solid var(--line);
}

.hero-stats div {
  min-width: 0;
  padding: 12px;
  border-left: 1px solid var(--line);
}

.hero-stats div:first-child {
  border-left: 0;
}

.hero-stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.section-grid {
  display: block;
  padding-top: 30px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
.side-rail h2 {
  margin: 0;
  padding: 0 0 10px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-head a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.story-list {
  display: grid;
}

.story {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.story-rank {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--text);
  font-size: 18px;
  font-weight: 900;
}

.story-main {
  min-width: 0;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.story-meta a {
  color: var(--accent);
}

.story h2 {
  margin: 0;
  font-size: clamp(21px, 3vw, 31px);
  line-height: 1.25;
  font-weight: 900;
}

.story h2 a {
  text-decoration: none;
}

.story p,
.story-body p,
.hn-notes p {
  margin: 10px 0 0;
  color: #333;
  font-size: 15px;
  line-height: 1.75;
}

.story-body {
  margin-top: 10px;
}

.story-body p:first-child {
  margin-top: 0;
}

.hn-notes {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--faint);
}

.hn-notes strong {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.2;
}

.hn-notes p {
  margin-top: 4px;
  color: #2d2d2d;
}

.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.story-actions a,
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.story-actions .link-main {
  border-color: var(--text);
  color: var(--text);
}

.affiliate-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  background: var(--faint);
  border: 1px solid var(--line);
}

.affiliate-links > strong {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.affiliate-links a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 54px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.affiliate-links img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}

.affiliate-links span {
  min-width: 0;
}

.affiliate-links em {
  color: var(--accent-dark);
  font-style: normal;
  font-size: 12px;
}

.side-rail {
  display: none;
}

.story.compact {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 0;
}

.story.compact .story-rank {
  width: auto;
  height: 30px;
  border: 0;
  color: var(--accent);
  font-size: 12px;
  place-items: start;
  padding-top: 2px;
}

.story.compact h2 {
  font-size: 15px;
  line-height: 1.35;
}

.story.compact p,
.story.compact .story-body,
.story.compact .hn-notes,
.story.compact .story-actions {
  display: none;
}

.page-title {
  padding: 14px 0 26px;
  border-bottom: 4px solid var(--accent);
}

.page-title p {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.article-detail {
  max-width: 860px;
  margin: 0 auto;
}

.article-detail-head {
  padding-bottom: 22px;
  border-bottom: 4px solid var(--accent);
}

.article-detail-head h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.1;
  font-weight: 900;
}

.article-detail-head p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.article-detail > .story-body {
  margin-top: 24px;
}

.archive-list {
  display: grid;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.archive-row {
  display: grid;
  grid-template-columns: 150px 90px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.archive-row strong,
.archive-row span {
  font-weight: 900;
}

.archive-row span {
  color: var(--accent);
  font-size: 13px;
}

.archive-row em {
  min-width: 0;
  color: var(--muted);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-rankings {
  margin-top: 42px;
  padding-top: 18px;
  border-top: 4px solid var(--text);
}

.access-rankings .section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ranking-grid section {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.ranking-grid h3 {
  margin: 0;
  padding: 12px 0 8px;
  font-size: 15px;
  font-weight: 900;
}

.ranking-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.ranking-list li > span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.ranking-list a {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.ranking-empty {
  display: block !important;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 20px 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.site-footer p {
  margin: 4px 0;
}

@media (max-width: 860px) {
  .topline,
  .hero {
    grid-template-columns: 1fr;
  }

  .topline {
    align-items: flex-start;
  }

  .tagline {
    text-align: left;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-rail {
    position: static;
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .site-header,
  main,
  .site-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .nav a {
    padding: 12px 13px;
  }

  .story {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .story-rank {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .story h2 {
    font-size: 20px;
  }

  .affiliate-links,
  .archive-row,
  .ranking-grid {
    grid-template-columns: 1fr;
  }

  .archive-row {
    gap: 4px;
  }
}
