/* ============================================================================
   Base — resets, typography, layout primitives (TAD §2, loaded everywhere)
   ========================================================================= */

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  line-height: var(--line-tight);
  color: var(--color-text);
  margin: 0 0 var(--space-3);
  font-weight: var(--weight-bold);
}

h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
h3 { font-size: var(--font-size-md); }

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

code,
pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

/* Default icon size. Context rules (.btn .icon, .icon-tile .icon, …) override
   this via higher specificity, so any stray icon still stays a sane size. */
.icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex: none;
}

ul,
ol {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-4);
}

/* --- Layout primitives ---------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

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

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

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -60px;
  z-index: 100;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: top var(--transition);
}

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

/* Readable long-form content (about / privacy / contact) */
.prose {
  max-width: 70ch;
}

.prose h2 {
  margin-top: var(--space-5);
}

.prose p,
.prose li {
  color: var(--color-text-muted);
}

/* --- Contact form -------------------------------------------------------- */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 560px;
  margin-block: var(--space-4);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-group label {
  font-weight: var(--weight-medium);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.contact-form .btn {
  align-self: flex-start;
}

/* Honeypot: off-screen but still focusable for the rare screen reader. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  font-size: var(--font-size-sm);
  min-height: 1.2em;
  margin: 0;
}

.form-status[data-state="ok"] {
  color: var(--color-success);
}

.form-status[data-state="error"] {
  color: var(--color-error);
}

.contact-alt {
  font-size: var(--font-size-sm);
}

/* --- Global focus visibility (PRD §11) ----------------------------------- */

:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: var(--radius-sm);
}

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