/* Global base styles. Component styles live next to each component (CSS isolation). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }

/* Headings receive focus after navigation (for screen readers); no ring for that programmatic focus. */
h1:focus { outline: none; }

/* Section headings read as labels on a ledger: small, uppercase, ruled above. */
h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.3;
}

h3 { font-size: var(--text-lg); }

p { margin: 0; }

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { text-decoration-thickness: 2px; }

code,
kbd,
samp,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: normal;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--space-5) 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--ink-2); }

.small { font-size: var(--text-sm); }

/* Secondary table columns give way on phones. */
@media (max-width: 600px) {
  .hide-narrow { display: none; }
}

/* Page scaffolding */
.page {
  display: grid;
  gap: var(--space-6);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: var(--rule-heavy) solid var(--rule-strong);
}

.page-header .lede {
  color: var(--ink-2);
  margin-top: var(--space-2);
  max-width: 62ch;
}

.breadcrumb {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: var(--space-3);
}

.breadcrumb a {
  color: var(--ink-2);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* A section is a ruled block: heavy rule, label, then content. */
.section {
  display: grid;
  gap: var(--space-3);
  border-top: 1px solid var(--rule-strong);
  padding-top: var(--space-3);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 1px solid var(--rule-strong);
  padding: var(--space-5);
}

.form {
  display: grid;
  gap: var(--space-4);
  max-width: 560px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.definition-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-5);
  margin: 0;
}

.definition-list dt {
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  padding-top: 3px;
}

.definition-list dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .definition-list { grid-template-columns: 1fr; gap: 0; }
  .definition-list dd { margin-bottom: var(--space-3); }
}

/* A link that looks like a button, for navigation actions. */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 var(--space-4);
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button-link:hover {
  background: var(--ink);
  color: var(--panel);
}

.button-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button-link.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

/* Fields (shared by TextField, NumberField, Select and Checkbox, which wrap Blazor's inputs) */
.field {
  display: grid;
  gap: var(--space-1);
}

.label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.hint {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.input {
  width: 100%;
  min-height: 42px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.input.mono {
  font-family: var(--font-mono);
}

.input.textarea {
  min-height: 12rem;
  resize: vertical;
  line-height: var(--leading);
}

.input.number {
  max-width: 10ch;
}

.input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.input.invalid,
.input[aria-invalid="true"] {
  border-color: var(--status-bad);
  box-shadow: inset 3px 0 0 var(--status-bad);
}

.select {
  appearance: none;
  padding-right: var(--space-6);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.check {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--ink);
  flex: none;
}

.boot {
  padding: var(--space-7) var(--gutter);
  color: var(--ink-2);
  text-align: center;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  padding: var(--space-3) var(--gutter);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  z-index: 100;
}

#blazor-error-ui a { color: inherit; }

/* The page header's heavy rule already separates the first section (panels keep their own frame). */
.page-header + .section:not(.panel) {
  border-top: 0;
  padding-top: 0;
}

/* Public pages (home, docs): the dashboard's solid bar, with page links and a way straight to signing in. */
.site-bar {
  background: #0B0B0B;
  color: #F2F2F0;
  border-bottom: 1px solid #2C2C2C;
}

.site-bar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: 52px;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0 var(--space-6);
}

.site-wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
  text-decoration: none;
  color: #F2F2F0;
}

.site-wordmark::before {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--accent);
}

.site-nav {
  display: flex;
  gap: var(--space-5);
  flex: 1 1 auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  color: #A0A0A0;
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
}

.site-nav a:hover {
  color: #F2F2F0;
}

.site-nav a:focus-visible,
.site-cta:focus-visible {
  outline: 2px solid #F2F2F0;
  outline-offset: 2px;
}

.site-tools {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.site-tools .btn {
  color: #F2F2F0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.site-cta {
  padding: var(--space-1) var(--space-3);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
}

/* Ink text with an orange marker: orange text this small doesn't meet contrast on the light canvas. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--accent);
}

@media (max-width: 640px) {
  .site-bar-inner {
    padding-top: var(--space-2);
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
    min-height: 40px;
    justify-content: space-between;
    gap: var(--space-3);
  }
}
