/* The text of posts and info pages: headings, lists, figures, the embedded diagram, detail
 * lists, callouts and FAQ accordions. Loaded after layout.css. */

/* ── Columns ────────────────────────────────────────────────────────────── */

/* Text in a readable column; figures wider, embedded diagrams as wide as the page. */
.prose {
  --content: 720px;
  --wide: 960px;
  display: grid;
  grid-template-columns:
    [full-start] minmax(0, 1fr)
    [wide-start] minmax(0, calc((var(--wide) - var(--content)) / 2))
    [content-start] min(var(--content), 100%)
    [content-end] minmax(0, calc((var(--wide) - var(--content)) / 2))
    [wide-end] minmax(0, 1fr) [full-end];
  font-size: 1.065rem;
  line-height: 1.75;
  color: var(--text);
}
.prose > * {
  grid-column: content;
}
.prose > figure {
  grid-column: wide;
}
.prose > .diagram-embed {
  grid-column: full;
}
.has-toc .prose {
  --content: 760px;
  --wide: 760px;
  grid-template-columns: [full-start wide-start content-start] minmax(0, 760px) [content-end wide-end full-end];
}

/* ── Text ───────────────────────────────────────────────────────────────── */

.prose > * + * {
  margin-top: 1.25em;
}
.prose h2 {
  margin-top: 2.4em;
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.85rem);
  scroll-margin-top: calc(var(--header-height) + 24px);
}
.prose h3 {
  margin-top: 2em;
  font-size: 1.3rem;
}
.prose h4 {
  margin-top: 1.8em;
  font-size: 1.08rem;
}
.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.75em;
}
.prose > :first-child {
  margin-top: 0;
}
.prose a:not(.btn) {
  color: var(--brand-700);
  text-decoration: underline;
  text-decoration-color: var(--brand-200);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  transition: text-decoration-color 0.15s;
}
.prose a:not(.btn):hover {
  text-decoration-color: currentColor;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li + li {
  margin-top: 0.5em;
}
.prose li::marker {
  color: var(--brand-500);
}
.prose ol > li::marker {
  font-weight: 650;
}
.prose code {
  padding: 0.15em 0.4em;
  color: var(--brand-900);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.prose em {
  color: var(--ink);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
}

/* ── Figures ────────────────────────────────────────────────────────────── */

.prose figure {
  margin-block: 2em;
}
.prose figure img {
  margin-inline: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.prose figcaption {
  margin-top: 12px;
  font-size: 0.88rem;
  text-align: center;
  color: var(--muted);
}

/* ── Embedded ER diagram ────────────────────────────────────────────────── */

.diagram-embed {
  display: flex;
  flex-direction: column;
  min-height: 720px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  resize: vertical;
}
.prose .diagram-embed {
  margin-block: 2.4em;
}
.diagram-embed-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.diagram-embed-dots {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background: #ff5f57;
  border-radius: 50%;
  box-shadow: 16px 0 0 #febc2e, 32px 0 0 #28c840;
  margin-right: 32px;
}
.diagram-embed-title {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagram-embed .btn {
  margin-left: auto;
  box-shadow: none;
}
.diagram-embed iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
}

/* ── Details of a diagram ───────────────────────────────────────────────── */

.prose .specs {
  display: grid;
  margin-block: 1.5em 0;
  overflow: hidden;
  font-size: 0.96rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.specs > div {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 20px;
}
.specs > div + div {
  border-top: 1px solid var(--line);
}
.specs > div:nth-child(odd) {
  background: var(--surface-soft);
}
.specs dt {
  font-weight: 600;
  color: var(--ink);
}
.specs dd {
  margin: 0;
  min-width: 0;
}
.specs code {
  font-size: 0.82em;
}

/* ── Callout (About Luna Modeler) ───────────────────────────────────────── */

.prose .callout {
  position: relative;
  margin-top: 2em;
  padding: 24px 28px 24px 76px;
  font-size: 0.97rem;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
}
.callout::before {
  content: "";
  position: absolute;
  top: 26px;
  left: 26px;
  width: 32px;
  height: 32px;
  background:
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cellipse cx='12' cy='5' rx='8' ry='3'/%3e%3cpath d='M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5'/%3e%3cpath d='M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3e%3c/svg%3e") center / 18px no-repeat,
    var(--gradient);
  border-radius: 9px;
}
.callout > * + * {
  margin-top: 0.8em;
}
.callout > p:first-child a {
  font-weight: 650;
}

/* ── FAQ ────────────────────────────────────────────────────────────────── */

.prose details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prose details + details {
  margin-top: 12px;
}
.prose details[open] {
  border-color: var(--brand-200);
  box-shadow: var(--shadow);
}
.prose summary {
  position: relative;
  display: block;
  padding: 18px 56px 18px 22px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}
.prose summary::-webkit-details-marker {
  display: none;
}
.prose summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  background:
    linear-gradient(var(--brand-700), var(--brand-700)) center / 10px 2px no-repeat,
    linear-gradient(var(--brand-700), var(--brand-700)) center / 2px 10px no-repeat,
    var(--brand-50);
  border-radius: 50%;
  transition: transform 0.2s;
}
.prose details[open] > summary::after {
  background:
    linear-gradient(var(--brand-700), var(--brand-700)) center / 10px 2px no-repeat,
    var(--brand-50);
  transform: rotate(180deg);
}
.prose summary:hover {
  color: var(--brand-700);
}
.prose details > div {
  padding: 0 22px 20px;
  font-size: 0.98rem;
}
.prose details > div > div > * + * {
  margin-top: 1em;
}
.prose details ul {
  padding-left: 1.3em;
}

@media (max-width: 720px) {
  .prose {
    font-size: 1.02rem;
  }
  .diagram-embed {
    min-height: 520px;
  }
  .diagram-embed-dots,
  .diagram-embed-title {
    display: none;
  }
  .specs > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .prose .callout {
    padding: 72px 20px 20px;
  }
  .callout::before {
    top: 22px;
    left: 20px;
  }
}

/* ── Heading anchors ────────────────────────────────────────────────────── */

.prose h2 {
  position: relative;
}
.prose .heading-anchor {
  margin-left: 0.35em;
  font-weight: 500;
  color: var(--brand-200);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.prose h2:hover .heading-anchor,
.prose .heading-anchor:focus-visible {
  opacity: 1;
}
.prose .heading-anchor:hover {
  color: var(--brand-700);
}

/* ── Build on the system (ER diagrams of open-source systems) ───────────── */

.prose .build-on {
  margin-top: 2.4em;
}
.build-on > * + * {
  margin-top: 1.25em;
}
.build-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.build-path {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.build-path-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
}
.prose .build-path h3 {
  margin-top: 6px;
  font-size: 1.12rem;
}
.prose .build-path p:last-child {
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}
.license-note {
  position: relative;
  padding: 18px 22px 18px 58px;
  font-size: 0.95rem;
  line-height: 1.65;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}
.license-note::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b45309' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M12 3 4 6v6c0 4.5 3.4 8.3 8 9 4.6-.7 8-4.5 8-9V6l-8-3Z'/%3e%3cpath d='m9 12 2 2 4-4'/%3e%3c/svg%3e") center / contain no-repeat;
}
.license-note strong {
  color: #92400e;
}

@media (max-width: 720px) {
  .build-paths {
    grid-template-columns: 1fr;
  }
}
.prose .build-on > h2 {
  margin-top: 0;
}
