/* Creative Human — shared site-wide CSS.
 *
 * Site-wide utility classes and primitives extracted from per-page <style> blocks.
 * Loaded from every HTML page BEFORE the page-specific <style> block.
 *
 * Scope:
 *   - Global font-feature-settings (tabular-nums baseline)
 *   - gradient-primary, glass-nav, glass-nav-dark
 *   - ghost-border, ghost-border-dark, ghost-border-dark-strong
 *   - skip-link (Room/Archive variant) + skip-link-dark (Instrument variant)
 *   - View-transition primitives
 *   - Reduced-motion global override
 *
 * Page-specific styles (hero atmosphere, stepper, narrative-tracker, case-study
 * motion, form-field underline, footnote-chip renderings) remain in per-page
 * <style> blocks, for now.
 *
 * Last Updated: 2026-04-17
 */

/* -----------------------------------------------------------
   Global reset — box-sizing, margin, img safety
   ----------------------------------------------------------- */

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

html,
body {
  font-feature-settings: "tnum";
  margin: 0;
}

img { max-width: 100%; height: auto; }

/* Long-word safety net — prevents horizontal overflow from URLs,
   German compound words, and inline code. */
.ch-legal-body,
.ch-legal-callout,
.ch-post-body {
  overflow-wrap: break-word;
  word-break: break-word;
}

code {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* -----------------------------------------------------------
   Site chrome — gradient primary, glass navs, ghost borders
   ----------------------------------------------------------- */

.gradient-primary {
  background: linear-gradient(15deg, #006a66 0%, #18b5ae 100%);
}

/* Site-wide CTA motion + accessibility:
   - :active gives tactile feedback (scale 0.98) on click/tap
   - :focus-visible surfaces the cyan outline for keyboard users
   - :hover brightens ~4% for depth without changing hue
   All gated by reduced-motion; respects the single-easing rule. */
@media (prefers-reduced-motion: no-preference) {
  .gradient-primary {
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
                filter 200ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }
  .gradient-primary:hover { filter: brightness(1.04); }
  .gradient-primary:active { transform: scale(0.98); }
}

.gradient-primary:focus-visible {
  outline: 2px solid #18b5ae;
  outline-offset: 2px;
}

.glass-nav {
  background-color: rgba(252, 249, 246, 0.60);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.glass-nav-dark {
  background-color: rgba(14, 13, 11, 0.60);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.ghost-border {
  border-color: rgba(187, 201, 199, 0.25);
}

.ghost-border-dark {
  border-color: rgba(108, 122, 120, 0.20);
}

.ghost-border-dark-strong {
  border-color: rgba(108, 122, 120, 0.35);
}

/* -----------------------------------------------------------
   Skip link — keyboard-only accessibility primitive.
   Dark variant for Instrument-mode pages.
   ----------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #1c1c1a;
  color: #fcf9f6;
  padding: 12px 24px;
  z-index: 100;
  font-family: "Space Grotesk", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* Instrument-mode dark pages override the chrome colour */
[data-mode="instrument"] .skip-link {
  background: #f3f0ed;
  color: #0E0D0B;
}

/* -----------------------------------------------------------
   View transitions — cross-page morph
   ----------------------------------------------------------- */

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

::view-transition-old(root) {
  animation: vt-out 420ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

::view-transition-new(root) {
  animation: vt-in 420ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* -----------------------------------------------------------
   Global reduced-motion contract.
   Page-level motion declarations gate themselves on the
   no-preference query; this block is a safety net for
   anything not otherwise wrapped.
   ----------------------------------------------------------- */

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