:root {
  --navy: #16324f;
  --navy-deep: #0a1624;
  --navy-mid: #1e4468;
  --copper: #c47a3a;
  --copper-lt: #e0a05a;
  --copper-btn: #8b4e20;
  --teal: #2f7a78;
  --teal-lt: #4a9e9b;
  --cream: #f4efe6;
  --ink: #1c232b;
  --white: #fffdf9;
  --font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 4.25rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body.imm-body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--cream);
  background: var(--navy-deep);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--copper-lt);
}

a:hover {
  color: var(--cream);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--cream);
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(3.2rem, 10vw, 7.5rem);
  font-weight: 600;
}

h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

h3 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.imm-skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 100;
  background: var(--copper-btn);
  color: #fff;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  border-radius: 8px;
}

.imm-skip:focus {
  top: 0.75rem;
}

#imm-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.imm-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, transparent 0%, rgba(10, 22, 36, 0.35) 55%, rgba(10, 22, 36, 0.78) 100%),
    linear-gradient(180deg, rgba(10, 22, 36, 0.55) 0%, transparent 28%, transparent 55%, rgba(10, 22, 36, 0.88) 100%);
  transition: opacity 0.6s var(--ease-out);
}

.imm-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main,
.imm-footer {
  position: relative;
  z-index: 3;
}

.imm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  height: var(--header-h);
  background: linear-gradient(180deg, rgba(10, 22, 36, 0.85) 0%, rgba(10, 22, 36, 0.55) 70%, transparent 100%);
  transition: background 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
}

.imm-header.is-scrolled {
  background-color: #0a1624;
  background-image: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(244, 239, 230, 0.08);
}

.imm-logo img {
  width: min(200px, 46vw);
  height: auto;
}

.imm-nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(244, 239, 230, 0.28);
  background: rgba(10, 22, 36, 0.45);
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.imm-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.imm-nav a {
  color: rgba(244, 239, 230, 0.88);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.imm-nav a:hover {
  color: var(--copper-lt);
}

.imm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease-out), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.imm-btn:hover {
  transform: translateY(-1px);
}

.imm-btn-lg {
  padding: 0.95rem 1.45rem;
  font-size: 1.02rem;
}

.imm-btn-copper {
  background: linear-gradient(165deg, var(--copper-lt), var(--copper) 45%, var(--copper-btn));
  color: #fff;
  box-shadow: 0 12px 40px rgba(196, 122, 58, 0.28);
}

.imm-btn-copper:hover {
  color: #fff;
  filter: brightness(1.06);
}

.imm-btn-ghost {
  background: rgba(244, 239, 230, 0.06);
  border-color: rgba(244, 239, 230, 0.28);
  color: var(--cream);
  backdrop-filter: blur(8px);
}

.imm-btn-ghost:hover {
  background: rgba(244, 239, 230, 0.12);
  color: var(--cream);
}

.imm-nav .imm-btn-copper {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

.imm-hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-content: end;
  padding: calc(var(--header-h) + 1.5rem) clamp(1.25rem, 4vw, 3.5rem) 2.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.imm-hero-copy {
  max-width: min(36rem, 100%);
}

@media (min-width: 720px) {
  .imm-hero {
    align-content: center;
    padding-bottom: 4rem;
  }
}

.imm-brand {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--copper-lt);
  margin: 0 0 0.65rem;
}

.imm-hero h1 {
  max-width: 9ch;
  font-size: clamp(2.6rem, 8vw, 6.5rem);
  margin-bottom: 0.85rem;
}

@media (max-height: 720px) {
  .imm-hero h1 {
    font-size: clamp(2.4rem, 7vh, 4.5rem);
  }
}

.imm-lede,
.imm-copy {
  max-width: 34rem;
  color: rgba(244, 239, 230, 0.78);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
}

.imm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.imm-scroll-cue {
  position: absolute;
  right: clamp(1.25rem, 4vw, 3.5rem);
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  color: rgba(244, 239, 230, 0.55);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.imm-scroll-cue:hover {
  color: var(--cream);
}

.imm-scroll-line {
  width: 1px;
  height: 3.2rem;
  background: linear-gradient(180deg, var(--copper), transparent);
  animation: imm-scroll-pulse 2.2s var(--ease-out) infinite;
  transform-origin: top;
}

@keyframes imm-scroll-pulse {
  0%,
  100% {
    transform: scaleY(0.45);
    opacity: 0.4;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.imm-chapter {
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 5rem clamp(1.25rem, 4vw, 3.5rem);
}

.imm-chapter-inner {
  max-width: 40rem;
}

.imm-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-lt);
}

.imm-chapter-craft .imm-chapter-inner,
.imm-chapter-place .imm-chapter-inner {
  background: linear-gradient(135deg, rgba(10, 22, 36, 0.55), rgba(10, 22, 36, 0.18));
  border: 1px solid rgba(244, 239, 230, 0.08);
  border-radius: 28px;
  padding: clamp(1.5rem, 3vw, 2.4rem);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.imm-work-grid {
  max-width: 1100px;
  width: 100%;
}

.imm-work-intro {
  margin-bottom: 1.75rem;
  max-width: 28rem;
}

.imm-orbit {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  perspective: 1200px;
}

@media (min-width: 640px) {
  .imm-orbit {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 980px) {
  .imm-orbit {
    grid-template-columns: repeat(3, 1fr);
  }
}

.imm-orbit-card {
  position: relative;
  padding: 1.35rem 1.25rem 1.4rem;
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(30, 68, 104, 0.45), rgba(10, 22, 36, 0.72)),
    rgba(22, 50, 79, 0.55);
  border: 1px solid rgba(244, 239, 230, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  transform-style: preserve-3d;
  transition: transform 0.45s var(--ease-out), border-color 0.3s ease, box-shadow 0.45s ease;
  will-change: transform;
}

.imm-orbit-card:hover,
.imm-orbit-card.is-tilting {
  border-color: rgba(196, 122, 58, 0.45);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(196, 122, 58, 0.12);
}

.imm-orbit-card p {
  margin: 0;
  color: rgba(244, 239, 230, 0.72);
  font-size: 0.98rem;
}

.imm-orbit-num {
  display: block;
  margin-bottom: 0.85rem;
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--copper-lt);
  letter-spacing: 0.08em;
}

.imm-work-link {
  margin-top: 1.5rem;
}

.imm-towns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.35rem 0 1.5rem;
}

.imm-towns li {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 239, 230, 0.16);
  background: rgba(244, 239, 230, 0.04);
  font-size: 0.92rem;
  color: rgba(244, 239, 230, 0.88);
}

.imm-text-link {
  font-weight: 600;
  text-decoration: none;
  color: var(--copper-lt);
  border-bottom: 1px solid rgba(196, 122, 58, 0.45);
}

.imm-text-link:hover {
  color: var(--cream);
  border-bottom-color: rgba(244, 239, 230, 0.5);
}

.imm-trust-panel {
  max-width: 36rem;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 0%, rgba(196, 122, 58, 0.22), transparent 55%),
    linear-gradient(160deg, rgba(22, 50, 79, 0.85), rgba(10, 22, 36, 0.92));
  border: 1px solid rgba(196, 122, 58, 0.28);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.imm-license-big {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  color: var(--copper-lt);
  margin: 0.35rem 0 1rem;
}

.imm-finale {
  min-height: 90svh;
  display: grid;
  align-items: center;
  padding: 5rem clamp(1.25rem, 4vw, 3.5rem) 7rem;
  text-align: left;
}

.imm-finale-inner {
  max-width: 34rem;
}

.imm-footer {
  padding: 3rem clamp(1.25rem, 4vw, 3.5rem) 6.5rem;
  border-top: 1px solid rgba(244, 239, 230, 0.08);
  background: rgba(7, 14, 22, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(244, 239, 230, 0.72);
  font-size: 0.95rem;
}

.imm-footer-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 800px) {
  .imm-footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.imm-footer strong {
  display: block;
  color: var(--cream);
  margin-bottom: 0.65rem;
}

.imm-footer a {
  color: rgba(244, 239, 230, 0.78);
  text-decoration: none;
}

.imm-footer a:hover {
  color: var(--copper-lt);
}

.imm-footer ul li + li {
  margin-top: 0.35rem;
}

.imm-license {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(244, 239, 230, 0.08);
  color: rgba(244, 239, 230, 0.88);
  font-weight: 500;
  font-size: 0.95rem;
}

.imm-mobile-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(244, 239, 230, 0.12);
  border-top: 1px solid rgba(244, 239, 230, 0.12);
  padding-bottom: env(safe-area-inset-bottom);
}

.imm-mobile-cta a {
  display: grid;
  place-items: center;
  min-height: 3.15rem;
  background: rgba(10, 22, 36, 0.94);
  color: var(--cream);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.imm-mobile-cta a:first-child {
  color: var(--copper-lt);
}

/* Reveal animation */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 0.9s var(--ease-out);
  transition-delay: calc(var(--reveal-delay, 0) * 1ms);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.imm-hero [data-reveal] {
  animation: imm-hero-in 1s var(--ease-out) both;
  animation-delay: calc(120ms + var(--reveal-i, 0) * 90ms);
}

.imm-hero .imm-brand {
  --reveal-i: 0;
}

.imm-hero h1 {
  --reveal-i: 1;
}

.imm-hero .imm-lede {
  --reveal-i: 2;
}

.imm-hero .imm-actions {
  --reveal-i: 3;
}

.imm-hero .imm-scroll-cue {
  --reveal-i: 4;
}

@keyframes imm-hero-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.imm-orbit-card[data-reveal] {
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #imm-canvas,
  .imm-grain,
  .imm-scroll-line {
    display: none !important;
  }

  .imm-veil {
    background: radial-gradient(ellipse at 60% 30%, #1e4468, var(--navy-deep) 70%);
    opacity: 1;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .imm-hero [data-reveal] {
    animation: none;
  }

  .imm-orbit-card {
    transform: none !important;
  }

  .imm-btn,
  .imm-header {
    transition: none;
  }
}

/* Phones */
@media (max-width: 820px) {
  .imm-nav-toggle {
    display: inline-flex;
  }

  .imm-hero-copy,
  .imm-finale-inner {
    position: relative;
    z-index: 2;
    max-width: none;
    padding: 1.35rem 1.1rem 1.6rem;
    margin: 0 -1.1rem;
    border: 0;
    border-radius: 0;
    /* Soft dark wash behind the title block only. Animation stays visible around it. */
    background: radial-gradient(
      ellipse 120% 100% at 32% 38%,
      rgba(10, 22, 36, 0.97) 0%,
      rgba(10, 22, 36, 0.88) 38%,
      rgba(10, 22, 36, 0.5) 62%,
      rgba(10, 22, 36, 0) 80%
    );
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .imm-hero h1,
  .imm-finale h2 {
    max-width: none;
    color: #fffdf9;
    text-shadow: 0 1px 2px rgba(10, 22, 36, 0.75);
  }

  .imm-lede,
  .imm-finale .imm-copy {
    color: rgba(244, 239, 230, 0.98);
    text-shadow: 0 1px 2px rgba(10, 22, 36, 0.7);
  }

  .imm-brand {
    color: #e0a05a;
  }

  .imm-nav {
    position: fixed;
    top: var(--header-h);
    left: 1rem;
    right: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.85rem;
    border-radius: 18px;
    background: rgba(10, 22, 36, 0.96);
    border: 1px solid rgba(244, 239, 230, 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
  }

  .imm-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .imm-nav a {
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
  }

  .imm-nav a:hover {
    background: rgba(244, 239, 230, 0.06);
  }

  .imm-nav .imm-btn-copper {
    justify-content: center;
    margin-top: 0.35rem;
  }

  .imm-scroll-cue {
    display: none;
  }

  .imm-mobile-cta {
    display: grid;
  }

  .imm-hero {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    align-content: end;
  }

  .imm-actions {
    margin-bottom: 0.5rem;
  }

  .imm-footer {
    padding-bottom: 7.5rem;
  }

  h1,
  .imm-hero h1 {
    font-size: clamp(2.6rem, 12vw, 3.8rem);
  }
}

@media (max-width: 480px) {
  .imm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .imm-btn-lg {
    width: 100%;
  }
}

/* Stage-driven veil shifts via body class from JS */
body.stage-0 .imm-veil {
  opacity: 1;
}

body.stage-1 .imm-veil,
body.stage-2 .imm-veil {
  opacity: 0.92;
}

body.stage-3 .imm-veil {
  opacity: 0.85;
}

body.stage-4 .imm-veil,
body.stage-5 .imm-veil {
  opacity: 0.95;
}

body.no-webgl .imm-veil {
  background:
    radial-gradient(ellipse 70% 50% at 65% 35%, rgba(47, 122, 120, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 30% 70%, rgba(196, 122, 58, 0.18), transparent 50%),
    linear-gradient(160deg, #16324f, #0a1624 70%);
}
