/**
 * base.css
 * Reset, base typography, and shared primitives (buttons, container,
 * section headers, icons, accessibility helpers) used across every page.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  width: 100%;
  /* .site-header is position:fixed (out of normal flow), so push all
     in-flow content down by its height to avoid it hiding underneath. */
  padding-top: var(--header-height);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-ink-700);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

body.nav-open {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--color-ink-900);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* --- Accessibility ----------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-sm);
  z-index: 1000;
  background: var(--color-ink-900);
  color: var(--color-white);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: top var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-sm);
}

:focus-visible {
  outline: 2px solid var(--color-accent-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Layout primitives -------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--space-2xl);
}

.section:nth-of-type(even) {
  background: var(--color-surface-alt);
}

.section__header {
  max-width: 640px;
  margin-bottom: var(--space-xl);
}

.section__header .section__desc {
  margin-top: var(--space-sm);
}

.section__title {
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
}

.section__desc {
  font-size: var(--fs-md);
  color: var(--color-ink-500);
  line-height: var(--lh-relaxed);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent-600);
  margin-bottom: var(--space-sm);
}

.eyebrow .icon {
  color: var(--color-accent-500);
}

/* --- Icons -------------------------------------------------------------- */
.icon {
  flex-shrink: 0;
  display: inline-block;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  border-radius: var(--radius-full);
  padding: 0.9rem 1.5rem;
  white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
  min-height: 44px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--gradient-accent);
  color: var(--color-white);
  box-shadow: var(--shadow-accent);
}

.btn--primary:hover {
  box-shadow: 0 16px 34px rgba(11, 95, 255, 0.3);
}

.btn--secondary {
  background: var(--color-accent-50);
  color: var(--color-accent-700);
}

.btn--secondary:hover {
  background: var(--color-accent-100);
}

.btn--ghost {
  background: transparent;
  color: var(--color-ink-800);
  border: 1px solid var(--color-border-strong);
}

.btn--ghost:hover {
  border-color: var(--color-accent-500);
  color: var(--color-accent-700);
}

.btn--onDark {
  background: var(--color-white);
  color: var(--color-accent-700);
}

.btn--onDark:hover {
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.btn--ghostOnDark {
  background: transparent;
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn--ghostOnDark:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.btn--sm {
  padding: 0.65rem 1.1rem;
  font-size: var(--fs-xs);
  min-height: 38px;
}

.btn--lg {
  padding: 1.05rem 1.9rem;
  font-size: var(--fs-base);
}

/* --- Card surface primitive --------------------------------------------- */
.surface-card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* --- Status page (404 / error) ------------------------------------------ */
.state-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.state-page__inner {
  max-width: 560px;
  margin-inline: auto;
  text-align: center;
}

.state-page__code {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--color-accent-600);
  margin-bottom: var(--space-sm);
}

.state-page__title {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-sm);
}

.state-page__desc {
  color: var(--color-ink-500);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-lg);
}

.state-page__debug {
  text-align: left;
  background: var(--color-ink-900);
  color: #f4f6fb;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
}

/* --- Legal pages --------------------------------------------------------- */
.legal-page__inner {
  max-width: 760px;
  margin-inline: auto;
}

.legal-page__title {
  font-size: var(--fs-3xl);
  margin-top: var(--space-2xs);
}

.legal-page__updated {
  color: var(--color-ink-400);
  font-size: var(--fs-sm);
  margin-top: var(--space-2xs);
  margin-bottom: var(--space-xl);
}

.legal-content p {
  color: var(--color-ink-600);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-sm);
}

.legal-content h2 {
  font-size: var(--fs-lg);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.legal-content ul {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

.legal-content li {
  list-style: disc;
  color: var(--color-ink-600);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-3xs);
}

.legal-content a {
  color: var(--color-accent-600);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Responsive: container padding tightens on very small screens ------- */
@media (max-width: 374px) {
  .section {
    padding-block: var(--space-xl);
  }
}
