/*
 * AH Digital — Base Styles
 *
 * Global typography, document surfaces, accessibility and primitive
 * content styling. Component-specific rules belong in components.css.
 */

html {
  background: var(--ah-color-bg);
  color: var(--ah-color-text);
  font-family: var(--ah-font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: 320px;
  background: var(--ah-color-bg);
  color: var(--ah-color-text);
  font-family: var(--ah-font-sans);
  font-size: var(--ah-font-size-body);
  font-weight: 400;
  line-height: 1.65;
  overflow-wrap: break-word;
}

::selection {
  background: color-mix(in srgb, var(--ah-color-brand) 28%, transparent);
  color: var(--ah-color-text);
}

a {
  color: var(--ah-color-brand);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ah-color-brand-hover);
}

a:active {
  color: var(--ah-color-brand-active);
}

a:not([class]) {
  text-decoration-line: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ah-color-text);
  font-family: var(--ah-font-sans);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

h1 {
  font-size: var(--ah-font-size-display);
  max-width: 15ch;
}

h2 {
  font-size: var(--ah-font-size-h2);
  max-width: 18ch;
}

h3 {
  font-size: var(--ah-font-size-h3);
  line-height: 1.15;
}

h4 {
  font-size: var(--ah-font-size-h4);
  line-height: 1.2;
}

h5,
h6 {
  font-size: 1rem;
  line-height: 1.3;
}

p {
  max-width: 72ch;
  text-wrap: pretty;
}

p,
li,
dd {
  color: var(--ah-color-text-secondary);
}

strong,
b {
  color: inherit;
  font-weight: 700;
}

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

hr {
  border: 0;
  border-block-start: 1px solid var(--ah-color-border);
  margin-block: var(--ah-space-7);
}

blockquote {
  border-inline-start: 3px solid var(--ah-color-brand);
  color: var(--ah-color-text-secondary);
  padding-inline-start: var(--ah-space-5);
}

blockquote > * + * {
  margin-block-start: var(--ah-space-4);
}

code,
kbd,
samp,
pre {
  font-family: var(--ah-font-mono);
}

code {
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-xs);
  background: var(--ah-color-surface-soft);
  color: var(--ah-color-text);
  font-size: 0.9em;
  padding: 0.12em 0.35em;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-md);
  background: var(--ah-color-surface-soft);
  color: var(--ah-color-text);
  padding: var(--ah-space-5);
}

pre code {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

mark {
  background: color-mix(in srgb, var(--ah-color-signal) 52%, transparent);
  color: var(--ah-color-text);
  padding-inline: 0.12em;
}

img {
  border-style: none;
}

figure {
  max-width: 100%;
}

figcaption {
  color: var(--ah-color-text-muted);
  font-size: var(--ah-font-size-sm);
  margin-block-start: var(--ah-space-3);
}

label {
  color: var(--ah-color-text);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-md);
  background: var(--ah-color-surface);
  color: var(--ah-color-text);
  line-height: 1.4;
  padding: 0.8rem 0.95rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--ah-color-text-muted);
  opacity: 1;
}

input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ah-color-brand);
  outline-offset: 3px;
  box-shadow: var(--ah-focus-ring);
}

:focus:not(:focus-visible) {
  outline: none;
}

table {
  width: 100%;
  color: var(--ah-color-text-secondary);
}

th,
td {
  border-block-end: 1px solid var(--ah-color-border);
  padding: var(--ah-space-4);
  text-align: start;
  vertical-align: top;
}

th {
  color: var(--ah-color-text);
  font-weight: 700;
}

.ah-site {
  min-height: 100vh;
  background: var(--ah-color-bg);
  color: var(--ah-color-text);
}

.ah-eyebrow,
.ah-technical-label {
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: var(--ah-font-size-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ah-text-secondary {
  color: var(--ah-color-text-secondary);
}

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

.ah-section--dark {
  background: var(--ah-color-bg);
  color: var(--ah-color-text);
}

.ah-section--dark p,
.ah-section--dark li,
.ah-section--dark dd {
  color: var(--ah-color-text-secondary);
}

/*
 * Accessible utility copied into the theme instead of depending on
 * WordPress core helper classes in custom UI.
 */
.ah-screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ah-screen-reader-text:focus {
  position: fixed !important;
  z-index: 100000;
  inset-block-start: var(--ah-space-4);
  inset-inline-start: var(--ah-space-4);
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  clip-path: none;
  border-radius: var(--ah-radius-sm);
  background: var(--ah-color-surface);
  color: var(--ah-color-text);
  padding: var(--ah-space-3) var(--ah-space-4);
  white-space: normal;
}

@supports not (color: color-mix(in srgb, black, white)) {
  ::selection {
    background: rgba(86, 87, 230, 0.24);
  }

  mark {
    background: rgba(183, 243, 74, 0.45);
  }
}
