/*
 * Suno API docs page (/docs/suno-api/).
 * Extends the docs shell (templates/docs/base.html): dark neutrals with the
 * site's lime accent, flat surfaces, no gradients, no card wall. Native
 * details/summary for the operation reference, plain readable tables.
 * Must stay overflow-free at 320px.
 */

.sun-page {
  --sun-ink: #eef2f6;
  --sun-ink-soft: #c3cdd7;
  --sun-ink-muted: #8496a4;
  --sun-line: rgba(255, 255, 255, 0.12);
  --sun-line-soft: rgba(255, 255, 255, 0.07);
  --sun-surface: #10181f;
  --sun-accent: #d7ff55;
  --sun-accent-ink: #0a1005;
  --sun-accent-soft: rgba(215, 255, 85, 0.10);
  --sun-accent-line: rgba(215, 255, 85, 0.45);
  color: var(--sun-ink);
  font-size: 1rem;
  max-width: 54rem;
}

.sun-page :focus-visible {
  outline: 2px solid var(--sun-accent);
  outline-offset: 2px;
}

.sun-section {
  border-top: 1px solid var(--sun-line);
  margin-top: 2.25rem;
  padding-top: 1.4rem;
  scroll-margin-top: 4.5rem;
}

.sun-section > :first-child {
  margin-top: 0;
}

/* The intro band sits above the first rule. */
.sun-intro {
  border-top: 0;
  margin-top: 0.25rem;
  padding-top: 0;
}

.sun-lead {
  color: var(--sun-ink);
  font-size: 1.12rem;
  line-height: 1.65;
  margin: 0 0 1.2rem;
  max-width: 46rem;
}

.sun-page p {
  color: var(--sun-ink-soft);
  line-height: 1.65;
}

.sun-page h2 {
  color: var(--sun-ink);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.8rem;
}

.sun-page h3 {
  color: var(--sun-ink);
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.5rem 0 0.6rem;
}

.sun-page a {
  color: var(--sun-accent);
  text-decoration: underline;
  text-decoration-color: var(--sun-accent-line);
  text-underline-offset: 2px;
}

.sun-page a:hover {
  text-decoration-color: var(--sun-accent);
}

.sun-page ul,
.sun-page ol {
  color: var(--sun-ink-soft);
  line-height: 1.65;
  padding-left: 1.25rem;
}

.sun-page li + li {
  margin-top: 0.35rem;
}

.sun-page code {
  background: rgba(215, 255, 85, 0.08);
  border: 1px solid var(--sun-line-soft);
  border-radius: 5px;
  color: #e8f7c0;
  font-size: 0.88em;
  padding: 0.08em 0.35em;
  word-break: break-word;
}

/* Inline facts band: a definition list, not cards. */
.sun-facts {
  border-bottom: 1px solid var(--sun-line);
  border-top: 1px solid var(--sun-line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 1.4rem 0 0.4rem;
}

.sun-facts > div {
  border-bottom: 1px solid var(--sun-line-soft);
  padding: 0.7rem 0.9rem 0.7rem 0;
}

.sun-facts dt {
  color: var(--sun-ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sun-facts dd {
  color: var(--sun-ink);
  font-size: 0.92rem;
  margin: 0.25rem 0 0;
}

/* Tables: always inside a scroll wrapper, never wider than the column. */
.sun-scroll {
  margin: 1rem 0;
  overflow-x: auto;
}

.sun-scroll:focus-visible {
  outline: 2px solid var(--sun-accent);
  outline-offset: 2px;
}

.sun-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 34rem;
  width: 100%;
}

.sun-table--tight {
  min-width: 26rem;
}

.sun-table caption {
  color: var(--sun-ink-muted);
  font-size: 0.8rem;
  padding-bottom: 0.5rem;
  text-align: left;
}

.sun-table th {
  border-bottom: 1px solid var(--sun-line);
  color: var(--sun-ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  padding: 0.45rem 0.9rem 0.45rem 0;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.sun-table td {
  border-bottom: 1px solid var(--sun-line-soft);
  color: var(--sun-ink-soft);
  padding: 0.5rem 0.9rem 0.5rem 0;
  vertical-align: top;
}

.sun-table tr:last-child td {
  border-bottom: 0;
}

.sun-table td:first-child {
  color: var(--sun-ink);
  white-space: nowrap;
}

.sun-table td.sun-wrap {
  white-space: normal;
}

/* Status and method chips. */
.sun-pill {
  border: 1px solid var(--sun-line);
  border-radius: 999px;
  color: var(--sun-ink-soft);
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}

.sun-pill--get { color: #9fe8c8; border-color: rgba(159, 232, 200, 0.4); }
.sun-pill--post { color: #a9c8f5; border-color: rgba(169, 200, 245, 0.4); }
.sun-pill--patch { color: #f2d98c; border-color: rgba(242, 217, 140, 0.4); }
.sun-pill--free { color: var(--sun-ink-muted); }
.sun-pill--credits { background: var(--sun-accent-soft); border-color: var(--sun-accent-line); color: var(--sun-accent); }

.sun-note {
  border-left: 3px solid var(--sun-accent-line);
  color: var(--sun-ink-soft);
  margin: 1rem 0;
  padding: 0.15rem 0 0.15rem 0.9rem;
}

.sun-note--warn {
  border-left-color: #f2b95c;
}

/* Operation reference: one native disclosure per operation. */
.sun-op {
  border: 1px solid var(--sun-line);
  border-radius: 10px;
  margin-top: 0.75rem;
  scroll-margin-top: 4.5rem;
}

.sun-op[open] {
  border-color: var(--sun-accent-line);
}

.sun-op > summary {
  align-items: baseline;
  color: var(--sun-ink);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  font-weight: 650;
  gap: 0.35rem 0.6rem;
  line-height: 1.4;
  list-style: none;
  padding: 0.75rem 0.9rem;
}

.sun-op > summary::-webkit-details-marker {
  display: none;
}

.sun-op > summary::after {
  content: "+";
  color: var(--sun-accent);
  font-weight: 700;
  margin-left: auto;
}

.sun-op[open] > summary::after {
  content: "−";
}

.sun-op > summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sun-op-id {
  color: var(--sun-ink-muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 500;
}

.sun-op-body {
  border-top: 1px solid var(--sun-line-soft);
  padding: 0.9rem;
}

.sun-op-body > :first-child {
  margin-top: 0;
}

.sun-op-body > :last-child {
  margin-bottom: 0;
}

.sun-rules-title {
  color: var(--sun-ink);
  font-size: 0.9rem;
  margin: 0.9rem 0 0.4rem;
}

/* Operation index: plain inline links. */
.sun-index {
  font-size: 0.92rem;
  line-height: 2;
}

.sun-index a {
  margin-right: 0.35rem;
  white-space: nowrap;
}

.sun-anchor {
  color: var(--sun-ink-muted);
  font-size: 0.85em;
  margin-left: 0.4rem;
  text-decoration: none;
}

.sun-anchor:hover {
  color: var(--sun-accent);
}

@media (max-width: 480px) {
  .sun-facts {
    grid-template-columns: 1fr;
  }

  .sun-page h2 {
    font-size: 1.25rem;
  }

  .sun-lead {
    font-size: 1.03rem;
  }

  .sun-op > summary {
    padding: 0.65rem 0.7rem;
  }

  .sun-op-body {
    padding: 0.7rem;
  }
}

/* Keep this reference consistent with Music Studio. */
.docs-page:has(.sun-page) { background: #0a1017; }
.docs-page:has(.sun-page) .docs-sidebar { background: #0d141c; }
.sun-page { min-width: 0; width: 100%; }

.sun-page .docs-code code { border: 0; background: none; padding: 0; word-break: normal; }
.sun-toc { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; padding-block: 1rem; }
.sun-sample { margin: 1rem 0; }
.sun-sample figcaption { color: var(--sun-ink-soft); line-height: 1.6; margin-bottom: .7rem; }
.sun-sample audio { width: 100%; max-width: 32rem; }
.sun-pill { white-space: normal; }
.sun-op { border: 0; border-bottom: 1px solid var(--sun-line); border-radius: 0; }

.sun-op .sun-table td:nth-child(2) { white-space: nowrap; }

/* Keep copy controls in their own row; visual wrapping never edits the source. */
.sun-page .docs-code {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
  overflow: hidden;
  border-radius: .5rem;
  margin-block: 1rem;
}
.sun-page .docs-code::before {
  content: attr(data-label);
  grid-area: 1 / 1;
  align-self: center;
  padding: .65rem 1rem;
  font-size: .8rem;
  color: var(--sun-ink-soft);
}
.sun-page .docs-code .copy-btn {
  position: static;
  grid-area: 1 / 2;
  min-height: 44px;
  min-width: 64px;
  margin: .25rem .4rem;
  padding: .4rem .8rem;
  border-radius: .3rem;
  font-size: .8rem;
}
.sun-page .docs-code pre {
  grid-area: 2 / 1 / 3 / -1;
  min-width: 0;
  padding: 1rem;
  border-top: 1px solid var(--sun-line);
}
.sun-page .docs-code pre,
.sun-page .docs-code code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: .875rem;
  line-height: 1.65;
}
.sun-example {
  border-bottom: 1px solid var(--sun-line);
  padding-block: .3rem;
}
.sun-example > summary {
  cursor: pointer;
  padding: .85rem 0;
  min-height: 44px;
  color: var(--sun-ink);
  font-weight: 600;
}
.sun-example > summary::marker { color: var(--sun-accent); }
.sun-example[open] > summary { color: var(--sun-accent); }
.sun-steps li { padding-left: .25rem; margin-block: 1rem; }
.sun-steps strong { color: var(--sun-ink); }

.sun-page .sun-steps { list-style: decimal; }
.sun-index { display: flex; flex-wrap: wrap; gap: .3rem .75rem; }
.sun-index a { display: inline-flex; align-items: center; min-height: 36px; margin: 0; }
.sun-page .sun-table caption { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .sun-table, .sun-table--tight { min-width: 0; table-layout: fixed; }
  .sun-page .sun-table th, .sun-page .sun-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    padding: .6rem .4rem .6rem 0;
  }
  .sun-page .sun-table code { overflow-wrap: anywhere; }
  .sun-anchor { margin-left: 0; }
  .sun-fields, .sun-fields caption, .sun-fields tbody { display: block; }
  .sun-fields thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sun-fields tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--sun-line); padding-block: .7rem; }
  .sun-page .sun-fields td { display: block; border: 0; padding: .25rem 0; }
  .sun-fields td:nth-child(n+3) { grid-column: 1 / -1; }
  .sun-fields td[data-label]::before { content: attr(data-label) ": "; color: var(--sun-ink-muted); font-size: .8rem; }
  .sun-fields td:nth-child(n+3)::before { display: block; margin-bottom: .2rem; }
}

.sun-example .docs-code pre { max-height: min(32rem, 65svh); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 600px) {
  #pricing th:first-child, #errors th:first-child { width: 40%; }
  #pricing th:nth-child(2) { width: 20%; }
  #errors th:nth-child(2) { width: 15%; }
  #endpoints th:first-child { width: 18%; }
  #endpoints th:nth-child(2) { width: 42%; }
}
