/* Page wrapper, grille layout, contenu principal, sections */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- Page content wrapper (grows to push footer down) ----- */
.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Home: espace au-dessus du bloc de texte */
body.is-home .content {
  padding-top: 1.25rem;
}

/* ----- Layout ----- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem var(--page-padding-x);
  width: 100%;
}

/* About CharlesGPT: full-width content, no sidebar (more room for explanations/sketches) */
.page-no-sidebar .layout {
  grid-template-columns: 1fr;
}
.page-no-sidebar #site-sidebar {
  display: none;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1.5rem;
  }
}

/* ----- Main content ----- */
.content {
  min-width: 0;
}

.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-icon {
  font-size: 1.2rem;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
}

.section-subtitle a {
  color: var(--accent);
  text-decoration: none;
}

.section-subtitle a:hover {
  text-decoration: underline;
}

.content p {
  margin: 0 0 0.75rem 0;
  color: var(--text);
}

.content a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}

.content strong {
  font-weight: 700;
  color: var(--text);
}

.content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem 0;
}

.content h3:first-of-type {
  margin-top: 0.5rem;
}

.about-lead {
  margin-bottom: 1rem;
}
.about-lead a {
  font-weight: 700;
}

/* About CharlesGPT: sticky title + plan on scroll (below site header) */
.about-page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
@media (min-width: 769px) {
  .about-page-header {
    top: 3rem;
  }
}

.section-title--centered {
  text-align: center;
}

.about-plan {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0 0.75rem;
  margin: 1.25rem 0 0 0;
  padding: 0;
  font-size: 0.9rem;
}
.about-plan a {
  white-space: nowrap;
  font-weight: 400;
  text-decoration: none;
  color: var(--accent);
}
.about-plan a.is-active {
  font-weight: 700;
}
.about-plan a:hover {
  text-decoration: underline;
}
@media (max-width: 640px) {
  .about-plan {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0.75rem;
  }
}

/* Scroll margin so anchored h3s don’t sit under fixed header */
/* Inline reference links [1], [2] in about page */
.ref-inline {
  font-size: 0.85em;
  font-weight: 600;
  text-decoration: none;
}
.ref-inline:hover {
  text-decoration: underline;
}

.references-list li[id] {
  scroll-margin-top: 6rem;
}

.section-about-charlesgpt h3[id],
.section-about-tipe h3[id] {
  scroll-margin-top: 6rem;
}

/* TIPE project page: theorem box + figure grid */
.tipe-result-box {
  border: 2px solid var(--border, #e2e8f0);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.25rem 0;
  border-radius: 8px;
  background: var(--bg-muted, #f8fafc);
}

[data-theme="dark"] .tipe-result-box {
  background: var(--bg-muted, #1e293b);
}

.tipe-figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  align-items: start;
}

/* TIPE “Simple modeling”: 2-up, then wide rule strip, then narrow centered image + full-width caption */
.tipe-modeling-gallery {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1rem 0;
}

.tipe-modeling-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 560px) {
  .tipe-modeling-pair {
    grid-template-columns: 1fr;
  }
}

.tipe-figure--modeling-large {
  margin: 0;
}

.tipe-figure--modeling-large img {
  width: 100%;
  max-width: min(100%, 920px);
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.tipe-figure--modeling-density {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  max-width: 100%;
}

.tipe-figure-img-center {
  max-width: min(200px, 70%);
}

.tipe-figure-img-center img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
}

.tipe-figure--modeling-density figcaption {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  margin-top: 0.5rem;
  text-align: left;
}

.tipe-figure {
  margin: 0;
}

.tipe-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
}

.tipe-figure figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  line-height: 1.4;
}

.tipe-figure--wide {
  grid-column: 1 / -1;
  max-width: min(100%, 720px);
  margin-left: auto;
  margin-right: auto;
}

.content table,
.content-table {
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.content th,
.content td,
.content-table th,
.content-table td {
  border: 1px solid var(--border, #ddd);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.content th,
.content-table th {
  background: var(--bg-muted, #f5f5f5);
  font-weight: 600;
}

.about-sketch {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg-muted, rgba(0,0,0,0.04));
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre;
}

/* Interactive architecture diagram: viewport with zoom and pan */
.about-arch-diagram-viewport {
  position: relative;
  margin: 0.75rem 0;
  height: 520px;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg-muted, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.about-arch-diagram-viewport:active {
  cursor: grabbing;
}

.about-arch-diagram-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 420px;
  height: 520px;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

.about-arch-svg {
  display: block;
  width: 420px;
  height: 520px;
}

.about-arch-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 280px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #94a3b8);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.about-arch-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

.about-arch-tooltip-title {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--accent, #1e40af);
}

.about-arch-tooltip-body {
  font-size: 0.75rem;
  color: var(--text, #334155);
}

.about-arch-tooltip-body strong {
  color: var(--text, #1e293b);
}

.about-arch-reset-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  z-index: 2;
}

.about-arch-reset-btn:hover {
  background: var(--bg-muted, #f1f5f9);
  border-color: var(--accent, #3b82f6);
}

.about-formula {
  margin: 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg-muted, rgba(0,0,0,0.04));
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* KaTeX-rendered blocks (CharlesGPT about) */
.about-formula.about-formula--latex {
  font-family: inherit;
  font-size: inherit;
  text-align: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.9rem 1rem 1rem;
}

.about-formula.about-formula--latex .katex-display {
  margin: 0;
}

.about-formula.about-formula--latex .katex {
  font-size: 1.05em;
}

@media (max-width: 640px) {
  .about-formula.about-formula--latex .katex {
    font-size: 0.95em;
  }
}

.content-resume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.content-resume .resume-line-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--accent);
}

/* Paper list */
.paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.paper-item {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.paper-item:last-child {
  border-bottom: none;
}

.paper-authors {
  font-weight: 600;
  color: var(--text);
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  font-weight: 500;
}
