/*
 * Extra visuals of the AI pages (tools/site/pages/ai_pages.py): /ia and /ia/<tool>.
 * Flat components: 1px lines, no shadows, soft tones.
 */

/* Inline code in the text of these pages (not inside the dark code windows) */
.ai-page :is(p, li, td, th, summary, small, h3) code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--soft);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.85em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-page .mk-code code {
  padding: 0;
  background: none;
}

/* ---------------------------------------------------------------- Hero of a tool */

.ai-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.ai-badges span {
  color: var(--muted);
  font-size: 0.85rem;
}

.ai-badges + h1 {
  margin-top: 18px;
}

.ai-page .mk-tag {
  font-size: 0.78rem;
}

.ai-tag-ok {
  background: #d9f2e3;
  color: #0e6b49;
}

.ai-after {
  margin: 28px 0 0;
  color: var(--muted);
}

.ai-sub {
  margin: 28px 0 14px;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- Server block of the hub */

.ai-server {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  margin-top: 36px;
}

.ai-server-copy {
  min-width: 0;
}

.ai-server-copy h3 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.ai-page .ai-server-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.ai-server-visual {
  min-width: 0;
  padding: 28px;
  border-radius: 16px;
  background: var(--sand, #f2efe6);
}

/* ---------------------------------------------------------------- Tables (stack into cards on phones) */

.ai-table-wrap {
  margin-top: 32px;
}

.ai-table td small {
  display: block;
  margin-top: 6px;
  line-height: 1.9;
}

.ai-table th code {
  display: block;
  width: fit-content;
  margin-top: 6px;
}

.ai-table a {
  color: var(--ink);
  font-weight: 500;
  text-underline-offset: 3px;
}

.ai-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.ai-legend-item {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.ai-page .ai-legend-item p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------------------------------------------------------------- Notes and boxes */

.ai-note {
  margin-top: 24px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.ai-note-soft {
  background: var(--soft);
  border-color: transparent;
}

.ai-note h3 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.ai-page .ai-note p {
  margin: 0 0 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ai-note p:last-child {
  margin-bottom: 0;
}

.ai-status-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.ai-req {
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--soft);
}

.ai-req h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 400;
}

.ai-page .ai-req p {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- Validation steps and numbered lists */

.ai-flow {
  display: grid;
  gap: 56px;
  margin-top: 40px;
}

.ai-olist {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-olist li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.ai-olist li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 1px solid var(--line-strong, #d2d3d9);
  border-radius: 50%;
  background: #fff;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}

.ai-page .ai-olist p {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
  transform: none;
}

.ai-snips {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ai-page .ai-snip {
  margin: 24px 0 0;
  color: var(--muted);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ai-page .ly-step-body > .ai-snip:first-child {
  margin-top: 0;
}

.ai-page .ai-snips > .ai-snip:first-child {
  margin-top: 8px;
}

.ai-page .ly-step-body > .ai-note {
  margin-top: 0;
}

.ai-page .ly-step-body > .ai-sub {
  margin: 10px 0 -4px;
}

.ai-page .ai-note p {
  color: var(--ink);
}

.ai-note-soft .mk-tag {
  background: #fff;
}

.ai-page .ai-plain .mk-faq {
  max-width: none;
  margin: 0;
}

/* ---------------------------------------------------------------- Scopes of a tool */

.ai-scopes {
  display: grid;
  gap: 10px;
}

.ai-scope-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.ai-scope-row b {
  display: block;
  font-weight: 500;
}

.ai-scope-row code {
  display: block;
  width: fit-content;
  margin-top: 6px;
}

.ai-page .ai-scope-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  transform: none;
}

/* ---------------------------------------------------------------- Chat example */

.ai-chat {
  display: grid;
  gap: 10px;
  padding: 22px;
  border-radius: 16px;
  background: var(--sand, #f2efe6);
}

.ai-page .ai-chat-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: none;
}

.ai-bubble {
  max-width: 34rem;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.5;
}

.ai-me {
  justify-self: end;
  background: #111;
  color: #fff;
}

.ai-bot {
  justify-self: start;
  border: 1px solid var(--line);
  background: #fff;
}

/* ---------------------------------------------------------------- Links and plain blocks */

.ai-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 24px;
  font-size: 0.95rem;
}

.ai-plain .ly-step-body {
  padding-left: 0;
}

.ai-page .mk-faq-a .mk-checks {
  margin: 4px 0 0;
}

.ai-page .mk-faq-a p {
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1000px) {
  .ai-server {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .ai-scope-row {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .ai-scope-row p {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .ai-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-server-visual {
    padding: 16px;
  }

  .ai-table-wrap.ly-table-wrap {
    overflow: visible;
    border: 0;
    background: none;
  }

  .ai-table,
  .ai-table tbody,
  .ai-table tr,
  .ai-table th,
  .ai-table td {
    display: block;
    width: 100%;
  }

  .ai-table caption {
    display: block;
    padding: 0 0 12px;
  }

  .ai-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .ai-table tbody tr {
    margin-bottom: 12px;
    padding: 6px 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }

  .ai-table tbody th,
  .ai-table tbody td {
    padding: 8px 16px;
    border: 0;
  }

  .ai-table tbody th {
    padding-top: 12px;
    font-size: 1.05rem;
  }

  .ai-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-family: "DM Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .ai-table-compact tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 10px;
  }

  .ai-table-compact tbody th {
    grid-column: 1 / -1;
  }

  .ai-table-compact tbody td:nth-of-type(1) {
    grid-area: 2 / 1;
  }

  .ai-table-compact tbody td:nth-of-type(3) {
    grid-area: 2 / 2;
  }

  .ai-table-compact tbody td:nth-of-type(2) {
    grid-area: 3 / 1 / 4 / -1;
  }

  .ai-table-compact tbody td:nth-of-type(4) {
    grid-area: 4 / 1 / 5 / -1;
  }

  .ai-scope-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .ai-bubble {
    max-width: 100%;
  }
}
