/* ==========================================================================
   ATHAR — base.css
   Element-level defaults, typography scale, focus, forms.
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background-color: var(--c-bg);
  background-image:
    radial-gradient(
      120% 70% at 50% -12%,
      rgba(30, 67, 214, 0.055),
      transparent 62%
    ),
    radial-gradient(
      90% 60% at 100% 0%,
      rgba(164, 96, 60, 0.05),
      transparent 58%
    );
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    transition:
      background-color var(--dur-slow) var(--ease-out),
      color var(--dur-slow) var(--ease-out);
  }
}

::selection {
  background: var(--c-accent);
  color: var(--c-text-inverse);
}

/* --------------------------------------------------------------------------
   Headings
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--c-text);
}

.display {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.heading-xl {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

.heading-lg {
  font-size: var(--fs-2xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

.heading-md {
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

.heading-sm {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-xwide);
  text-transform: uppercase;
  color: var(--c-clay);
}

.lead {
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--c-text-muted);
}

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

.text-subtle {
  color: var(--c-text-subtle);
}

.text-accent {
  color: var(--c-accent);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

a {
  color: var(--c-accent);
  text-decoration: underline;
  text-decoration-thickness: var(--bw-1);
  text-underline-offset: 3px;
  text-decoration-color: var(--c-accent-line);
  transition:
    color var(--dur-fast) var(--ease-out),
    text-decoration-color var(--dur-fast) var(--ease-out);
}

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

a:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   Focus
   -------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

input,
textarea,
select {
  width: 100%;
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--c-text);
  background: var(--c-surface);
  border: var(--bw-1) solid var(--c-border-strong);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

input::placeholder,
textarea::placeholder {
  color: var(--c-text-subtle);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--c-text-subtle);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--c-danger);
}

select {
  appearance: none;
  cursor: pointer;
  padding-inline-end: var(--sp-7);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* The chevron belongs to the inline-end edge, which flips with direction. */
[dir="rtl"] select {
  background-position:
    17px calc(50% + 2px),
    12px calc(50% + 2px);
}

textarea {
  min-block-size: 130px;
  resize: vertical;
  line-height: var(--lh-base);
}

fieldset {
  border: none;
  padding: 0;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Code & small type
   -------------------------------------------------------------------------- */

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--c-surface-sunken);
  border: var(--bw-1) solid var(--c-border);
  border-radius: var(--r-xs);
  padding: 0.1em 0.4em;
}

hr {
  border: none;
  border-block-start: var(--bw-1) solid var(--c-border);
  margin-block: var(--sp-7);
}

/* --------------------------------------------------------------------------
   Motion preference
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
