/* =============================================
   HIMELHOCH PORTFOLIO — STYLE
   Faithfully matching andagain.uk reference
   ============================================= */

/* ---------- Integral CF Font ---------- */
@font-face {
  font-family: "Integral CF";
  src: url("https://db.onlinewebfonts.com/t/8d07476eb4c99c30e857758062f352ab.woff2") format("woff2"),
    url("https://db.onlinewebfonts.com/t/8d07476eb4c99c30e857758062f352ab.woff") format("woff"),
    url("https://db.onlinewebfonts.com/t/8d07476eb4c99c30e857758062f352ab.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Custom Properties ---------- */
:root {
  --bg: #000000;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.08);
  --font-display: "Integral CF", "Helvetica Neue", Arial, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-smooth: cubic-bezier(0.45, 0, 0.15, 1);
  --ease-merge: cubic-bezier(0.76, 0, 0.24, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

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

ul {
  list-style: none;
}

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

/* ---------- Custom Cursor ---------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--text);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out-expo), height 0.3s var(--ease-out-expo), background 0.3s;
  mix-blend-mode: difference;
}

.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--ease-out-expo), height 0.4s var(--ease-out-expo), border-color 0.3s;
}

body.cursor-hover .cursor {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.08);
}

body.cursor-hover .cursor-follower {
  width: 56px;
  height: 56px;
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===================================
   TOP BAR (persistent sticky nav)
   =================================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 24px clamp(24px, 4vw, 60px);
  z-index: 1000;
  pointer-events: none;
}

.top-bar>* {
  pointer-events: auto;
}

.top-bar-left {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.top-bar.scrolled .top-bar-left {
  opacity: 1;
  transform: translateY(0);
}

.top-bar-center {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  transition: color 0.3s;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.top-bar.scrolled .top-bar-center {
  opacity: 1;
  transform: translateY(0);
}

.top-bar-center:hover {
  color: var(--text);
}

.top-bar-right {
  text-align: right;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.top-bar.scrolled .top-bar-right {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================
   CENTER VERTICAL LINE
   =================================== */
.center-line {
  position: fixed;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100vh;
  background: var(--border);
  z-index: 999;
  transform: translateX(-50%);
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--bg);
}

.hero,
.mission,
.capabilities,
.contact {
  scroll-snap-align: start;
}

.hero-word-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}

/* ---------- Hero Word ---------- */
.hero-word {
  display: inline-flex;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 14vw, 18rem);
  font-weight: 800;
  line-height: 0.85;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  position: relative;
  white-space: nowrap;
}

/* Hero line wrappers — transparent on desktop */
.hero-line {
  display: inline-flex;
}

/* Individual letter */
.letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  will-change: transform, opacity;
}

/* Phase 1: Letters rise up (on LOAD, not scroll) */
.hero-word.animate .letter {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
}

/* The vanishing "m" — give it MORE width so it looks like a real M */
.letter-vanish {
  max-width: 1.8em;
  overflow: hidden;
  display: inline-block;
  vertical-align: top;
  line-height: inherit;
  height: 1em;
}

.hero-word.animate .letter-vanish {
  opacity: 1;
  transform: translateY(0);
}

/* Phase 2: Merge */
.hero-word.merge .letter-vanish {
  opacity: 0;
  max-width: 0;
  transition: opacity 0.6s var(--ease-merge),
    max-width 1.1s var(--ease-merge) 0.05s;
}

.hero-word:not(.animate) .letter-incoming {
  transform: translateY(110%) translateX(0.4em);
}

.hero-word.animate .letter-incoming {
  opacity: 1;
  transform: translateY(0) translateX(0.4em);
  transition: opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
}

.hero-word.merge .letter-incoming {
  transform: translateY(0) translateX(0);
  transition: transform 1.1s var(--ease-merge);
}

.hero-word.complete {
  text-shadow: 0 0 200px rgba(255, 255, 255, 0.02);
}

/* ---------- Hero Bottom Bar ---------- */
.hero-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  padding: clamp(20px, 3vw, 40px) clamp(24px, 4vw, 60px);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out-expo) 1.6s,
    transform 0.8s var(--ease-out-expo) 1.6s;
}

.hero.loaded .hero-bottom {
  opacity: 1;
  transform: translateY(0);
}

.hero-meta {
  font-family: var(--font-body);
  font-size: clamp(0.7rem, 0.85vw, 0.85rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hero-contact-link {
  text-align: center;
  transition: color 0.3s;
}

.hero-contact-link:hover {
  color: var(--text);
}

.hero-time-meta {
  text-align: right;
}

/* ===================================
   HERO MARQUEE
   =================================== */
.mobile-marquee {
  display: none;
}

.hero-marquee {
  width: 100vw;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 2.5rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  user-select: none;
  padding: 0.3em 0;
}

.marquee-inner {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

.hero-marquee-top .marquee-inner {
  animation: marqueeLeft 25s linear infinite;
}

.hero-marquee-bottom .marquee-inner {
  animation: marqueeRight 30s linear infinite;
}

@keyframes marqueeLeft {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

@keyframes marqueeRight {
  0% {
    transform: translateX(-50%);
  }

  100% {
    transform: translateX(0);
  }
}

/* ===================================
   SCROLL REVEAL
   =================================== */
.reveal-up {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
}

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

/* ===================================
   MISSION SECTION
   =================================== */
.mission {
  padding: clamp(80px, 12vw, 200px) 0;
  background: var(--bg);
}

.mission-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 60px);
  max-width: 100%;
  padding: 0 clamp(24px, 4vw, 60px);
}

.mission-left {
  /* empty — pushes text right */
}

.mission-text {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 3.5vw, 3rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Portfolio section — natural scroll with soft snap */
.portfolio {
  position: relative;
  scroll-behavior: smooth;
}

.portfolio-container {
  /* Slides stack naturally in normal flow */
}

.portfolio-slide {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Background — dark fill behind the card */
.portfolio-bg {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
}

/* Foreground card: smaller, rounded, centered */
.portfolio-card {
  position: relative;
  width: 80%;
  max-width: 1100px;
  aspect-ratio: 16 / 10;
  border-radius: clamp(16px, 2.5vw, 28px);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  z-index: 2;
  transition: transform 0.6s var(--ease-out-expo);
}

.portfolio-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Fixed counter at bottom */
.portfolio-counter {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out-expo);
  pointer-events: none;
}

.portfolio-counter.visible {
  opacity: 1;
}

.counter-current {
  color: var(--text);
  font-weight: 500;
}

/* ===================================
   FLIGHT PROGRESS SIDEBAR
   =================================== */
.flight-progress {
  position: fixed;
  right: clamp(18px, 3vw, 48px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out-expo);
  pointer-events: none;
}

.flight-progress.visible {
  opacity: 1;
}

.flight-cities {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 200px;
  align-items: flex-end;
}

.flight-city {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: color 0.4s, transform 0.4s var(--ease-out-expo);
}

.flight-city.active {
  color: var(--text);
  transform: scale(1.15);
}

.flight-track {
  position: relative;
  width: 2px;
  height: 200px;
}

.flight-track-line {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}

.flight-plane {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%) rotate(90deg);
  font-size: 1rem;
  transition: top 0.6s var(--ease-out-expo);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

/* ===================================
   CAPABILITIES
   =================================== */
.capabilities {
  padding: clamp(80px, 12vw, 200px) 0;
  background: var(--bg);
}

.capabilities-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 100px);
  padding: 0 clamp(24px, 4vw, 60px);
}

.capabilities-label {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: clamp(24px, 4vw, 48px);
  line-height: 1.4;
}

.capabilities-list li {
  font-family: var(--font-body);
  font-size: clamp(1.4rem, 3vw, 2.8rem);
  font-weight: 500;
  line-height: 1.35;
  padding: 2px 0;
  transition: color 0.3s;
  cursor: none;
}

.capabilities-list li:hover {
  color: var(--text-muted);
}

.capabilities-right {
  padding-top: 0;
}

.capabilities-desc {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.2vw, 1.1rem);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: clamp(32px, 4vw, 60px);
}

.clients-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 3vw, 40px);
}

.clients-col li {
  font-family: var(--font-body);
  font-size: clamp(1.4rem, 3vw, 2.8rem);
  font-weight: 500;
  line-height: 1.35;
  padding: 2px 0;
}

/* ===================================
   CONTACT SECTION (split layout)
   =================================== */
.contact {
  padding: clamp(80px, 12vw, 200px) 0 clamp(60px, 8vw, 120px);
  background: var(--bg);
}

.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 60px);
  padding: 0 clamp(24px, 4vw, 60px);
}

.contact-left {
  /* empty left column */
}

.contact-heading {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 3.5vw, 3rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: clamp(40px, 6vw, 80px);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 60px);
  margin-bottom: clamp(40px, 6vw, 80px);
}

.contact-grid-lower {
  margin-bottom: 0;
}

.contact-block-title {
  font-family: var(--font-body);
  font-size: clamp(0.75rem, 0.9vw, 0.9rem);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}

.contact-link {
  display: block;
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  font-weight: 400;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color 0.3s, transform 0.3s var(--ease-out-expo);
}

.contact-link:hover {
  color: var(--text);
  transform: translateX(4px);
}

.contact-detail {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  font-weight: 400;
  color: var(--text-muted);
}

.social-links {
  display: flex;
  flex-direction: column;
}

/* ===================================
   FOOTER (split layout)
   =================================== */
.site-footer {
  padding: clamp(60px, 10vw, 120px) 0 clamp(24px, 3vw, 40px);
  background: var(--bg);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 60px);
  padding: 0 clamp(24px, 4vw, 60px);
  align-items: end;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.footer-brand sup {
  font-size: 0.35em;
  vertical-align: super;
}

.footer-legal {
  font-size: clamp(0.65rem, 0.8vw, 0.75rem);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* ---------- Grain Overlay ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  opacity: 0.3;
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

/* ===================================
   CHROMATIC ABERRATION TRANSITION
   =================================== */
.tv-static {
  display: none;
}

.portfolio-card-img.chromatic {
  animation: chromaticFlash 0.3s ease-out;
}

@keyframes chromaticFlash {
  0% {
    filter: none;
    transform: scale(1);
  }

  20% {
    filter:
      drop-shadow(-5px 0 0 rgba(255, 0, 50, 0.5)) drop-shadow(5px 0 0 rgba(0, 200, 255, 0.5));
    transform: scale(1.02);
  }

  50% {
    filter:
      drop-shadow(-3px 0 0 rgba(255, 0, 50, 0.3)) drop-shadow(3px 0 0 rgba(0, 200, 255, 0.3));
    transform: scale(1.01);
  }

  100% {
    filter: none;
    transform: scale(1);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .center-line {
    display: none;
  }

  .mission-inner,
  .capabilities-inner,
  .contact-inner,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .mission-left,
  .contact-left {
    display: none;
  }

  .clients-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .cursor,
  .cursor-follower {
    display: none;
  }

  body {
    cursor: auto;
  }

  a {
    cursor: pointer;
  }

  .hero-bottom {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
  }

  .hero-contact-link {
    text-align: center;
  }

  .hero-time-meta {
    text-align: center;
  }

  /* --- Mobile Marquees: Bending SVG --- */
  .desktop-marquee {
    display: none;
  }

  .mobile-marquee {
    display: block;
  }

  .hero-word-wrapper {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    z-index: 20;
  }

  .hero-marquee-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
  }

  .hero-marquee-svg text {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.08em;
    fill: rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
  }

  .top-bar {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .top-bar-center,
  .top-bar-right {
    display: none;
  }

  .portfolio-card {
    width: 88%;
    aspect-ratio: 3 / 4;
  }

  .flight-progress {
    position: fixed;
    right: auto;
    left: 50%;
    top: auto;
    bottom: 52px;
    transform: translateX(-50%);
    flex-direction: column;
    gap: 8px;
  }

  .flight-cities {
    flex-direction: row;
    height: auto;
    width: 200px;
    justify-content: space-between;
    align-items: center;
  }

  .flight-track {
    width: 200px;
    height: 2px;
  }

  .flight-plane {
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%) rotate(0deg);
    transition: left 0.6s var(--ease-out-expo);
  }

  .tv-static.flash~.flight-progress .flight-plane,
  .flight-progress .flight-plane {
    /* JS sets left% instead of top% on mobile */
  }

  /* --- Mobile Hero: Stacked Two-Line Layout --- */
  .hero-word {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: normal;
    font-size: clamp(3rem, 20vw, 10rem);
    text-align: center;
    width: 70%;
    margin: 0 auto;
  }

  .hero-line {
    display: flex;
    justify-content: center;
  }

  .hero-line-bottom {
    margin-top: 2em;
    transition: margin-top 1.1s var(--ease-merge);
  }

  .hero-word.merge .hero-line-bottom {
    margin-top: -0.05em;
  }

  /* On mobile, incoming letters rise straight up — no horizontal offset */
  .hero-word:not(.animate) .letter-incoming {
    transform: translateY(110%);
  }

  .hero-word.animate .letter-incoming {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s var(--ease-out-expo),
      transform 0.8s var(--ease-out-expo);
  }

  .hero-word.merge .letter-incoming {
    transform: translateY(0);
    transition: transform 1.1s var(--ease-merge);
  }
}

@keyframes marqueeUp {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-50%);
  }
}

@keyframes marqueeDown {
  0% {
    transform: translateY(-50%);
  }

  100% {
    transform: translateY(0);
  }
}