@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }
:root { background: var(--bg-canvas); color: var(--fg-primary); }
body { margin: 0; font: var(--weight-body) var(--size-body)/var(--line-body) var(--font-ui); font-variant-numeric: tabular-nums; }
h1, h2, h3, p, pre, dl, dd, figure { margin: 0; }
h1 { font-size: var(--size-h1); line-height: var(--line-h1); font-weight: var(--weight-h1); letter-spacing: -.02em; }
h2 { font-size: var(--size-h2); line-height: var(--line-h2); font-weight: var(--weight-h2); }
h3 { font-size: var(--size-h3); line-height: var(--line-h3); font-weight: var(--weight-h2); }
strong, b { font-weight: var(--weight-h2); }
a { color: var(--link); text-underline-offset: .22em; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: var(--stroke) solid var(--accent); outline-offset: var(--space-1); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip:focus { position: fixed; z-index: 2; inset: var(--space-2) auto auto var(--space-2); background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-3); }
.wrap { width: min(66rem, calc(100% - 2 * var(--space-6))); margin-inline: auto; }
.narrow { max-width: 36rem; }
.site-header { background: var(--bg-surface); }
.topbar, .admin-top { min-height: calc(2 * var(--space-8)); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.topbar nav, .site-footer nav { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-5); }
.topbar nav a, .site-footer nav a { color: var(--fg-secondary); text-decoration: none; padding-block: var(--space-2); }
.topbar nav a:hover, .site-footer nav a:hover { color: var(--fg-primary); text-decoration: underline; }
.brand { color: var(--fg-primary); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; font-size: var(--size-h3); font-weight: var(--weight-h2); }
.brand-mark { display: grid; place-items: center; border-radius: var(--radius-1); width: var(--space-8); height: var(--space-8); background: var(--bg-surface-raised); color: var(--fg-primary); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.button { display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: var(--radius-1); padding: var(--space-2) var(--space-3); min-height: calc(2 * var(--space-5)); color: var(--fg-primary); text-decoration: none; white-space: nowrap; transition: background-color var(--motion-feedback); }
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: var(--accent-pressed); }
.button.ghost { background: var(--bg-surface-raised); }
.button.ghost:hover { background: var(--bg-pressed); }
.button.small { min-height: calc(2 * var(--space-4)); padding-inline: var(--space-3); }
.surface { background: var(--bg-surface); border-radius: var(--radius-2); }
.surface .button, .surface input, .surface textarea { border-radius: var(--radius-0); }
.public-main { padding-block: calc(2 * var(--space-8)) calc(2 * var(--space-8)); }
.intro { display: grid; grid-template-columns: 1fr 1fr; gap: calc(2 * var(--space-8)); align-items: center; padding-bottom: calc(2 * var(--space-8)); }
.intro-lead, .lead { max-width: 28rem; color: var(--fg-secondary); margin-block: var(--space-3) var(--space-6); }
.demo { align-self: stretch; overflow: hidden; }
.demo-heading, .demo-result { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.demo-heading, .demo-content { padding: var(--space-4) var(--space-5); }
.demo-content { min-height: calc(3 * var(--space-8)); }
.content-section + .content-section { margin-top: calc(2 * var(--space-8)); }
.section-head { margin-bottom: var(--space-4); }
.section-head p, .admin-heading p { color: var(--fg-secondary); margin-top: var(--space-2); }
.protection-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.protection-grid article { padding: var(--space-5); }
.protection-grid article + article { border-inline-start: var(--stroke) solid var(--border-hairline); }
.protection-grid p { color: var(--fg-secondary); margin-top: var(--space-1); }
.flow { overflow: hidden; }
.flow-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); background: var(--bg-surface-raised); padding: var(--space-1); }
.flow-tabs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flow-tabs button { border: 0; border-radius: var(--radius-0); background: transparent; min-height: calc(2 * var(--space-5)); padding: var(--space-2) var(--space-3); color: var(--fg-secondary); transition: background-color var(--motion-toggle); }
.flow-tabs button span { font-size: var(--size-caption); color: inherit; margin-inline-end: var(--space-1); }
.flow-tabs button:hover { background: var(--bg-surface); color: var(--fg-primary); }
.flow-tabs button[aria-pressed=true] { background: var(--selected-fill); color: var(--selected-ink); font-weight: var(--weight-h2); }
.flow-content { min-height: calc(4 * var(--space-8)); padding: var(--space-5); }
.flow-panel { display: grid; align-content: start; gap: var(--space-3); }
.flow-panel p { color: var(--fg-secondary); max-width: 42rem; }
pre, code { font: var(--weight-body) var(--size-caption)/var(--line-caption) var(--font-code); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.download-row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-4); align-items: center; padding: var(--space-4) var(--space-5); }
.download-row p { color: var(--fg-secondary); margin-top: var(--space-1); }
.rows > * + *, tbody tr + tr { border-top: var(--stroke) solid var(--border-hairline); }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: var(--space-1) var(--space-2); min-height: var(--space-6); font-size: var(--size-caption); line-height: var(--line-caption); font-weight: var(--weight-body); background: var(--badge-fill); color: var(--badge-ink); border-radius: var(--radius-1); white-space: nowrap; }
.badge.good { background: var(--positive-fill); color: var(--positive-ink); }
.badge.warning { background: var(--error-fill); color: var(--error-ink); }
.site-footer { background: var(--bg-surface); color: var(--fg-secondary); }
.footer-row { min-height: calc(2 * var(--space-8)); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding-block: var(--space-3); }
.footer-row p span { margin-inline-start: var(--space-2); }
[data-status] { font-size: var(--size-caption); }
[data-status].online { color: var(--fg-primary); }
.notice, .form-error { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-5); padding: var(--space-3); border-radius: var(--radius-1); overflow-wrap: anywhere; }
.notice { color: var(--selected-ink); background: var(--selected-fill); }
.form-error { color: var(--error-ink); background: var(--error-fill); }
.docs-layout { display: grid; grid-template-columns: 10rem minmax(0, 42rem); align-items: start; gap: calc(2 * var(--space-8)); padding-block: calc(2 * var(--space-8)); }
.docs-nav { position: sticky; top: var(--space-6); display: grid; gap: var(--space-3); }
.docs-nav nav { display: grid; gap: var(--space-2); }
.docs-nav a { color: var(--fg-secondary); text-decoration: none; }
.docs-nav a:hover { text-decoration: underline; }
.prose section + section { margin-top: var(--space-8); }
.prose section { scroll-margin-top: var(--space-5); }
.prose h2 { margin-bottom: var(--space-2); }
.prose p + p { margin-top: var(--space-2); }
.prose pre { margin-block: var(--space-3); background: var(--bg-surface-raised); border-radius: var(--radius-2); padding: var(--space-4); }
details { padding-block: var(--space-3); }
details + details { border-top: var(--stroke) solid var(--border-hairline); }
summary { cursor: pointer; font-weight: var(--weight-h2); }
details[open] p { margin-top: var(--space-2); }
.utility { min-height: 65vh; padding-block: calc(2 * var(--space-8)); }
.form { display: grid; gap: var(--space-3); padding: var(--space-5); }
.form label { font-weight: var(--weight-h2); }
.form input:not([type=hidden]), .form textarea { min-width: 0; min-height: calc(2 * var(--space-5)); border: var(--stroke) solid transparent; outline: none; padding: var(--space-2) var(--space-3); background: var(--bg-surface-raised); }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form textarea { resize: vertical; }
.form .button { justify-self: start; margin-top: var(--space-1); }
.field-help { color: var(--fg-secondary); font-size: var(--size-caption); }
.admin-top { padding-inline: var(--space-6); background: var(--bg-surface); }
.admin-layout { display: grid; grid-template-columns: 12rem minmax(0,1fr); min-height: calc(100vh - 2 * var(--space-8)); }
.admin-side { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-6); background: var(--bg-surface); padding: var(--space-4); }
.admin-side nav { display: grid; gap: var(--space-1); }
.admin-side nav a { display: flex; align-items: center; gap: var(--space-2); min-height: calc(2 * var(--space-5)); color: var(--fg-secondary); text-decoration: none; padding: var(--space-2) var(--space-3); border-radius: var(--radius-1); transition: background-color var(--motion-feedback); }
.admin-side nav a:hover { color: var(--fg-primary); background: var(--bg-surface-raised); }
.admin-side nav a[aria-current=page] { background: var(--selected-fill); color: var(--selected-ink); font-weight: var(--weight-h2); }
.side-account { display: grid; gap: var(--space-1); padding: var(--space-3); background: var(--bg-surface-raised); }
.side-account span { color: var(--fg-secondary); font-size: var(--size-caption); }
.counter { margin-inline-start: auto; border-radius: var(--radius-pill); min-width: var(--space-6); }
.admin-content { width: min(100%, 75rem); margin-inline: auto; padding: var(--space-8); }
.admin-heading { margin-bottom: var(--space-6); }
.admin-section { margin-top: var(--space-8); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.metrics > div { display: grid; gap: var(--space-1); padding: var(--space-5); }
.metrics > div + div { border-left: var(--stroke) solid var(--border-hairline); }
.metrics dt, .activity-row time, .feedback-row time, .drawer-meta { color: var(--fg-secondary); }
.metrics dd { font-size: var(--size-h1); line-height: var(--line-h1); font-weight: var(--weight-h1); }
.metrics a, .activity-row time, .feedback-row time { font-size: var(--size-caption); line-height: var(--line-caption); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.activity-row, .feedback-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); min-height: calc(2 * var(--space-6)); }
.feedback-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: start; font-weight: var(--weight-body); padding: var(--space-3) var(--space-4); }
thead { background: var(--bg-surface-raised); }
thead th { font-size: var(--size-caption); font-weight: var(--weight-h2); color: var(--fg-secondary); }
tbody th { font-weight: var(--weight-h2); }
.runtime-id { white-space: normal; overflow-wrap: anywhere; }
.toggle { display: grid; justify-items: start; align-items: center; border: 0; border-radius: var(--radius-1); width: calc(2 * var(--space-5)); height: var(--space-6); padding: var(--space-1); background: var(--bg-pressed); transition: background-color var(--motion-toggle); }
.toggle span { width: var(--space-4); height: var(--space-4); background: var(--control-knob); border-radius: var(--radius-1); transition: transform var(--motion-toggle); }
.toggle[aria-checked=true] { background: var(--accent); }
.toggle[aria-checked=true] span { transform: translateX(var(--space-4)); }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; max-width: 100%; max-height: none; min-height: 100%; width: min(28rem, calc(100% - var(--space-4))); border: 0; border-radius: var(--radius-3) var(--radius-0) var(--radius-0) var(--radius-3); padding: var(--space-6); color: var(--fg-primary); background: var(--bg-canvas); box-shadow: var(--shadow-dialog); }
.drawer::backdrop { background: var(--backdrop); }
.drawer[open] { animation: drawer-in var(--motion-drawer); }
.drawer-heading, .drawer-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.drawer-meta { margin-top: var(--space-5); font-size: var(--size-caption); }
.feedback-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: var(--space-3) var(--space-6); }
.settings-form { max-width: 38rem; }
.empty { color: var(--fg-secondary); padding: var(--space-5); }
.empty p + a { display: inline-block; margin-top: var(--space-2); }
.success-message { animation: success-in var(--motion-success); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes success-in { from { opacity: 0; transform: translateY(var(--space-1)); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 48rem) {
  .intro { gap: var(--space-6); }
  .admin-layout { grid-template-columns: 10rem minmax(0,1fr); }
  .admin-content { padding: var(--space-6); }
  .docs-layout { gap: var(--space-6); }
}
@media (max-width: 37rem) {
  .wrap { width: calc(100% - 2 * var(--space-4)); }
  .topbar { flex-wrap: wrap; gap: var(--space-2); padding-block: var(--space-2); }
  .topbar nav { order: 3; width: 100%; }
  .public-main, .utility, .docs-layout { padding-block: var(--space-8); }
  .intro, .docs-layout { grid-template-columns: 1fr; gap: var(--space-6); padding-bottom: var(--space-8); }
  .protection-grid { grid-template-columns: 1fr; }
  .protection-grid article + article { border-inline-start: 0; border-top: var(--stroke) solid var(--border-hairline); }
  .flow-tabs button { padding: var(--space-2) var(--space-1); }
  .flow-tabs button span { display: block; margin-inline-end: 0; }
  .flow-content { min-height: calc(4 * var(--space-8)); }
  .content-section + .content-section { margin-top: var(--space-8); }
  .download-row { grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); padding-inline: var(--space-4); }
  .download-row a { grid-column: 1; justify-self: start; }
  .docs-nav { position: static; }
  .docs-nav nav { display: flex; flex-wrap: wrap; gap: var(--space-3); }
  .admin-top { flex-wrap: wrap; padding: var(--space-2) var(--space-3); gap: var(--space-2); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { padding: var(--space-2); }
  .admin-side nav { display: flex; overflow-x: auto; }
  .admin-side nav a { white-space: nowrap; min-height: calc(2 * var(--space-4)); }
  .side-account { display: none; }
  .admin-content { padding: var(--space-4); }
  .metrics > div { padding: var(--space-3); }
  .activity-row { flex-wrap: wrap; }
  .feedback-row { padding-inline: var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}
