/* ==========================================================================
   Base Styles, Atmospheric Canvas, Controls, Motion & Native Modal Drawer
   ========================================================================== */

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

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

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: clip;
  min-height: 100svh;
  position: relative;
  background-image:
    radial-gradient(ellipse 68% 42% at 50% -4%, var(--glow-ember) 0%, transparent 64%),
    radial-gradient(circle at 12% 34%, var(--glow-magenta) 0%, transparent 40%),
    radial-gradient(circle at 88% 66%, var(--glow-cyan) 0%, transparent 44%),
    radial-gradient(ellipse 60% 35% at 50% 102%, var(--glow-magenta) 0%, transparent 58%);
  background-attachment: fixed;
}

/* Accessibility Helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-lowest);
  color: var(--text-primary);
  border: 2px solid var(--accent-primary);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* Container & Typography */
.container {
  width: min(100% - 2.5rem, var(--container-max));
  margin-inline: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.mono {
  font-family: var(--font-mono);
}

.horizon-text {
  background: var(--horizon-text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (forced-colors: active) {
  .horizon-text {
    background: none;
    color: CanvasText;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sunset-blaze);
  box-shadow: 0 0 10px rgba(255, 95, 31, 0.7);
  flex-shrink: 0;
}

.section-heading {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
  margin-bottom: 3rem;
}

.section-heading h2 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 800;
  margin-top: 1rem;
  margin-bottom: 0.9rem;
}

.section-heading p {
  font-size: 1.075rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.45rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.btn-primary {
  background: var(--sunset-cta-gradient);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(200, 62, 0, 0.28);
}

.btn-primary:hover {
  background: var(--sunset-cta-hover);
  box-shadow: 0 14px 34px rgba(255, 95, 31, 0.42);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary:hover,
  .btn-glass:hover {
    transform: translateY(-2px);
  }
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 16px;
}

.btn-outline {
  background: var(--bg-glass);
  border-color: var(--border-strong);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-glass {
  background: var(--bg-glass);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 0.72rem 1.15rem;
  font-size: 0.9rem;
}

.btn-glass:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface-lowest);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Glass Surface Cards */
.surface-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 40px var(--shadow-card);
}

/* Badges & Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.68rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.tag-primary {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border-color: var(--border-subtle);
}

.tag-cyan {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border-color: var(--border-subtle);
}

.tag-secondary {
  background: var(--accent-secondary-soft);
  color: var(--accent-secondary);
  border-color: var(--border-subtle);
}

.tag-amber {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  border-color: var(--border-subtle);
}

/* Brand-Consistent Native Range Sliders + Fallback */
input[type="range"].horizon-slider {
  width: 100%;
  height: 28px;
  accent-color: var(--accent-control);
  cursor: pointer;
}

@supports not (accent-color: #ff5f1f) {
  input[type="range"].horizon-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
  }

  input[type="range"].horizon-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(
      to right,
      var(--accent-control) var(--progress, 50%),
      var(--border-strong) var(--progress, 50%)
    );
  }

  input[type="range"].horizon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-control);
    border: 2px solid var(--bg-surface-lowest);
    margin-top: -6px;
  }

  input[type="range"].horizon-slider::-moz-range-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  input[type="range"].horizon-slider::-moz-range-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--accent-control);
  }

  input[type="range"].horizon-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-control);
    border: 2px solid var(--bg-surface-lowest);
  }
}

/* Scroll-Driven Entry Reveal (Opt-In Motion with Fallback) */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes horizon-reveal {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .reveal {
      animation: horizon-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }

  .reveal.is-js-pending {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .reveal.is-js-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Native Modal <dialog> Mobile Navigation Drawer (Scroll-Snap + Swipe Dismiss)
   ========================================================================== */

.mobile-drawer {
  --drawer-width: min(20rem, 82dvw, 100dvw - 24px);
  --drawer-backdrop: 0;

  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
  color: var(--text-primary);
}

.mobile-drawer::backdrop {
  background: #000000;
  opacity: calc(var(--drawer-backdrop) * 0.55);
}

.drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.drawer-scroller::-webkit-scrollbar {
  display: none;
}

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

.drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.drawer-sheet {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  padding: 1.25rem 1.5rem 2rem;
  background: var(--bg-surface-lowest);
  border-inline-end: 1px solid var(--border-subtle);
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-block: 1.5rem;
  list-style: none;
}

.drawer-nav a {
  display: block;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.drawer-nav a:hover {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}

.drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

@supports (animation-timeline: scroll()) {
  .mobile-drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }

  .drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }

  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }

  @keyframes fade-drawer-backdrop {
    0% {
      --drawer-backdrop: 1;
    }
    100% {
      --drawer-backdrop: 0;
    }
  }
}
