/* Project page styling, based on the Nerfies academic page template. */

body {
  font-family: 'Noto Sans', sans-serif;
  color: #1f2328;
  background: #ffffff;
}

.publication-title,
.publication-subtitle,
.publication-authors,
h1, h2, h3, h4 {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}

.publication-title {
  line-height: 1.2 !important;
  letter-spacing: -0.015em;
  color: #0f172a;
}

.publication-subtitle {
  color: #4a5568;
  font-weight: 400;
  margin-top: 0.75rem !important;
}

.author-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 2.5rem;
  margin-top: 0.75rem;
}

.fancy_text_color {
  color: #3d7ade;
  font-weight: 500;
}

.link-block a {
  margin: 5px 4px;
}

.container {
  max-width: none;
}

.publication-header {
  padding-top: 3.5rem;
  padding-bottom: 1rem;
}

html {
  scroll-behavior: smooth;
}

.textsc {
  font-variant: small-caps;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  background: #f3f5f8;
  color: #1f2328;
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding: 0;
}

/* TL;DR callout */
.tldr {
  background: #f3f7fd;
  border-left: 4px solid #3d7ade;
  border-radius: 6px;
  padding: 1rem 1.35rem;
  margin: 0 auto 1.5rem;
  font-size: 1.02rem;
  line-height: 1.6;
  text-align: left;
}

/* Key metrics strip */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.metric-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 0.85rem;
  text-align: center;
}

.metric-value {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.78rem;
  color: #52514e;
  margin-top: 0.3rem;
  line-height: 1.35;
}

@media screen and (max-width: 768px) {
  .metric-strip {
    grid-template-columns: 1fr;
  }
}

#content .content {
  text-align: left;
}

/* Section spacing */
#content > .section {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

#content h2.title,
#content h3.title {
  scroll-margin-top: 1.5rem;
}

#content h3.title {
  text-align: center;
  margin-top: 2rem;
}

/* Tables */
#content .content table {
  width: 100%;
  font-size: 0.88rem;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-variant-numeric: tabular-nums;
  display: block;
  overflow-x: auto;
}

#content .content table thead th {
  background: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
  color: #1e293b;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  white-space: nowrap;
}

#content .content table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.48rem 0.65rem;
  vertical-align: top;
}

#content .content table tbody tr:hover {
  background: #f8fafc;
}

/* Method figure */
#content .content figure.method-fig {
  margin: 1.5rem 0;
  text-align: center;
}

#content .content figure.method-fig img {
  display: block;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.75rem;
}

#content .content figure figcaption {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #64748b;
  text-align: left;
}

/* 2x2 finding cards */
.finding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}

.finding-card {
  background: #f5f7fb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1.05rem;
  font-size: 0.88rem;
  text-align: left;
  line-height: 1.55;
}

.finding-card strong {
  color: #0f172a;
}

@media screen and (max-width: 768px) {
  .finding-grid {
    grid-template-columns: 1fr;
  }
}

/* Interactive Chess Demo (grid) */
.chess-demo {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas:
    "blabel plabel"
    "board  panel"
    "nav    actions";
  column-gap: 1.5rem;
  row-gap: 0.85rem;
  margin: 1.75rem 0 2rem;
}

.chess-label {
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  color: #363636;
  text-align: center;
  font-size: 0.95rem;
}

.chess-label-board { grid-area: blabel; }
.chess-label-panel { grid-area: plabel; }

.chess-board-wrap {
  grid-area: board;
  padding-left: 1.25rem;
  padding-bottom: 1.4rem;
}

.chess-board {
  width: 100%;
  aspect-ratio: 1 / 1;
}

.chess-board cg-board {
  background-color: #dcbc87;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23bb7741' d='M1 0h1v1h-1zM3 0h1v1h-1zM5 0h1v1h-1zM7 0h1v1h-1zM0 1h1v1h-1zM2 1h1v1h-1zM4 1h1v1h-1zM6 1h1v1h-1zM1 2h1v1h-1zM3 2h1v1h-1zM5 2h1v1h-1zM7 2h1v1h-1zM0 3h1v1h-1zM2 3h1v1h-1zM4 3h1v1h-1zM6 3h1v1h-1zM1 4h1v1h-1zM3 4h1v1h-1zM5 4h1v1h-1zM7 4h1v1h-1zM0 5h1v1h-1zM2 5h1v1h-1zM4 5h1v1h-1zM6 5h1v1h-1zM1 6h1v1h-1zM3 6h1v1h-1zM5 6h1v1h-1zM7 6h1v1h-1zM0 7h1v1h-1zM2 7h1v1h-1zM4 7h1v1h-1zM6 7h1v1h-1z'/%3E%3C/svg%3E");
}

.chess-board coords {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.72rem;
  opacity: 1;
}

/* Label colour contrasts with its square: a1 is dark, so odd files/ranks sit on
   dark squares from White's side and on light squares from Black's side. */
.chess-board coords coord {
  color: #4a3420 !important;
}

.chess-board coords:not(.black) coord:nth-child(odd),
.chess-board coords.black coord:nth-child(even) {
  color: #f3e4c8 !important;
}

/* Chessground's stock file labels sit 24px right (sized for Lichess boards),
   which pushes them into the next square on this board. Keep them inside. */
.chess-board coords.files {
  left: 0;
  bottom: 1px;
  text-align: right;
  text-transform: none;
}

.chess-board coords.files coord {
  flex: 1 1 0;
  padding-right: 3px;
}

.chess-panel {
  grid-area: panel;
  position: relative;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  background: #fcfcfd;
  min-height: 300px;
}

.chess-panel-body {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
  text-align: left;
  font-size: 0.88rem;
}

.game-meta {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.65rem;
  margin-bottom: 0.75rem;
}

.game-meta-title {
  font-family: 'Google Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

.game-meta-sub {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.move-list {
  line-height: 1.85;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}

.move-num {
  color: #94a3b8;
  font-size: 0.82rem;
  margin-right: 0.2rem;
  user-select: none;
}

.move-btn {
  display: inline-block;
  cursor: pointer;
  padding: 0.05rem 0.3rem;
  margin-right: 0.28rem;
  border-radius: 4px;
  border: none;
  background: transparent;
  font: inherit;
  color: #1e293b;
}

.move-btn:hover {
  background: #e8f0fc;
}

.move-btn.is-opening {
  color: #64748b;
}

.move-btn.is-current {
  background: #3d7ade;
  color: #ffffff;
  font-weight: 600;
}

.chess-nav {
  grid-area: nav;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chess-actions {
  grid-area: actions;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.chess-count {
  font-family: 'Google Sans', sans-serif;
  color: #64748b;
  font-size: 0.85rem;
  min-width: 4.5rem;
  text-align: center;
}

@media screen and (max-width: 768px) {
  .chess-demo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "blabel" "board" "nav" "plabel" "panel" "actions";
  }
  .chess-panel-body {
    position: static;
    max-height: 280px;
  }
}

/* Interactive SVG Charts */
#content .content figure.chart-fig {
  margin: 1.5rem 0 2rem;
  scroll-margin-top: 1.5rem;
  text-align: left;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.25rem;
  font-size: 0.84rem;
  color: #52514e;
  margin-bottom: 0.4rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-plot {
  position: relative;
  width: 100%;
}

.chart-plot svg {
  display: block;
  width: 100%;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}

.chart-tick {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  fill: #64748b;
}

.chart-axis-title {
  font-size: 12.5px;
  fill: #334155;
  font-weight: 500;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.10);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 10;
}

.chart-tooltip-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.2rem;
}

.chart-table {
  font-size: 0.84rem;
  margin-top: 0.35rem;
}

.chart-table summary {
  cursor: pointer;
  color: #52514e;
  user-select: none;
}

/* Sticky sidebar Table of Contents */
.toc {
  display: none;
}

@media screen and (min-width: 1240px) {
  .toc {
    display: block;
    position: fixed;
    top: 50%;
    left: 1.5rem;
    transform: translateY(-50%);
    width: 190px;
    font-family: 'Google Sans', sans-serif;
    font-size: 0.88rem;
    max-height: 80vh;
    overflow-y: auto;
  }
}

.toc-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1e293b;
  font-size: 0.9rem;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.75rem;
  border-left: 2px solid #e2e8f0;
  color: #64748b;
  text-decoration: none;
  line-height: 1.35;
}

.toc a:hover {
  color: #3d7ade;
}

.toc li.toc-sub a {
  padding-left: 1.5rem;
  font-size: 0.8rem;
}

.toc a.is-active {
  border-left-color: #3d7ade;
  color: #3d7ade;
  font-weight: 600;
}
