/*
 * AdOps site styles. No external fonts or CDNs (CSP: style-src 'self').
 * Plain elements are styled directly, so templates need few classes. Optional classes:
 *   .notice (+ .notice-ok / .notice-warn / .notice-error)  callout box
 *   .table-wrap        lets a wide table scroll sideways on small screens
 *   .copy-field        a value plus a [data-copy-target] button (see copy.js)
 *   .lede .muted .prose .inline .actions .visually-hidden
 *   button.secondary / button.danger
 */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --text: #1f2328;
  --muted: #57606a;
  --border: #d0d7de;
  --accent: #0b57d0;
  --accent-text: #ffffff;
  --accent-hover: #0842a0;
  --focus: #0b57d0;
  --ok-bg: #e8f5e9;
  --ok-border: #2e7d32;
  --warn-bg: #fff8e1;
  --warn-border: #b7791f;
  --error-bg: #fdecea;
  --error-border: #c62828;
  --danger: #b3261e;
  --danger-hover: #8c1d18;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1b1f24;
    --text: #e6e8eb;
    --muted: #a0a8b3;
    --border: #3a414a;
    --accent: #8ab4f8;
    --accent-text: #0b1220;
    --accent-hover: #aecbfa;
    --focus: #8ab4f8;
    --ok-bg: #11251a;
    --ok-border: #81c995;
    --warn-bg: #2b2410;
    --warn-border: #e3b341;
    --error-bg: #2d1414;
    --error-border: #f28b82;
    --danger: #f28b82;
    --danger-hover: #f6aea9;
  }
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  flex: 1;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

main:focus {
  outline: none;
}

/* Typography */

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

h1 + h2,
.notice + h2 {
  border-top: 0;
}

h3 {
  font-size: 1.2rem;
}

p,
li,
dd {
  max-width: 72ch;
}

li + li {
  margin-top: 0.35rem;
}

li > ul,
li > ol {
  margin-top: 0.35rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-hover);
}

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

.lede {
  font-size: 1.2rem;
}

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

.prose {
  max-width: 48rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Code */

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.3em;
  overflow-wrap: anywhere;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  overflow-wrap: normal;
}

kbd {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.3em;
}

/* Header, navigation and footer */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--accent-text);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.site-header ul,
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.site-header li + li,
.site-footer li + li {
  margin-top: 0;
}

.site-header nav a {
  display: inline-block;
  padding: 0.25rem 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-header nav a:hover {
  border-bottom-color: var(--border);
}

.site-header nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-footer p {
  margin: 0;
}

/* Notices */

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  max-width: 72ch;
}

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

.notice > :last-child {
  margin-bottom: 0;
}

.notice-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.notice-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.notice-error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

/* Copy field */

.copy-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.copy-field > code {
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  user-select: all;
}

.copy-field > pre {
  flex: 1 1 20rem;
  min-width: 0;
  margin: 0;
}

.copy-field > pre code {
  user-select: all;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 0.5rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  /* break-word (not anywhere) so column sizing keeps whole words; long values
     such as emails still wrap instead of overflowing. */
  overflow-wrap: break-word;
}

thead th {
  background: var(--surface);
  border-bottom-width: 2px;
}

tbody th {
  font-weight: 600;
}

/* Forms and buttons */

form {
  margin: 1rem 0;
}

form.inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 1rem 0;
}

legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

label {
  display: inline-block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

input:not([type="checkbox"], [type="radio"], [type="hidden"]),
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  max-width: 100%;
}

input[type="email"],
input[type="text"],
input[type="search"],
textarea {
  width: 24rem;
}

button,
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--accent);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--surface);
  color: var(--accent-hover);
}

button.danger,
.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--bg);
}

button.danger:hover,
.button.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Utilities */

.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;
}

@media (max-width: 40rem) {
  body {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  input[type="email"],
  input[type="text"],
  input[type="search"],
  textarea {
    width: 100%;
  }
}

@media print {
  .site-header nav,
  .skip-link,
  button {
    display: none;
  }

  a {
    color: inherit;
  }
}

/* Admin: compact lists inside table cells, and the site-wide maintenance banner. */
ul.compact {
  margin: 0;
  padding-left: 1.1em;
}

.maintenance-banner {
  margin-top: 1rem;
}
