:root {
  --bg: #f3efe6;
  --bg-soft: #fffaf1;
  --surface: #fffdf9;
  --ink: #1c242d;
  --muted: #55606d;
  --line: #d7cdbf;
  --accent: #c15a2a;
  --accent-2: #0f8a83;
  --accent-3: #234865;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 14px 30px rgba(26, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(193, 90, 42, 0.12), transparent 33%),
    radial-gradient(circle at 85% 8%, rgba(15, 138, 131, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #ece4d6 100%);
  line-height: 1.55;
}

.site-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 24px 18px;
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  z-index: 20;
  background: linear-gradient(180deg, rgba(243, 239, 230, 0.97), rgba(243, 239, 230, 0.8));
  border-bottom: 1px solid rgba(215, 205, 191, 0.75);
  transition: padding 0.22s ease, background 0.22s ease;
}

.site-header.compact {
  padding: 10px 24px;
  background: linear-gradient(180deg, rgba(243, 239, 230, 0.98), rgba(243, 239, 230, 0.94));
}

.brand-block {
  max-height: 320px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.2s ease, margin 0.24s ease;
}

.site-header.compact .brand-block {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin: 0;
  pointer-events: none;
}

.brand-block h1 {
  margin: 5px 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-3);
  margin: 0;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(35, 72, 101, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.82rem;
}

.meta-chip strong {
  color: var(--accent-3);
  font-weight: 700;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.site-header.compact .top-nav {
  margin-top: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.site-header.compact .top-nav a {
  font-size: 0.84rem;
  padding: 7px 10px;
  white-space: nowrap;
}

.top-nav a {
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(215, 205, 191, 0.8);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.top-nav a:hover,
.top-nav a.active {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #da7846);
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.95), rgba(255, 250, 242, 0.95));
  border: 1px solid rgba(215, 205, 191, 0.9);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2vw, 28px);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.hero-panel {
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(35, 72, 101, 0.22), rgba(35, 72, 101, 0));
  top: -170px;
  right: -100px;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}

.highlight-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.hero-points {
  margin-top: 8px;
}

.link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.chip {
  text-decoration: none;
  color: #fff;
  background: linear-gradient(130deg, var(--accent-3), #34698f);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.87rem;
}

.kpi-card-wrap,
.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card,
.stat-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
}

.kpi-card p,
.stat-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.kpi-card strong,
.stat-card strong {
  font-size: 1.35rem;
  font-family: "Space Grotesk", sans-serif;
}

.section-head h2 {
  margin: 4px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.two-col-note,
.pipeline-grid,
.scenario-grid,
.three-col-grid,
.prep-mode-grid,
.table-grid-2,
.demo-grid,
.case-grid {
  display: grid;
  gap: 16px;
}

.two-col-note,
.scenario-grid,
.table-grid-2,
.demo-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pipeline-grid,
.three-col-grid,
.prep-mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.case-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.step-card,
.discussion-box,
.ext-card,
.case-card,
.demo-form,
.demo-result,
.lr-note-card,
.two-col-note article,
.three-col-grid article {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}

.step-card h3,
.ext-card h3,
.discussion-box h3,
.two-col-note h3,
.three-col-grid h3,
.case-card h3,
.demo-result h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}

.sample-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.sample-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.sample-title {
  margin: 6px 0 4px;
  font-weight: 700;
}

.sample-text {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.ghost-btn,
.primary-btn,
.tab-btn,
.lightbox-close,
.text-modal-close {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 0.86rem;
}

.ghost-btn {
  background: #fff;
  color: var(--accent-3);
}

.primary-btn {
  background: linear-gradient(130deg, var(--accent), #da7846);
  color: #fff;
  border-color: #be5b2d;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.eda-figure-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "rating token"
    "missing token";
  align-items: stretch;
}

.eda-figure-grid .eda-card-rating {
  grid-area: rating;
}

.eda-figure-grid .eda-card-token {
  grid-area: token;
  display: flex;
  flex-direction: column;
}

.eda-figure-grid .eda-card-missing {
  grid-area: missing;
}

.eda-figure-grid .eda-card-token img {
  flex: 1;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.figure-grid.narrow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.figure-grid.single-figure {
  grid-template-columns: 1fr;
}

.figure-card {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.figure-card img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.figure-card figcaption {
  font-size: 0.84rem;
  color: var(--muted);
  padding: 10px 12px 12px;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.control-row input,
.control-row select,
.demo-form input,
.demo-form select,
.demo-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.control-row input,
.control-row select {
  min-width: 180px;
  width: auto;
}

.control-row.compact {
  margin-top: -4px;
}

.metric-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}

.metric-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.metric-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.metric-goal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.metric-goal.up {
  color: #0b6b37;
  background: #e8f8ee;
  border-color: #b7e9cc;
}

.metric-goal.down {
  color: #8a4f00;
  background: #fff2de;
  border-color: #f2d2a5;
}

.legend-swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.table-wrap-fit {
  overflow-x: hidden;
}

.table-wrap-fit table {
  min-width: 0;
  width: 100%;
}

.table-wrap-fit th,
.table-wrap-fit td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 14px;
}

.table-wrap-compact table {
  min-width: 0;
  table-layout: fixed;
}

.table-wrap-compact th,
.table-wrap-compact td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.82rem;
  padding: 8px 9px;
}

.table-wrap-compact th.metric-divider,
.table-wrap-compact td.metric-divider {
  border-right: 2px solid #b98f6e;
}

.value-with-delta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #e6b2ad;
  background: #fff0ef;
  color: #992c24;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 820px;
}

th,
td {
  border-bottom: 1px solid #eee7da;
  padding: 10px 12px;
  font-size: 0.88rem;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f7f2e8;
  font-family: "Space Grotesk", sans-serif;
  z-index: 1;
}

tr:hover td {
  background: #fff7eb;
}

td.metric-rank {
  font-weight: 700;
}

.metric-rank-1 {
  background: #e68457;
  color: #1f120b;
}

.metric-rank-2 {
  background: #f2ad8e;
  color: #2a1a11;
}

.metric-rank-3 {
  background: #f8d5c4;
  color: #3a2a21;
}

tr:hover td.metric-rank-1 {
  background: #e68457;
}

tr:hover td.metric-rank-2 {
  background: #f2ad8e;
}

tr:hover td.metric-rank-3 {
  background: #f8d5c4;
}

.architecture-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.flow-node {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.87rem;
}

.flow-arrow {
  color: var(--muted);
  font-weight: 700;
}

.tab-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tab-btn {
  background: #fff;
  color: var(--ink);
}

.tab-btn.active {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(130deg, var(--accent), #da7846);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.bars-wrap {
  display: grid;
  gap: 8px;
  margin: 8px 0 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 300px 1fr 84px;
  gap: 10px;
  align-items: center;
}

.bar-label {
  font-size: 0.84rem;
}

.bar-track {
  width: 100%;
  height: 13px;
  border-radius: 999px;
  background: #efe5d8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), #49b4a8);
}

.bar-value {
  text-align: right;
  font-family: "Space Grotesk", sans-serif;
}

.artifact-links {
  margin: 0;
  padding-left: 18px;
}

.artifact-links a {
  color: var(--accent-3);
}

.case-tag,
.case-source,
.case-meta,
.case-note {
  margin: 0 0 6px;
  font-size: 0.84rem;
}

.case-tag {
  display: inline-block;
  background: rgba(15, 138, 131, 0.1);
  border: 1px solid rgba(15, 138, 131, 0.25);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
  color: #0c6f69;
}

.case-source {
  color: var(--muted);
}

.ig-xai-block {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.ig-xai-block h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.ig-xai-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.ig-case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ig-case-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
}

.ig-case-card.is-correct {
  border-color: #b8e6cf;
  background: linear-gradient(180deg, #fcfffd, #f7fffa);
}

.ig-case-card.is-incorrect {
  border-color: #f0d2c0;
  background: linear-gradient(180deg, #fffdfa, #fff8f4);
}

.ig-case-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ig-case-tag {
  margin: 0;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.ig-case-tag.ok {
  color: #0d6b43;
  background: #e8f8ef;
  border-color: #bfe9d1;
}

.ig-case-tag.err {
  color: #a6481e;
  background: #fff1e8;
  border-color: #f3cdb7;
}

.ig-case-id {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.ig-case-card h4 {
  margin: 2px 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.ig-case-metrics {
  margin: 0 0 8px;
  font-size: 0.83rem;
  color: #334250;
}

.ig-case-insight {
  margin: 0 0 10px;
  font-size: 0.87rem;
}

.ig-inline-line {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  border: 1px solid #d7e0da;
  border-radius: 10px;
  padding: 8px;
  margin: 0 0 10px;
  background: #ffffff;
  white-space: nowrap;
  overflow-x: auto;
}

.ig-inline-line span {
  display: inline-block;
}

.ig-word {
  display: inline;
  padding: 1px 2px;
  border-radius: 3px;
}

.ig-word-hit {
  color: #1f2b2b;
}

.ig-top-line {
  margin: 0 0 10px;
  font-size: 0.79rem;
  color: var(--muted);
}

.space-embed-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 10px 0 14px;
}

.space-embed-card h3 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", sans-serif;
}

.space-embed-note {
  margin: 0 0 10px;
  font-size: 0.86rem;
  color: var(--muted);
}

.space-iframe {
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.demo-form {
  display: grid;
  gap: 8px;
}

.demo-form label {
  font-size: 0.86rem;
  font-weight: 600;
}

.lightbox,
.text-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 21, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

.lightbox.show,
.text-modal.show {
  display: flex;
}

.lightbox {
  flex-direction: column;
}

.lightbox img {
  max-width: min(95vw, 1400px);
  max-height: 85vh;
  border: 2px solid #fff;
  border-radius: 8px;
}

.lightbox-close {
  margin-bottom: 8px;
  background: #f4ece0;
  color: #1a232d;
}

.text-modal-card {
  width: min(820px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px;
}

.text-modal-close {
  background: #f4ece0;
  color: #1a232d;
  float: right;
}

.text-modal-card h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: riseIn 0.42s ease both;
}

.panel:nth-child(2) {
  animation-delay: 0.06s;
}

.panel:nth-child(3) {
  animation-delay: 0.1s;
}

.panel:nth-child(4) {
  animation-delay: 0.16s;
}

.panel:nth-child(5) {
  animation-delay: 0.2s;
}

@media (max-width: 1060px) {
  .hero-grid,
  .pipeline-grid,
  .scenario-grid,
  .three-col-grid,
  .prep-mode-grid,
  .figure-grid,
  .figure-grid.narrow,
  .two-col-note,
  .table-grid-2,
  .demo-grid,
  .case-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }

  .ig-case-grid {
    grid-template-columns: 1fr;
  }

  .space-iframe {
    min-height: 620px;
  }

  .site-header {
    position: relative;
  }

  .eda-figure-grid {
    grid-template-areas:
      "rating"
      "token"
      "missing";
    align-items: start;
  }

  .eda-figure-grid .eda-card-token img {
    flex: none;
    height: auto;
  }

  main {
    padding: 16px;
  }
}
