/* ==========================================================================
   OPEN LANGUAGE — SPACEX AESTHETIC × NEW ZEALAND LOCAL AUTHORITY
   High-contrast Obsidian Cinematic Landing Page (v2.0)
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. DESIGN TOKENS & ROOT VARIABLES
   -------------------------------------------------------------------------- */
:root {
  --bg-void: #000000;
  --bg-obsidian: #05070A;
  --bg-elevated: #0A0E14;
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.78);
  --text-muted: rgba(255, 255, 255, 0.50);
  --border-subtle: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.75);

  --font-sans: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --header-height: 72px;
  --ease-spacex: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   02. RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-void);
  color: var(--text-primary);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

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

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

button {
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

/* Accessibility skip link */
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 100;
  padding: 12px 20px;
  background: #FFFFFF;
  color: #05070A;
  font-weight: 600;
  font-size: 0.875rem;
  transition: top 0.2s ease;
}

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

/* --------------------------------------------------------------------------
   03. FIXED MINIMAL HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 50;
  background: transparent;
  transition: background-color 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  background: rgba(5, 7, 10, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.header-container {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  transition: opacity 0.25s ease;
}

.brand-link:hover {
  opacity: 0.85;
}

.brand-logo-img {
  width: 195px;
  height: 26px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  position: relative;
  padding: 4px 0;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: #FFFFFF;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease-spacex);
}

.nav-link:hover {
  color: #FFFFFF;
}

.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* --------------------------------------------------------------------------
   04. SPACEX SIGNATURE GHOST BUTTONS (.btn-spacex)
   -------------------------------------------------------------------------- */
.btn-spacex {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 34px;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s var(--ease-spacex), border-color 0.35s ease;
}

.btn-spacex::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 0.35s var(--ease-spacex);
  z-index: -1;
}

.btn-spacex:hover::before,
.btn-spacex:focus-visible::before {
  transform: scaleY(1);
}

.btn-spacex:hover,
.btn-spacex:focus-visible {
  color: #05070A;
  border-color: #FFFFFF;
}

.btn-spacex:active {
  transform: scale(0.99);
}

.btn-spacex--sm {
  padding: 8px 18px;
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
   05. DESKTOP VERTICAL SECTION INDICATOR (>= 1024px)
   -------------------------------------------------------------------------- */
.section-nav-tracker {
  position: fixed;
  right: 2.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  list-style: none;
}

@media (min-width: 1024px) {
  .section-nav-tracker {
    display: flex;
  }
}

.tracker-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.8);
  transition: color 0.3s ease;
  padding: 4px 0;
}

.tracker-tick {
  width: 18px;
  height: 1px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  transition: width 0.3s var(--ease-spacex), background-color 0.3s ease;
}

.tracker-link:hover {
  color: rgba(255, 255, 255, 0.92);
}

.tracker-link:hover .tracker-tick {
  width: 28px;
  background: rgba(255, 255, 255, 0.85);
}

.tracker-link.is-active {
  color: #FFFFFF;
}

.tracker-link.is-active .tracker-tick {
  width: 36px;
  background: #FFFFFF;
}

/* --------------------------------------------------------------------------
   06. FULL-VIEWPORT CINEMATIC PANELS
   -------------------------------------------------------------------------- */
.panel-viewport {
  position: relative;
  min-height: 100svh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background-color: var(--bg-void);
}

/* Subtle architectural separator between stacked full-screen chapters */
.panel-viewport + .panel-viewport {
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.panel-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  pointer-events: none;
}

/* v2.0 Refined Directional Scrim: Text shield on left, 100% bright right */
.panel-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    /* Left-side text contrast shield — fades to 0% darkness by 68% width */
    linear-gradient(90deg, rgba(4, 6, 9, 0.90) 0%, rgba(4, 6, 9, 0.72) 34%, rgba(4, 6, 9, 0.22) 54%, rgba(4, 6, 9, 0) 68%),
    /* Subtle top header legibility veil + bottom telemetry bar legibility gradient */
    linear-gradient(180deg, rgba(4, 6, 9, 0.48) 0%, rgba(4, 6, 9, 0) 15%, rgba(4, 6, 9, 0) 68%, rgba(4, 6, 9, 0.86) 100%);
}

.panel-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 130px 6vw 48px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   07. UNIFIED 4-PART SECTION TEMPLATE (v2.0)
   -------------------------------------------------------------------------- */
.panel-title {
  font-size: clamp(2.4rem, 4.8vw, 4.1rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.panel-subtitle {
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.68;
  color: var(--text-secondary);
  max-width: 640px;
  text-wrap: pretty;
  margin-bottom: 2.25rem;
}

/* Part 3: Unified 3-Column Telemetry Strip */
.telemetry-bar {
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  margin-bottom: 2.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .telemetry-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.telemetry-item {
  display: flex;
  flex-direction: column;
}

.telemetry-metric {
  font-family: 'Inter', var(--font-sans);
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.18;
  margin-bottom: 0.4rem;
}

.telemetry-value {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.76);
}

/* Part 4: Bottom Action Slot */
.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 0;
}

.link-scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 14px 4px;
  transition: color 0.25s ease, transform 0.25s ease;
}

.link-scroll-cue:hover {
  color: #FFFFFF;
  transform: translateY(2px);
}

/* --------------------------------------------------------------------------
   08. SECTION 05 — CONTACT LAYOUT & COMPACT INLINE QR
   -------------------------------------------------------------------------- */
.contact-hero-head {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2.25rem;
}

@media (min-width: 768px) {
  .contact-hero-head {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(2.25rem, 4vw, 3.5rem);
  }
}

.contact-head-text {
  flex: 0 1 540px;
  max-width: 540px;
}

.contact-qr-inline {
  flex-shrink: 0;
}

/* Viewfinder Frame with 4 white corner brackets */
.viewfinder-frame {
  position: relative;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.viewfinder-frame--compact {
  padding: 14px;
  width: 164px;
}

.corner {
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
}

.corner--tl {
  top: -1px;
  left: -1px;
  border-top: 2px solid #FFFFFF;
  border-left: 2px solid #FFFFFF;
}

.corner--tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid #FFFFFF;
  border-right: 2px solid #FFFFFF;
}

.corner--bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid #FFFFFF;
  border-left: 2px solid #FFFFFF;
}

.corner--br {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid #FFFFFF;
  border-right: 2px solid #FFFFFF;
}

.qr-pad--compact {
  padding: 8px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-pad--compact svg {
  width: 120px;
  height: 120px;
  display: block;
}

.qr-caption-compact {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 8px;
  text-align: center;
}

/* Contact minimal integrated footer */
.contact-minimal-footer {
  width: 100%;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.42);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   09. WECHAT MODAL DIALOG & MODERN WEB GUIDANCE
   -------------------------------------------------------------------------- */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition-property: background-color, display, overlay;
  transition-duration: 0.28s;
  transition-timing-function: var(--ease-spacex);
  transition-behavior: allow-discrete;
}

:is(dialog[open]):where(:not([data-closing])) {
  opacity: 1;
  transform: scale(1) translateY(0);

  @starting-style {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }

  &::backdrop {
    background-color: rgba(3, 5, 8, 0.82);

    @starting-style {
      background-color: transparent;
    }
  }
}

.wechat-dialog {
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.28s;
  transition-timing-function: var(--ease-spacex);
  transition-behavior: allow-discrete;

  padding: 0;
  margin: auto;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 14, 20, 0.95);
  color: var(--text-primary);
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .wechat-dialog {
    transform: none;
    transition-duration: 0.1s;
  }

  @starting-style {
    .wechat-dialog[open] {
      transform: none;
    }
  }
}

.modal-inner {
  position: relative;
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-header {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.modal-heading-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-context-tag {
  font-family: 'Inter', var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #FFFFFF;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  color: var(--text-secondary);
  transition: all 0.25s ease;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #FFFFFF;
  color: #05070A;
  border-color: #FFFFFF;
}

.modal-qr-box {
  padding: 12px;
  background: #FFFFFF;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-qr-box svg,
.modal-qr-box img {
  width: 210px;
  height: 210px;
  display: block;
}

.modal-wechat-id-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.modal-wechat-id {
  font-family: 'Inter', monospace;
  font-weight: 600;
  color: #FFFFFF;
}

.modal-actions {
  width: 100%;
}

.modal-btn-copy-main {
  width: 100%;
  text-align: center;
  padding: 14px 20px;
  text-transform: none;
  letter-spacing: 0.04em;
}

.modal-secondary-note {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   10. HERO MOUNT & SCROLL ENTRY PROGRESSIVE ENHANCEMENT
   -------------------------------------------------------------------------- */
@keyframes hero-mount {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-entrance {
  animation: hero-mount 0.85s var(--ease-spacex) both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-entrance {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes spacex-panel-reveal {
      from {
        opacity: 0;
        transform: translateY(28px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .scroll-reveal {
      animation: spacex-panel-reveal auto var(--ease-spacex) both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}

@supports not ((animation-timeline: view()) and (animation-range: entry)) {
  .scroll-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.75s var(--ease-spacex), transform 0.75s var(--ease-spacex);
  }

  .scroll-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE REFINEMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .site-header {
    height: 64px;
  }

  .nav-links {
    display: none;
  }

  .brand-logo-img {
    width: 160px;
    height: 22px;
  }

  .btn-spacex {
    width: 100%;
    padding: 13px 20px;
  }

  .site-header .btn-spacex--sm {
    width: auto;
    padding: 7px 15px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }

  .panel-bg-img {
    object-position: 68% center;
  }

  .panel-content {
    padding: 100px 5vw 32px;
  }

  .panel-title {
    font-size: clamp(2rem, 8vw, 2.65rem);
    margin-bottom: 1rem;
  }

  .panel-subtitle {
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1.75rem;
  }

  .panel-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .panel-actions .modal-btn-copy-main {
    width: 100% !important;
  }

  .link-scroll-cue {
    justify-content: center;
    padding: 8px 0;
  }

  .telemetry-bar {
    gap: 1.15rem;
    margin-bottom: 1.75rem;
    padding-top: 1.25rem;
  }

  .contact-hero-head {
    gap: 1.5rem;
    margin-bottom: 1.75rem;
  }

  .contact-qr-inline {
    align-self: flex-start;
  }
}
