/* PAD tags - a page per built-in tag and the indexes over them, inside the frame every PAD
   application shares (apps/_common/_tags/padFrame.pad). */

/* The palette is the frame's (www/_common/pad.css), in the names this file was written with;
   the code blocks stay dark in both themes. */

:root {
  --ink:       var(--text);
  --ink-soft:  var(--soft);
  --ink-mute:  var(--dim);
  --accent-bg: var(--accent-soft);
  --code-bg:   #161925;
  --code-ink:  #d7dae6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --code-bg: #0f1119; }
}

:root[data-theme="dark"] { --code-bg: #0f1119; }

.app-tags .frame-body { font-size: 15px; line-height: 1.6; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .name { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: .92em; }

:not(pre) > code { background: var(--accent-bg); padding: 1px 5px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- page */

h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }

.lead { color: var(--ink-soft); font-size: 16px; max-width: 760px; }

.foot { margin-top: 32px; color: var(--ink-mute); font-size: 13px; }

.hero { padding: 12px 0 20px; }
.stats { display: flex; gap: 24px; list-style: none; padding: 0; margin: 12px 0 0; color: var(--ink-soft); }
.stats b { font-size: 22px; color: var(--ink); margin-right: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0 0 10px; color: var(--ink-mute); font-size: 13px; }
.card .count { color: var(--ink-mute); font-weight: 400; font-size: 13px; }

.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud a {
  font: 13px ui-monospace, monospace; padding: 2px 7px; border-radius: 5px;
  background: var(--accent-bg); color: var(--accent);
}

.jump { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 6px; }
.jump a {
  min-width: 30px; text-align: center; padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 600;
}

.section { margin: 28px 0; scroll-margin-top: 70px; }
.section-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.section-head span { color: var(--ink-mute); font-size: 14px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list .about { color: var(--ink-soft); }
.list .meta { color: var(--ink-mute); font-size: 12px; margin-left: 6px; white-space: nowrap; }

.options-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.options-table th, .options-table td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.options-table th { background: var(--accent-bg); font-size: 13px; }
.options-table td.opt { white-space: nowrap; font-family: ui-monospace, monospace; }
.options-table .uses { display: block; padding: 2px 0; }

.cheat { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.cheat-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cheat-item .name { font-weight: 600; }
.cheat-item pre { margin: 6px 0 0; font-size: 12px; }

mark { background: #ffe58a; color: #14161f; border-radius: 2px; }

/* ---------------------------------------------------------------- tag page */

.crumbs { font-size: 13px; color: var(--ink-mute); display: flex; gap: 6px; margin-bottom: 12px; }

.tag-head h1 { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 34px; }
.tag-head .brace { color: var(--ink-mute); font-weight: 400; }
.tag-about { font-size: 18px; color: var(--ink-soft); margin: 0 0 10px; }

.chips { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.chip-form { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); }

.block {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 22px; margin: 18px 0; box-shadow: var(--shadow);
}

.prose p, .prose li { max-width: 820px; }

.defs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.defs dt { font-weight: 600; }
.defs dd { margin: 0; color: var(--ink-soft); }

.code {
  margin: 0; padding: 12px 14px; border-radius: 8px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-ink); font-size: 13px; line-height: 1.55;
}

.example { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.example:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.example h3 { margin-top: 0; }
.example-about { color: var(--ink-soft); margin: -4px 0 10px; }

.example-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.example-grid.is-static { grid-template-columns: minmax(0, 1fr); }
.cell { min-width: 0; }
.cell-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.cell-head + .code + .cell-head { margin-top: 10px; }
.cell-file { text-transform: none; letter-spacing: 0; font-weight: 400; font-family: ui-monospace, monospace; }
.result { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--bg); overflow-x: auto; }
.result > :first-child { margin-top: 0; }
.result > :last-child { margin-bottom: 0; }

.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; font-family: ui-monospace, monospace; }

@media (max-width: 760px) {
  .example-grid { grid-template-columns: minmax(0, 1fr); }
  .list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------------------------------------------------------------- highlighting */

.hl-key, .hl-opt, .hl-att { color: #7db8ff; }
.hl-str                   { color: #a8e07a; }
.hl-num, .hl-lit          { color: #ffb86b; }
.hl-pun, .hl-brc          { color: #8b90a6; }
.hl-com                   { color: #6c7290; font-style: italic; }
.hl-tag, .hl-kwd          { color: #ff7ab2; font-weight: 500; }
.hl-htm                   { color: #5fd4c4; }
.hl-var                   { color: #e6c07b; }
.hl-fn                    { color: #c3a6ff; }
.hl-def                   { color: #d7dae6; }
