/* MIRA brand site — tokens from brand/tokens.json (dark) */
:root {
  --mira-accent: #59e0f2;
  --mira-accent-deep: #408ceb;
  --mira-bg: #051c2c;
  --mira-bg-mid: #08172b;
  --mira-bg-deep: #03050d;
  --mira-text: rgba(255, 255, 255, 0.92);
  --mira-muted: rgba(255, 255, 255, 0.55);
  --mira-faint: rgba(255, 255, 255, 0.28);
  --font-display: "Exo 2", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--mira-text);
  background: var(--mira-bg-deep);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

#depth {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.fog {
  position: fixed;
  inset: -10%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(89, 224, 242, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(64, 140, 235, 0.08), transparent 50%),
    radial-gradient(ellipse 50% 35% at 85% 60%, rgba(5, 28, 44, 0.9), transparent 45%);
  animation: fog-drift 28s ease-in-out infinite alternate;
  mix-blend-mode: screen;
  opacity: 0.85;
}

@keyframes fog-drift {
  from {
    transform: translate3d(-2%, 1%, 0) scale(1.02);
  }
  to {
    transform: translate3d(3%, -2%, 0) scale(1.08);
  }
}

main {
  position: relative;
  z-index: 2;
}

/* —— Single viewport stage —— */
.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: block;
  padding:
    clamp(1rem, 3.5vh, 2.5rem)
    clamp(1.25rem, 5vw, 4rem)
    clamp(0.75rem, 2.5vh, 1.5rem);
  overflow: hidden;
  box-sizing: border-box;
}

.stage-head {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 40rem;
  min-height: 0;
  height: 100%;
  padding-top: 0;
  pointer-events: none;
}

.stage-head .cta,
.stage-head .cta * {
  pointer-events: auto;
}

.brand {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 9vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.9;
  color: var(--mira-text);
  text-shadow:
    0 0 40px rgba(89, 224, 242, 0.25),
    0 0 120px rgba(64, 140, 235, 0.2);
  opacity: 0;
  filter: blur(12px);
  transform: translateY(12px);
  animation: brand-in 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.expand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.8vw, 1.15rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--mira-text);
  opacity: 0;
  animation: rise 1.1s ease 0.45s forwards;
}

.mission {
  margin: 0.6rem 0 0;
  max-width: 38ch;
  font-size: clamp(0.88rem, 1.3vw, 1rem);
  font-weight: 300;
  color: var(--mira-muted);
  letter-spacing: 0.02em;
  line-height: 1.45;
  opacity: 0;
  animation: rise 1.1s ease 0.7s forwards;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.35rem;
  margin-top: 1.1rem;
  opacity: 0;
  animation: rise 1.1s ease 0.95s forwards;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mira-bg-deep);
  background: linear-gradient(135deg, var(--mira-accent), var(--mira-accent-deep));
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: filter 0.35s ease, transform 0.35s ease;
}

.cta-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

body.modal-open {
  overflow: hidden;
}

.cta-quiet {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mira-faint);
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.cta-quiet:hover {
  color: var(--mira-accent);
  border-bottom-color: rgba(89, 224, 242, 0.4);
}

@keyframes brand-in {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.lineup-label {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mira-faint);
}

/* —— Products around sonar —— */
.constellation {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  animation: rise 1.2s ease 1.05s forwards;
  pointer-events: none;
}

.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, 0);
  max-width: min(15rem, 42vw);
  text-align: left;
  pointer-events: auto;
  animation: star-drift 7.5s ease-in-out var(--drift, 0s) infinite alternate;
}

@keyframes star-drift {
  from {
    translate: 0 0;
  }
  to {
    translate: 10px -14px;
  }
}

.star-name {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0.15rem 0;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.2vw, 1.55rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

.product-tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(89, 224, 242, 0.45);
  transition: color 0.35s ease;
}

.star-name:hover,
.star-name:focus-visible,
.star.is-active .star-name {
  color: var(--mira-accent);
  text-shadow: 0 0 24px rgba(89, 224, 242, 0.4);
  outline: none;
}

.star-name:hover .product-tag,
.star-name:focus-visible .product-tag,
.star.is-active .product-tag {
  color: rgba(89, 224, 242, 0.85);
  text-shadow: none;
}

.star-sense {
  display: block;
  margin: 0.4rem 0 0;
  max-width: 22ch;
  font-size: clamp(0.82rem, 1.2vw, 0.95rem);
  font-weight: 300;
  color: var(--mira-muted);
  line-height: 1.4;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    max-height 0.45s ease;
  pointer-events: none;
}

.star:hover .star-sense,
.star:focus-within .star-sense,
.star.is-active .star-sense {
  opacity: 1;
  max-height: 6rem;
  transform: translateY(0);
}

/* Deck techs: expand downward under the name, not sideways */
.star-tech {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    max-height 0.5s ease;
  pointer-events: none;
}

.star-deck:hover .star-tech,
.star-deck:focus-within .star-tech,
.star-deck.is-active .star-tech {
  opacity: 1;
  max-height: 10rem;
  transform: translateY(0);
}

.star-tech li {
  font-family: var(--font-display);
  font-size: clamp(0.88rem, 1.4vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.35;
}

.star-deck:hover .star-sense,
.star-deck:focus-within .star-sense,
.star-deck.is-active .star-sense {
  display: none;
}

/* —— Tablet —— */
@media (max-width: 960px) {
  .stage {
    padding: clamp(0.85rem, 2.5vh, 1.5rem) clamp(1rem, 4vw, 2.5rem) clamp(0.75rem, 2vh, 1.25rem);
  }

  .brand {
    font-size: clamp(2.6rem, 10vw, 4.75rem);
  }

  .star {
    max-width: min(13rem, 46vw);
  }

  .star-name {
    font-size: clamp(0.95rem, 2.4vw, 1.25rem);
  }
}

/* —— Phone / touch —— */
@media (max-width: 720px) {
  .stage {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
  }

  .stage-head {
    height: auto;
    flex: 0 0 auto;
    padding-bottom: 1.25rem;
  }

  .brand {
    font-size: clamp(2.5rem, 16vw, 3.75rem);
    margin-bottom: 0.35rem;
  }

  .expand {
    letter-spacing: 0.02em;
  }

  .mission {
    max-width: none;
    margin-top: 0.5rem;
  }

  .cta {
    gap: 0.75rem 1rem;
    margin-top: 0.95rem;
  }

  .cta-primary {
    width: 100%;
    justify-content: center;
  }

  .constellation {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding-top: 0.5rem;
  }

  .star {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    max-width: none;
    animation: none;
  }

  .star-name {
    width: 100%;
    font-size: 1.1rem;
    padding: 0.35rem 0;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.72);
  }

  .star.is-active .star-sense,
  .star:focus-within .star-sense {
    opacity: 1;
    max-height: 6rem;
    transform: none;
  }

  .star-deck.is-active .star-tech,
  .star-deck:focus-within .star-tech {
    opacity: 1;
    max-height: 10rem;
    transform: none;
  }
}

@media (max-width: 420px) {
  .expand {
    font-size: 0.9rem;
  }
}

/* Short viewports */
@media (max-height: 760px) and (min-width: 721px) {
  .stage {
    padding-top: 0.85rem;
    padding-bottom: 0.65rem;
  }

  .brand {
    font-size: clamp(2.4rem, 7.5vh, 4.25rem);
    margin-bottom: 0.25rem;
  }

  .mission {
    margin-top: 0.4rem;
    font-size: 0.88rem;
  }

  .cta {
    margin-top: 0.7rem;
  }

  .cta-primary {
    padding: 0.65rem 1.2rem;
  }

  .star-name {
    font-size: clamp(0.95rem, 2vw, 1.25rem);
  }
}

/* —— License modal —— */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: rgba(3, 5, 13, 0.72);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(36rem, 100%);
  max-height: min(92dvh, 100%);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem 1.5rem 1.35rem;
  background: linear-gradient(165deg, #08172b 0%, #051c2c 55%, #03050d 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: rise 0.35s ease both;
}

.modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  color: var(--mira-faint);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--mira-accent);
}

.license-title {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: 0.03em;
}

.license-sub {
  margin: 0 0 1.25rem;
  font-weight: 300;
  color: var(--mira-muted);
  font-size: 0.92rem;
}

.license-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.license-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mira-faint);
}

.license-form input,
.license-form select,
.license-form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--mira-text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  padding: 0.65rem 0.75rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.license-form input:focus,
.license-form select:focus,
.license-form textarea:focus {
  border-color: rgba(89, 224, 242, 0.55);
}

.license-form textarea {
  resize: vertical;
  min-height: 4rem;
}

.license-full {
  grid-column: 1 / -1;
}

.license-submit {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 0.15rem;
  border: none;
  cursor: pointer;
}

.license-submit:disabled {
  opacity: 0.5;
  cursor: wait;
}

.license-status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: var(--mira-muted);
}

.license-status.is-ok {
  color: var(--mira-accent);
}

.license-status.is-error {
  color: #f07178;
}

@media (max-width: 560px) {
  .modal-panel {
    padding: 1.25rem 1rem 1.1rem;
  }

  .license-form {
    grid-template-columns: 1fr;
  }

  .license-submit {
    width: 100%;
    justify-self: stretch;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fog,
  .brand,
  .expand,
  .mission,
  .cta,
  .constellation,
  .star,
  .modal-panel {
    animation: none !important;
    opacity: 1;
    filter: none;
    transform: none;
    translate: none;
  }
}
