/* ==========================================================================
   Doxablox — Design Tokens & Base Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Colour palette */
  --color-bg:       #0B0B0B; /* near-black canvas */
  --color-fg:       #FFFFFF; /* primary text / foreground */
  --color-surface:  #F4F2EF; /* warm gray surface */
  --color-accent:   #C8A96E; /* muted amber accent */
  --color-nav-link: #9E9A94; /* warm gray — quiet nav text */

  /* Syntax highlight colours */
  --color-hl-string:  #C8A96E; /* same as accent */
  --color-hl-keyword: #7BA7BC; /* muted blue */
  --color-hl-comment: #6B7280; /* dim gray */

  /* Typography */
  --font-brand: 'magox', system-ui, sans-serif;
  --font-body:  system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
                Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  'Menlo', 'Consolas', 'Monaco', 'Courier New', monospace;

  /* Wordmark sizing — fluid between 2.5 rem and 6 rem */
  --wordmark-size: clamp(2.5rem, 8vw, 6rem);

  /* Motion */
  --duration-fade:  300ms;
  --nav-duration:   400ms;
  --easing-default: ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow-y: scroll;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  background-color: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Stage — full-viewport flex column, centres wordmark + sequence
   -------------------------------------------------------------------------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 4rem 1.5rem 2rem;
  gap: 3rem;
}

/* --------------------------------------------------------------------------
   Wordmark — in-flow, centred in the stage column
   -------------------------------------------------------------------------- */
.wordmark {
  font-family: var(--font-brand);
  font-size: var(--wordmark-size);
  color: var(--color-fg);
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
  text-align: center;

  pointer-events: none;
  user-select: none;

  /* Smooth transition when path is chosen */
  transition:
    opacity var(--duration-fade) var(--easing-default),
    font-size var(--duration-fade) var(--easing-default);
}

/* Bug 2 fix: fade out wordmark and sequence layer when a path is active */
[data-path] .wordmark {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Sequence layer — sits below wordmark in flex column
   Elevated z-index so it renders above the absolute .path-section overlays
   -------------------------------------------------------------------------- */
.sequence-layer {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 560px;
  /* min-height keeps the stage from collapsing when elements are hidden */
  min-height: 12rem;

  /* Smooth fade-out transition when path is chosen */
  transition: opacity var(--duration-fade) var(--easing-default);
}

/* Bug 2 fix: fade out entire sequence layer when path is active */
[data-path] .sequence-layer {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Opening-sequence elements — hidden by default, shown by FSM
   -------------------------------------------------------------------------- */
.truth-text,
.why-text {
  width: 100%;
  max-width: 480px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  /* NOT position:absolute — these stack vertically in the flex column */
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.5;
  color: var(--color-fg);
  transition:
    opacity var(--duration-fade) var(--easing-default),
    transform var(--duration-fade) var(--easing-default);
}

/* Bug 2 fix: ensure individual elements also become non-interactive */
[data-path] .truth-text,
[data-path] .why-text,
[data-path] .visual-dots,
[data-path] .path-buttons {
  opacity: 0;
  pointer-events: none;
}

.visual-dots {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);

  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: center;
  justify-content: center;

  transition:
    opacity var(--duration-fade) var(--easing-default),
    transform var(--duration-fade) var(--easing-default);
}

.visual-dots span {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--color-accent);
  animation: dot-pulse 1.4s ease-in-out infinite;
}

.visual-dots span:nth-child(2) { animation-delay: 0.2s; }
.visual-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(1);   opacity: 1; }
  40%           { transform: scale(1.4); opacity: 0.7; }
}

.path-buttons {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);

  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  width: 100%;
  align-items: center;

  transition:
    opacity var(--duration-fade) var(--easing-default),
    transform var(--duration-fade) var(--easing-default);
}

.path-btn {
  background: transparent;
  border: 1px solid #ffffff;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  width: 100%;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.path-btn:hover,
.path-btn:focus-visible {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
  outline: none;
}

.path-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Noscript Fallback
   -------------------------------------------------------------------------- */
.js-ready noscript {
  display: none;
}

/* --------------------------------------------------------------------------
   Reduced-motion: disable animations but keep transitions
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}