/* ===========================
   Project page: How far can we go with ImageNet for T2I generation?
   Builds on floss.css (shared .fl-* styles). Loaded only on /projects/t2i-imagenet/.
   =========================== */

:root {
  --t2i-ta: #cf5f8f;     /* TA (paper: CarnationPink) */
  --t2i-ia: #23977a;     /* TA + IA (paper: JungleGreen) */
  --t2i-ours: #d65c5c;
  --t2i-other: #7b8aa8;
}
[data-theme="dark"] {
  --t2i-ta: #ef8fb8;
  --t2i-ia: #5cc9a8;
  --t2i-ours: #f08a8a;
  --t2i-other: #9aa8c4;
}

.t2i .c-in { color: var(--fl-f); }
.t2i .fl-title { font-size: clamp(1.7rem, 4vw, 2.9rem); }

/* ---------- Teaser mosaic ---------- */
.t2i-teaser { padding-top: 1.5rem; }
.t2i-mosaic {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  border-radius: 14px; overflow: hidden;
}
.t2i-mosaic img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
@keyframes t2i-pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

/* ---------- Bubble charts ---------- */
.t2i-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.t2i-panel { background: var(--fl-soft); border: 1px solid var(--fl-line); border-radius: 12px; padding: 0.9rem 0.9rem 0.4rem; }
.t2i-panel h4 { margin-bottom: 0.25rem; }
.fl-chart .t2i-blabel { font-weight: 600; }
.fl-chart .t2i-blabel.is-ours { fill: var(--t2i-ours); font-weight: 800; }

/* ---------- Caption explorer ---------- */
.t2i-aio { font-family: var(--font-mono); font-size: 0.95em; background: var(--fl-soft); padding: 0.05rem 0.35rem; border-radius: 4px; }
.t2i-cap-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.t2i-cap-body { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; align-items: start; }
.t2i-cap-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; transition: opacity 0.3s ease; }
.t2i-cap-text p { font-family: var(--font-mono) !important; font-size: 0.86rem !important; line-height: 1.6; margin: 0 0 0.75rem; }
.t2i-cap-text p > span:first-child {
  display: inline-block; font: 700 0.7rem var(--font-sans); letter-spacing: 0.06em;
  padding: 0.1rem 0.45rem; border-radius: 999px; margin-right: 0.4rem; color: #fff; vertical-align: 1px;
}
.t2i-cap-aio { color: var(--fl-muted); text-decoration: line-through; text-decoration-color: var(--t2i-ours); }
.t2i-cap-aio > span:first-child { background: var(--fl-muted); }
.t2i-cap-ta > span:first-child { background: var(--t2i-ia); }

/* ---------- Overfitting curves ---------- */
.t2i-legend { font: 600 0.85rem var(--font-sans); display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.t2i-legend .sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-left: 0.6rem; }
.t2i-legend .sw:first-child { margin-left: 0; }
.t2i-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.t2i-three h4 { text-align: center; margin-bottom: 0.25rem; }

/* ---------- TA vs TA+IA pairs ---------- */
.t2i-pairs { margin: 1.5rem 0; }
.t2i-pair-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem 1rem; margin-top: 0.75rem; }
.t2i-pair { margin: 0; }
.t2i-pair-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.t2i-pair-imgs > div { position: relative; }
.t2i-pair-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.t2i-pair-imgs > div:first-child img { border-radius: 10px 0 0 10px; }
.t2i-pair-imgs > div:last-child img { border-radius: 0 10px 10px 0; }
.t2i-tag {
  position: absolute; top: 6px; left: 6px; font: 700 0.65rem var(--font-sans); letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem; border-radius: 999px; color: #fff; pointer-events: none;
}
.t2i-tag-l { background: var(--t2i-ta); }
.t2i-tag-r { background: var(--t2i-ia); }
.t2i-pair figcaption { font: 0.82rem var(--font-sans); color: var(--fl-muted); text-align: center; margin-top: 0.4rem; }

/* ---------- MIRO progression (all steps, revealed left to right) ---------- */
.t2i-miro-grid { display: grid; grid-template-columns: auto repeat(7, 1fr); gap: 4px; align-items: center; }
.t2i-miro-step { font: 600 0.78rem var(--font-sans); text-align: center; color: var(--fl-muted); }
.t2i-miro-row { font: 700 0.8rem var(--font-sans); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; padding: 0 0.25rem; }
.t2i-miro-cell { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 6px; }
.t2i-miro.is-armed .t2i-miro-cell, .t2i-miro.is-armed .t2i-miro-step { opacity: 0; }
.t2i-miro.is-on .t2i-miro-cell, .t2i-miro.is-on .t2i-miro-step { animation: t2i-pop 0.5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--k) * 0.45s); }
.t2i-prompt { text-align: center; font-style: italic; color: var(--fl-muted); margin: 0.75rem 0 0; }
.t2i-miro-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.t2i-miro-foot .fl-caption { margin: 0; }

/* ---------- Tables: readability ---------- */
.t2i .fl-table { font-size: 0.95rem; }
.t2i .fl-table th, .t2i .fl-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--fl-line); }
.t2i .fl-table thead th {
  font-size: 0.82rem; text-transform: none; letter-spacing: 0; font-weight: 700;
  color: var(--fl-ink); border-bottom: 2px solid var(--fl-ink); vertical-align: bottom; white-space: nowrap;
}
.t2i .fl-table tbody tr:hover td { background: var(--fl-soft); }
.t2i .fl-table td.t2i-model { font-weight: 700; }
.t2i .fl-table td.t2i-cont { border-bottom-color: transparent; }
.t2i .fl-table tr:has(+ tr .t2i-cont) td.t2i-model { border-bottom-color: transparent; }
.t2i .fl-table tr.is-ours td { background: var(--fl-ours); }
.t2i .fl-table tr.is-ours td:first-child { color: inherit; box-shadow: inset 3px 0 0 var(--t2i-ours); }
.t2i .fl-table tr.is-ours td.t2i-cont { box-shadow: none; background: transparent; }
.t2i .fl-table tr.is-ours td.t2i-cont + td { box-shadow: inset 3px 0 0 var(--t2i-ours); }
.t2i .fl-table tr.fl-sep td { height: 10px; padding: 0; border-bottom: 0; background: none; }
.t2i .fl-table b { color: var(--fl-ink); }
/* Grouped table (one <tbody> per model): centered model cell, rule between blocks */
.t2i .fl-table.t2i-grouped td { text-align: center; }
.t2i .fl-table.t2i-grouped td.t2i-model { vertical-align: middle; border-right: 1px solid var(--fl-line); }
.t2i .fl-table.t2i-grouped tbody + tbody tr:first-child td { border-top: 2px solid var(--fl-muted); }
.t2i .fl-table.t2i-grouped tbody tr:hover td.t2i-model { background: none; }

/* ---------- Generalization ---------- */
.t2i-gen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.5rem; }
.t2i-gen figure { margin: 0; }
.t2i-gen img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; transition: transform 0.3s ease; }
.t2i-gen img:hover { transform: scale(1.03); }
.t2i-gen figcaption { font: 0.78rem var(--font-mono); color: var(--fl-muted); margin-top: 0.45rem; line-height: 1.45; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .t2i-mosaic { grid-template-columns: repeat(4, 1fr); }
  .t2i-three, .t2i-pair-grid { grid-template-columns: 1fr 1fr; }
  .t2i-panels { grid-template-columns: 1fr; }
  .t2i-gen { grid-template-columns: 1fr 1fr; }
  .t2i-cap-body { grid-template-columns: 1fr; }
  .t2i-cap-img { max-width: 260px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .t2i-mosaic { grid-template-columns: repeat(3, 1fr); }
  .t2i-three, .t2i-pair-grid { grid-template-columns: 1fr; }
  .t2i-miro { overflow-x: auto; }
  .t2i-miro-grid { min-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  .t2i-miro-cell, .t2i-miro-step { animation: none !important; opacity: 1 !important; }
}
