/* Reset, typography and shared building blocks. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-night);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote {
  margin: 0;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

::selection {
  background: var(--color-lime);
  color: var(--color-on-lime);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--gutter);
  z-index: 200;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-lime);
  color: var(--color-on-lime);
  font-weight: 600;
}

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

/* Typography: titles in Barlow SemiBold, ending with a period; the last word is underlined in lime. */
.title {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-title);
  letter-spacing: calc(var(--tracking-title) * -1);
  text-wrap: balance;
}

.title-xl {
  font-size: var(--size-h1);
  letter-spacing: -0.035em;
}

.title-lg {
  font-size: var(--size-h2);
  letter-spacing: -0.025em;
}

.title-md {
  font-size: var(--size-h3);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

/* A real text underline, so skip-ink breaks the line around descenders (g, j, p, y).
   Without JS this is a plain lime underline. With JS (js/main.js sets data-text) a transparent copy of the word
   carries the underline instead, so it can be drawn in from left to right (--underline-progress 0..1) while the
   word itself always stays fully visible. */
.underline-word {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  text-decoration-line: underline;
  text-decoration-color: var(--color-lime);
  text-decoration-thickness: max(3px, 0.06em);
  text-underline-offset: 0.1em;
  text-decoration-skip-ink: auto;
}

.underline-word[data-text] {
  text-decoration-color: transparent;
}

.underline-word[data-text]::after {
  content: attr(data-text) / '';
  position: absolute;
  inset: 0;
  color: transparent;
  text-decoration-line: underline;
  text-decoration-color: var(--color-lime);
  text-decoration-thickness: max(3px, 0.06em);
  text-underline-offset: 0.1em;
  text-decoration-skip-ink: auto;
  clip-path: inset(-0.5em calc((1 - var(--underline-progress, 1)) * 100%) -0.5em 0);
  pointer-events: none;
  user-select: none;
}

/* SplitText can leave empty copies of the span behind; they must not show an underline. */
.underline-word:empty::after {
  display: none;
}

/* Small functional labels (counter caption, node and layer names, footer headings). Plain Barlow: tracked
   capitals read as template-like; only file types (PDF, IFC) keep capitals (.ov-file-type). */
.label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

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

/* Light chapters: the same components, with navy text and a darker green for readable accents. */
.theme-light {
  --color-text: var(--color-navy);
  --color-text-muted: rgba(18, 41, 65, 0.74);
  --color-text-dim: rgba(18, 41, 65, 0.5);
  --color-line: rgba(18, 41, 65, 0.14);
  --color-line-strong: rgba(18, 41, 65, 0.3);
  --color-surface: rgba(255, 255, 255, 0.6);
  --color-surface-strong: rgba(255, 255, 255, 0.9);
  --color-accent-text: #3d7a0f;
  color: var(--color-text);
}

.theme-light :focus-visible {
  outline-color: var(--color-accent-text);
}

.theme-light .glass {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 60px rgba(18, 41, 65, 0.08);
}

.theme-light .button-ghost:hover {
  border-color: var(--color-accent-text);
  color: var(--color-accent-text);
}

.lead {
  font-size: var(--size-lead);
  line-height: 1.45;
  color: var(--color-text-muted);
  max-width: 34em;
}

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

.outline-text {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--color-lime);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--size-button);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition:
    background-color var(--duration-fast),
    box-shadow var(--duration-fast),
    border-color var(--duration-fast),
    transform var(--duration-fast);
}

.button-primary {
  background: var(--color-lime);
  color: var(--color-on-lime);
}

.button-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.button-ghost {
  border-color: var(--color-line-strong);
  background: var(--color-surface);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
}

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

.button-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Glass panel */
.glass {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
}

/* Film grain over the whole page, as in the brand gradients. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 150;
  pointer-events: none;
  background-image: var(--texture-noise);
  background-size: 200px 200px;
  opacity: 0.07;
  mix-blend-mode: overlay;
}

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

/* Lenis */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}
