/* Docs site layout only. Components come from dist/tsunami.min.css. */
.docs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 100dvh;
}

.docs-body {
  grid-column: 2;
  min-width: 0;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  color: var(--fg);
  font-size: var(--text-lg);
  font-weight: 600;
  text-decoration: none;
}

.docs-brand:hover {
  text-decoration: none;
}

.docs-brand svg rect {
  fill: var(--accent);
}

.docs-brand svg path {
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs-brand span {
  color: var(--muted);
  font-weight: 400;
}

.docs-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 3rem;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.docs-top > span {
  margin-right: auto;
  font-weight: 500;
}

.docs-main {
  display: grid;
  gap: var(--space-6);
  max-width: 56rem;
  margin-inline: auto;
  padding: var(--space-6) var(--space-5) 4rem;
}

.docs-main > *,
.docs-main > section > *,
.docs-main [role="tabpanel"] {
  min-width: 0;
}

.docs-main > section {
  display: grid;
  gap: var(--space-3);
}

.docs-lead {
  max-width: 40rem;
  color: var(--muted);
  font-size: var(--text-lg);
}

.docs-preview {
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.docs-preview .sidebar {
  position: static;
  height: 22rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.docs-preview .workspace {
  height: 24rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.docs-narrow {
  max-width: 24rem;
}

/* Inline code in the prose: a tinted pill, so names and values stand out. Not in previews, which show the framework as it is. */
.docs-main :not(pre, .docs-preview, .docs-preview *) > code {
  padding: 0.1em 0.4em;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--subtle);
  font-size: 0.85em;
  white-space: break-spaces;
}

/* Docs code blocks: the script wraps each <pre> and adds a copy button. */
.docs-code {
  position: relative;
}

.docs-code > pre,
.docs-main > section > pre {
  margin: 0;
  padding: var(--space-4) 3rem var(--space-4) var(--space-4);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--subtle);
  font-size: var(--text-sm);
  line-height: 1.7;
  tab-size: 2;
}

.docs-copy {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  color: var(--muted);
}

.docs-copy[data-copied] {
  color: var(--ok-fg);
}

.tok-t {
  color: var(--info-fg);
}

.tok-a {
  color: var(--warning-fg);
}

.tok-s {
  color: var(--ok-fg);
}

.tok-c {
  color: var(--muted);
}

.docs-search {
  width: 100%;
  justify-content: flex-start;
  color: var(--muted);
  font-weight: 400;
}

.docs-search > span {
  flex: 1;
  text-align: start;
}

.docs-search kbd {
  padding: 0 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
}

/* Previews scroll sideways on phones; on wide screens they must not clip
   overlays such as tooltips that stick out of the box. */
@media (width < 48rem) {
  .docs-preview {
    overflow-x: auto;
  }
}

/* Token and attribute names stay on one line where there is room. */
@media (width >= 48rem) {
  .docs-main .table td:first-child code {
    white-space: nowrap;
  }
}

/* Home */
.docs-hero {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  padding-top: var(--space-4);
}

.docs-hero h1 {
  font-size: clamp(1.75rem, 1rem + 2.5vw, 2.75rem);
  letter-spacing: -0.02em;
}

.docs-hero h1 span {
  color: var(--muted);
  font-weight: 400;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

/* Foundations */
.docs-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-3);
}

.docs-swatches > div {
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.docs-swatches > div::before {
  content: "";
  height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--c);
}

.docs-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: var(--space-2);
}

.docs-icons > button {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.docs-icons > button:hover {
  background: var(--subtle);
}

.docs-icons > [data-copied] {
  border-color: var(--accent);
}

.docs-icons code {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.docs-icons .icon {
  color: var(--fg);
  font-size: 1.25rem;
}

@media (width < 48rem) {
  .docs-body {
    grid-column: 1 / -1;
  }

  .docs-grid {
    grid-template-columns: 1fr;
  }

  .docs-top,
  .docs-main {
    padding-inline: var(--space-4);
  }
}
