/* ==========================================================================
   global.css - base element styling, layout primitives, typography,
   section scaffolding and a small set of utilities.

   Component-level styling (buttons, cards, nav, forms…) lives in
   components.css. Breakpoint overrides live in responsive.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Base
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-md));
  background-color: var(--color-bg);
  color-scheme: dark;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  overflow-x: hidden;
}

/* Locks the page behind the open mobile navigation. */
html.is-nav-open,
html.is-nav-open body {
  overflow: hidden;
}

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

/* --------------------------------------------------------------------------
   2. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-snug);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
}

h4 {
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
}

p {
  max-width: var(--measure);
}

strong {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-xs);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--color-text);
}

abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 0.25em;
  cursor: help;
}

/* Display type - the hero lockups. */
.display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--color-text);
}

/* Mono eyebrow used above section headings and on metadata. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-accent);
}

.eyebrow::before {
  content: "";
  inline-size: 18px;
  block-size: 1px;
  background-color: var(--color-accent-line);
  flex: none;
}

.eyebrow--plain::before {
  display: none;
}

.lead {
  font-size: var(--text-lead);
  color: var(--color-text-secondary);
  line-height: 1.55;
}

.meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  color: var(--color-muted);
}

/* Marks copy that is intentionally provisional. Also easy to grep for.

   The class is doubled deliberately. global.css loads before
   components.css, so a plain .placeholder-text would lose to component
   text colors such as .def-list__desc. Doubling raises specificity to
   (0,2,0) without resorting to !important, which keeps it overridable. */
.placeholder-text.placeholder-text {
  color: var(--color-muted);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   3. Links
   -------------------------------------------------------------------------- */

a {
  transition: color var(--duration-fast) var(--ease-out);
}

.prose a,
a.text-link {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-line);
}

.prose a:hover,
a.text-link:hover {
  color: var(--color-accent-bright);
  text-decoration-color: currentColor;
}

/* --------------------------------------------------------------------------
   4. Focus
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Do not show the ring for pointer interaction, but never remove it for keys. */
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-sm);
  inset-block-start: var(--space-sm);
  z-index: var(--z-skip-link);
  padding: var(--space-2xs) var(--space-sm);
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-accent);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--text-sm);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   5. Layout primitives
   -------------------------------------------------------------------------- */

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

.container--narrow {
  max-width: var(--container-narrow);
}

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

.section--tight {
  padding-block: clamp(3rem, 5vw, 4.5rem);
}

.section--band {
  background-color: var(--color-bg-elevated);
  border-block: var(--border-width) solid var(--color-border);
}

/* Section header: eyebrow + heading + optional intro. */
.section-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-block-end: var(--space-lg);
  max-width: var(--container-narrow);
}

.section-header__title {
  margin: 0;
}

.section-header__intro {
  color: var(--color-text-secondary);
  font-size: var(--text-lead);
}

.section-header--split {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  max-width: none;
}

/* Generic responsive grid. Column counts are set in responsive.css. */
.grid {
  display: grid;
  gap: var(--space-md);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.stack--md {
  gap: var(--space-md);
}

.stack--lg {
  gap: var(--space-lg);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

/* Long, unbreakable technical strings must never blow out the layout. */
.break-anywhere {
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   6. Prose blocks
   -------------------------------------------------------------------------- */

.prose > * + * {
  margin-block-start: var(--space-sm);
}

.prose h2,
.prose h3 {
  margin-block-start: var(--space-lg);
}

.prose ul:not([class]) {
  padding-inline-start: var(--space-md);
  max-width: var(--measure);
}

.prose ul:not([class]) li::marker {
  color: var(--color-accent);
}

.prose ul:not([class]) li + li {
  margin-block-start: var(--space-3xs);
}

/* --------------------------------------------------------------------------
   7. Decorative rules
   -------------------------------------------------------------------------- */

.rule {
  border: 0;
  block-size: 1px;
  background-color: var(--color-border);
  margin: 0;
}

.rule--accent {
  inline-size: 56px;
  background-color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   8. Scroll-reveal
   Elements are hidden only when JavaScript is available; without it the
   noscript stylesheet restores them (see noscript.css).
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  will-change: opacity, transform;
}

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

/* --------------------------------------------------------------------------
   9. Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

.text-primary {
  color: var(--color-text);
}

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

.center {
  text-align: center;
}

.center p {
  margin-inline: auto;
}
