/* Base: reset, document defaults, typography, utilities and controls. */

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

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

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

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

/* Document */
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection {
  background: var(--ember);
  color: var(--bg);
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
}

h2,
.section-title {
  font-size: var(--fs-h2);
}

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

/* Emphasis follows the same family as the rest of the interface. */
em {
  font-family: inherit;
  font-style: normal;
  font-weight: 800;
  color: var(--ember);
}

p {
  max-width: 62ch;
  text-wrap: pretty;
}

/* Sections */
.section {
  padding-block: var(--space-section);
}

.section-title {
  margin-block-end: var(--space-6);
}

/* Labels: mono, uppercase, small */
.section-label,
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-label {
  color: var(--steel);
}

.section-label > span + span::before {
  content: "";
  display: inline-block;
  inline-size: var(--space-8);
  block-size: 1px;
  margin-inline-end: var(--space-3);
  vertical-align: middle;
  background: var(--line-strong);
}

.eyebrow {
  display: inline-flex;
  gap: var(--space-2);
  color: var(--muted);
}

/* Pulse dot: ember core with a steel ring */
.pulse-dot {
  display: inline-block;
  flex-shrink: 0;
  inline-size: 0.5em;
  block-size: 0.5em;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 0.3em var(--steel-glow), 0 0 0.9em var(--ember-glow);
  animation: pulse calc(var(--dur-slow) * 2) var(--ease-in-out) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot {
    animation: none;
  }
}

/* Utilities */
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--ember);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(calc(-100% - var(--space-8)));
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  transform: none;
}


/* Text link: underline draws in on hover and focus */
.text-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: none;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.text-link::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -0.25em;
  block-size: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--ember-2);
}

.text-link:hover::after,
.text-link:focus-visible::after {
  transform: scaleX(1);
}

/* Buttons */
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 3rem;
  padding: var(--space-3) var(--space-6);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    translate var(--dur-fast) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

/* Solid ember fill with one soft glow. No inset highlight: it drew a stray light edge on the top border. */
.button-primary {
  border-color: var(--ember);
  background: var(--ember);
  color: var(--bg);
  box-shadow: 0 12px 28px -14px var(--ember-glow);
}

.button-primary:hover {
  background: color-mix(in srgb, var(--ember) 88%, var(--ember-2));
  border-color: color-mix(in srgb, var(--ember) 88%, var(--ember-2));
  box-shadow: 0 16px 34px -14px var(--ember-glow);
}

/* Press feedback: `scale` leaves other transforms alone. */
.button-primary:active {
  scale: 0.97;
}

.button-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.button-ghost:hover {
  border-color: var(--steel);
  color: var(--steel);
}

.button-lg {
  min-block-size: 3.5rem;
  padding-inline: var(--space-8);
  font-size: var(--fs-lg);
}

.button-block {
  inline-size: 100%;
}

/* Progress bar: hidden until the button has .is-loading */
.button-progress {
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: 0;
  inline-size: 40%;
  block-size: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

.button.is-loading .button-progress {
  animation: indeterminate var(--dur-slow) var(--ease-in-out) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .button.is-loading .button-progress {
    animation: none;
    transform: none;
  }
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: var(--space-1);
}

/* Cursor glow: follows the pointer via --cursor-x / --cursor-y (cursor.js) */
.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  inline-size: 36rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--steel-glow), transparent);
  mix-blend-mode: screen;
  pointer-events: none;
  transform: translate(var(--cursor-x,0), var(--cursor-y,0)) translate(-50%,-50%);
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-glow {
    display: none;
  }
}
