/* ==========================================================================
   AL MOIN GROUP — BASE
   Reset, document defaults, typographic elements, links, focus, motion.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets must clear the sticky header (layout.md §10). */
  scroll-padding-top: calc(var(--header-height) + var(--space-6));
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* The mobile navigation panel covers the page, so the page behind it must
   not scroll. On wider screens the navigation is a normal bar and the
   document keeps its scroll. */
@media (max-width: 1023px) {
  body.nav-open {
    overflow: hidden;
  }
}

/* --------------------------------------------------------------------------
   MEDIA — never overflow, never distort (layout.md §7)
   -------------------------------------------------------------------------- */
img,
svg,
video,
canvas,
picture {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
}

h2 {
  font-size: var(--text-h2);
  letter-spacing: var(--tracking-display);
}

h3 {
  font-size: var(--text-h3);
}

h4 {
  font-size: var(--text-h4);
}

p {
  text-wrap: pretty;
}

strong,
b {
  font-weight: var(--weight-semibold);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

hr {
  height: 1px;
  margin: 0;
  border: 0;
  background-color: var(--color-divider);
}

blockquote {
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
}

code,
kbd,
pre,
samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

::selection {
  background-color: var(--brand-obsidian);
  color: var(--dark-text-primary);
}

/* --------------------------------------------------------------------------
   LINKS
   -------------------------------------------------------------------------- */
a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
}

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

address {
  font-style: normal;
}

/* --------------------------------------------------------------------------
   FOCUS — always visible, never removed (production.md §13)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--brand-jade);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.on-dark :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--dark-brand-accent);
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  background-color: var(--brand-obsidian);
  color: var(--dark-text-primary);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--dark-text-primary);
}

/* --------------------------------------------------------------------------
   FORMS — inherit typography so inputs match the type system
   -------------------------------------------------------------------------- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

/* --------------------------------------------------------------------------
   MOTION — restrained, and fully disabled on request
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   ACCESSIBILITY UTILITIES
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}
