/* Petri Top-40 Results — academic / leaderboard look. */

:root {
  --fg: #1c1c1c;
  --muted: #5a5a5a;
  --rule: #d4d4d4;
  --rule-soft: #ebebeb;
  --bg: #ffffff;
  --row-alt: #f8f8f6;
  --row-hover: #eef2f6;
  --link: #2a4d8f;
  --link-hover: #11305f;
  --tab-active: #1c1c1c;
  --tab-accent: #2a4d8f;
  --positive: #1d6e3a;
  --negative: #8a1d1d;
  --max-width: 880px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, "Liberation Sans", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--rule-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

img { max-width: 100%; height: auto; display: block; }

/* ----- Layout ----- */
.site-header,
.section,
.site-footer {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.site-header {
  padding-top: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

nav.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.92rem;
}
nav.toc a { color: var(--muted); }
nav.toc a:hover { color: var(--link-hover); }

main { padding-bottom: 1rem; }

.section {
  padding-top: 2rem;
  padding-bottom: 0.75rem;
}
.section + .section {
  border-top: 1px solid var(--rule-soft);
  margin-top: 0.5rem;
}

.section h1 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
}
.section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.6rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--rule-soft);
}
.section h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 1.2rem 0 0.4rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section p {
  margin: 0.55rem 0;
}
.section ul, .section ol {
  margin: 0.4rem 0 0.6rem 1.4rem;
}
.section li { margin: 0.2rem 0; }

/* ----- Tables ----- */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
  margin: 0.7rem 0 1.1rem;
}

th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
}
thead th {
  border-bottom: 1.5px solid var(--rule);
  font-weight: 600;
  background: #fbfbfa;
  white-space: nowrap;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}
tbody tr:nth-child(even) td { background: var(--row-alt); }
tbody tr:hover td { background: var(--row-hover); }

td.rank   { width: 2.6rem; color: var(--muted); }
td.model  { font-weight: 500; }
td.family { color: var(--muted); font-size: 0.9rem; }
td.score, th.score, td.count, th.count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.delta { color: var(--muted); }
td.delta.positive { color: var(--positive); }
td.delta.negative { color: var(--negative); }

/* Markdown-rendered tables (e.g. methodology). */
.section table:not(.leaderboard):not(.family-comparison) {
  font-size: 0.92rem;
}

/* ----- Image tabs ----- */
.image-tabs {
  margin: 1.1rem 0 1.4rem;
}
.image-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--rule);
}
.image-tab-btn {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0.55rem 0.4rem;
  margin: 0 1.1rem -1px 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 100ms, border-bottom-color 100ms;
}
.image-tab-btn:hover { color: var(--fg); }
.image-tab-btn.is-active {
  color: var(--tab-active);
  border-bottom-color: var(--tab-accent);
  font-weight: 500;
}
.image-tab-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

.image-tab-panel {
  margin: 0;
  padding: 1rem 0 0;
}
.image-tab-panel[hidden] { display: none; }
.image-tab-panel img {
  margin: 0 auto;
  max-height: 520px;
  width: auto;
  max-width: 100%;
}

/* Any chart image is click-to-enlarge. */
.section img { cursor: zoom-in; }

/* ----- Lightbox ----- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.94);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
  cursor: zoom-out;
}
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 96vw;
  max-height: calc(100vh - 5rem);
}
.lightbox-stage img {
  max-width: 96vw;
  max-height: calc(100vh - 6rem);
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.lightbox-caption {
  margin-top: 0.85rem;
  color: #ddd;
  font-size: 0.88rem;
  text-align: center;
  max-width: 90vw;
}
.lightbox-caption:empty { display: none; }
.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 0.85rem;
  appearance: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0.85;
}
.lightbox-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }
.lightbox-close:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Text-mode lightbox: scrollable transcript panel. */
.lightbox-text {
  background: #fff;
  color: var(--fg);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  width: min(880px, 96vw);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding: 1.6rem 1.9rem 1.4rem;
  cursor: default;
  font-size: 0.94rem;
  line-height: 1.55;
}
.lightbox-text h1 {
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
  font-weight: 600;
}
.lightbox-text h2 {
  font-size: 1rem;
  margin: 1.4rem 0 0.4rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--muted);
}
.lightbox-text h3 {
  font-size: 0.82rem;
  margin: 1.5rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.lightbox-text blockquote {
  margin: 0.4rem 0 0.6rem;
  padding: 0.1rem 0.85rem;
  border-left: 3px solid var(--rule);
  color: var(--fg);
  background: #fafaf8;
}
.lightbox-text blockquote p { margin: 0.45rem 0; }
.lightbox-text hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 1.2rem 0;
}
.lightbox-text strong { color: #111; }

/* ----- Transcript card ----- */
.transcript-card {
  margin: 1rem 0 1.4rem;
}
.transcript-trigger {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  background: #fafaf8;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--tab-accent);
  border-radius: 3px;
  padding: 0.9rem 1.1rem 0.7rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
}
.transcript-trigger:hover {
  background: #f4f4f0;
  border-color: #b9b9b9;
}
.transcript-trigger:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
.transcript-excerpt blockquote {
  margin: 0;
  padding: 0;
  border-left: none;
  font-style: normal;
  color: var(--fg);
}
.transcript-excerpt blockquote p {
  margin: 0.35rem 0;
}
.transcript-excerpt blockquote p:first-child { margin-top: 0; }
.transcript-excerpt blockquote p:last-child { margin-bottom: 0; }
.transcript-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--rule);
  font-size: 0.82rem;
  color: var(--muted);
  gap: 1rem;
  flex-wrap: wrap;
}
.transcript-source { font-style: italic; }
.transcript-more { color: var(--link); white-space: nowrap; }
.image-tab-caption {
  margin-top: 0.65rem;
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
}

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ----- Hero / signup ----- */
.hero {
  padding-top: 2.4rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule-soft);
}
.hero-title {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  line-height: 1.1;
}
.hero-byline {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.hero-tagline {
  margin: 0 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.signup-form {
  margin: 3.4rem auto 0;
  max-width: 520px;
  text-align: center;
}
.signup-label {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.signup-row {
  display: flex;
  gap: 0.5rem;
}
.signup-row input[type='email'] {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
}
.signup-row input[type='email']:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px rgba(42, 77, 143, 0.15);
}
.signup-row button {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--link);
  border-radius: 4px;
  background: var(--link);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.signup-row button:hover { background: var(--link-hover); border-color: var(--link-hover); }
.signup-row button:disabled { opacity: 0.6; cursor: default; }
.signup-status {
  margin: 0.55rem 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
}
.signup-status.is-success { color: var(--positive); }
.signup-status.is-error { color: var(--negative); }

/* ----- Small screens ----- */
@media (max-width: 760px) {
  .site-header, .section, .site-footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
  table { font-size: 0.85rem; }
  th, td { padding: 0.4rem 0.5rem; }
  td.family { display: none; }
  thead th:nth-child(3) { display: none; }
  .image-tab-btn {
    padding: 0.5rem 0.3rem;
    margin-right: 0.85rem;
    font-size: 0.85rem;
  }
  .hero-title { font-size: 1.9rem; }
  .signup-row { flex-direction: column; }
  .signup-row button { width: 100%; }
}
