/* TIPSv2 — D4RT-inspired stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap');

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Google Sans', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px;
  background-color: #fff;
}

/* ── Typography ───────────────────────────────────────────── */
h1 {
  font-size: 2.2em;
  font-weight: 500;
  color: #202124;
  text-align: center;
  margin-bottom: 0.5em;
}

h2 {
  font-size: 1.5em;
  font-weight: 500;
  color: #202124;
  text-align: left;
  margin-top: 0;
  margin-bottom: 0.8em;
}

h3 {
  font-size: 1.1em;
  font-weight: 500;
  color: #202124;
  margin-top: 1.4em;
  margin-bottom: 0.4em;
}

p {
  font-size: 0.92em;
  line-height: 1.7;
  text-align: justify;
  color: #3c4043;
  margin-top: 0;
}

a, a:visited {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
}
a:hover { color: #185abc; text-decoration: underline; }

/* ── Authors block ────────────────────────────────────────── */
.authors {
  text-align: center;
  margin: 12px 0 6px;
  font-size: 0.95em;
  color: #3c4043;
}
.authors span {
  display: inline-block;
  margin: 2px 6px;
  white-space: nowrap;
}

.affiliations {
  text-align: center;
  font-size: 0.85em;
  color: #5f6368;
  margin-bottom: 24px;
}

/* ── Link buttons ─────────────────────────────────────────── */
.links {
  text-align: center;
  margin-bottom: 36px;
}
.links a {
  display: inline-block;
  margin: 4px 8px;
  padding: 10px 22px;
  background-color: #1a73e8;
  color: white !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  transition: background-color 0.25s, box-shadow 0.25s;
}
.links a:hover {
  background-color: #185abc;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* ── Card sections ────────────────────────────────────────── */
.card {
  background-color: rgba(248, 249, 250, 1);
  padding: 30px;
  border-radius: 24px;
  margin-bottom: 28px;
  border: 1px solid #e8eaed;
}

/* ── Images ───────────────────────────────────────────────── */
.summary-img {
  width: 100%;
  display: block;
  margin: 12px auto 4px;
  border-radius: 12px;
}

.fig-caption {
  text-align: center !important;
  font-size: 0.82em !important;
  color: #5f6368 !important;
  margin: 6px 0 16px !important;
  font-style: italic;
}

/* ── Placeholder images ───────────────────────────────────── */
.placeholder-img {
  border: 3px dashed #c44;
  background-color: #f9f0f0;
  min-height: 180px;
  object-fit: contain;
}
.placeholder-label {
  text-align: center;
  color: #c44;
  font-size: 0.78em;
  font-style: italic;
  margin: 4px 0 12px;
}

/* ── BibTeX code blocks ───────────────────────────────────── */
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background-color: #fff;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e8eaed;
  font-size: 0.82em;
  color: #3c4043;
  margin: 8px 0 20px;
  overflow-x: auto;
}
code { font-family: 'Roboto Mono', monospace; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { margin: 20px auto; padding: 0 14px; }
  h1 { font-size: 1.45em; }
  h2 { font-size: 1.25em; }
  .card { padding: 20px; border-radius: 18px; }
  .links a { padding: 8px 16px; margin: 4px 5px; font-size: 0.88em; }
  .authors { font-size: 0.82em; }
  .authors span { margin: 2px 4px; }
}
/* Side-by-side figures */
.fig-pair {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.fig-pair .fig-col {
  flex: 1;
  min-width: 0;
}
@media (max-width: 600px) {
  .fig-pair { flex-direction: column; gap: 0; }
}

/* PCA grid table */
.pca-grid {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 4px;
}
.pca-grid td {
  padding: 2px;
  width: 25%;
}
.pca-grid td img {
  width: 100%;
  display: block;
  border-radius: 4px;
}
.pca-grid .pca-label {
  text-align: center;
  font-size: 0.78em;
  color: #5f6368;
  padding: 4px 2px 0;
  font-weight: 500;
}

/* Interactive PCA selector */
.pca-selector-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 14px;
  padding: 8px 12px;
  margin: 0 auto 16px;
  display: flex;
  width: fit-content;
}
.pca-selector-label {
  font-size: 0.75em;
  font-weight: 500;
  color: #80868b;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pca-thumbs {
  display: flex;
  gap: 7px;
}
.pca-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2.5px solid transparent;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
.pca-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.pca-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(26,115,232,0.22);
  border-color: #93c1f8;
}
.pca-thumb-active {
  border-color: #1a73e8 !important;
  box-shadow: 0 4px 12px rgba(26,115,232,0.32) !important;
}
.pca-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.pca-grid-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.pca-img-wrap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.pca-item-orig {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.pca-item-tipsv2 {
  grid-column: 4;
  grid-row: 1 / span 2;
}
.pca-item-tips { grid-column: 2; grid-row: 1; }
.pca-item-siglip2 { grid-column: 3; grid-row: 1; }
.pca-item-dinov2 { grid-column: 2; grid-row: 2; }
.pca-item-dinov3 { grid-column: 3; grid-row: 2; }

.pca-grid-item img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.pca-compare-label {
  text-align: center;
  font-size: 0.78em;
  font-weight: 500;
  color: #5f6368;
  padding: 4px 0 0;
}
@media (max-width: 600px) {
  .pca-thumbs { gap: 6px; }
  .pca-compare { gap: 5px; }
}

/* Results tabs */
.rtab-bar {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 2px solid #1a73e8;
  scrollbar-width: none;
}
.rtab-bar::-webkit-scrollbar { display: none; }
.rtab {
  flex: 1;
  text-align: center;
  padding: 9px 18px;
  border-radius: 8px 8px 0 0;
  border: 1.5px solid #dadce0;
  border-bottom: none;
  background: #f1f3f4;
  color: #5f6368;
  font-family: 'Google Sans', Arial, sans-serif;
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 3px;
  margin-bottom: -2px;
  transition: background 0.15s, color 0.15s;
}
.rtab:hover {
  background: #e8f0fe;
  color: #1a73e8;
}
.rtab.active {
  background: #fff;
  color: #1a73e8;
  border-color: #1a73e8;
  border-bottom: 2px solid #fff;
  font-weight: 600;
}
.rtab-panel {
  display: none;
  border: 1.5px solid #1a73e8;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 20px;
  background: #fff;
  margin-bottom: 4px;
}
.rtab-panel.active {
  display: block;
}
@media (max-width: 600px) {
  .rtab { font-size: 0.74em; padding: 7px 12px; }
  .rtab-panel { padding: 16px; }
}
