/* ==========================================================================
   PORTAL — "Featured Works" style module showcase
   A horizontal, drag-to-scroll belt of oversized cards. Each card: pastel
   gradient panel, giant ghost word, portal screenshot in a mini browser
   frame anchored bottom-right, and a blue title + one-liner underneath.
   portal.js wires the drag, arrows and the cursor-follow badge.
   ========================================================================== */

.mia-portal {
  position: relative;
  padding: clamp(64px, 8vw, 120px) 0 clamp(56px, 7vw, 104px);
  /* starts on the vessels section's #f4f8fc and melts into white — no seam */
  background: linear-gradient(180deg, #f4f8fc 0%, #ffffff 32%, #ffffff 100%);
  overflow: hidden;
}

/* layered parallax background — deep light pools, the world map, and a near
   haze, each drifting at its own speed (portal.js). The top/bottom fade mask
   sits on the wrapper so the melt into neighbouring sections never moves
   while the layers inside translate. */
.mia-portal__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 80%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 80%, transparent 100%);
}

/* every plane bleeds 16% past the section so the drift never uncovers an edge
   (portal.js caps the travel at 15% of the section height) */
.mia-portal__bg > * {
  position: absolute;
  inset: -16% -3%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* farthest plane — soft ambient light pools sunk behind the map */
.mia-portal__bg-glow {
  background:
    radial-gradient(46% 38% at 20% 30%, rgba(125, 184, 232, 0.22), transparent 70%),
    radial-gradient(52% 44% at 82% 62%, rgba(74, 144, 194, 0.16), transparent 72%),
    radial-gradient(38% 32% at 55% 12%, rgba(155, 203, 229, 0.18), transparent 70%);
}

/* mid plane — the faint world map */
.mia-portal__bg-map {
  background: url("../all-images/world-map.webp") center 44% / min(1500px, 115%) auto no-repeat;
  opacity: 0.34;
}

/* nearest plane — a cool haze skimming over the map, fastest of the three */
.mia-portal__bg-haze {
  background:
    radial-gradient(60% 42% at 30% 78%, rgba(255, 255, 255, 0.6), transparent 68%),
    radial-gradient(44% 36% at 76% 22%, rgba(221, 236, 246, 0.55), transparent 70%);
  opacity: 0.6;
}

/* keep the heading and card belt above the map layer */
.mia-portal__head,
.mia-portal__viewport {
  position: relative;
  z-index: 1;
}

/* ---------------- heading row ---------------- */

.mia-portal__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto clamp(28px, 3.5vw, 48px);
  padding: 0 clamp(16px, 4vw, 56px);
}

/* two-tone headline — deep navy base, accented words in the brand blue */
.mia-portal__title {
  margin: 0 0 14px;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-weight: 700;
  font-size: clamp(36px, 4.8vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: #16324f;
}

.mia-portal__title-accent {
  font-style: normal;
  font-weight: 700;
  color: #4a97d8;
}

/* line — anchor — line rule under the heading (flush left — this header
   is the one left-aligned section head) */
.mia-portal__title::after {
  content: '';
  display: block;
  width: 190px;
  height: 16px;
  margin: 18px 0 0;
  background-color: #4a97d8;
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='3'/%3E%3Cline x1='12' y1='22' x2='12' y2='8'/%3E%3Cpath d='M5 12H2a10 10 0 0 0 20 0h-3'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
    linear-gradient(#000, #000) left center / 70px 1.5px no-repeat,
    linear-gradient(#000, #000) right center / 70px 1.5px no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='3'/%3E%3Cline x1='12' y1='22' x2='12' y2='8'/%3E%3Cpath d='M5 12H2a10 10 0 0 0 20 0h-3'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
    linear-gradient(#000, #000) left center / 70px 1.5px no-repeat,
    linear-gradient(#000, #000) right center / 70px 1.5px no-repeat;
}

.mia-portal__sub {
  margin: 0;
  max-width: 560px;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.6;
  letter-spacing: 0.005em;
  color: #45607a;
}

.mia-portal__nav {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

/* ---------------- heading scroll reveal ---------------- */
/* title rises first, then the subtitle, then the arrows drift in */

.mia-portal__head .mia-portal__title,
.mia-portal__head .mia-portal__sub,
.mia-portal__head .mia-portal__nav {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s ease,
    transform 0.75s cubic-bezier(0.22, 0.8, 0.3, 1);
  will-change: opacity, transform;
}

.mia-portal__head.is-in .mia-portal__title,
.mia-portal__head.is-in .mia-portal__sub,
.mia-portal__head.is-in .mia-portal__nav {
  opacity: 1;
  transform: none;
}

.mia-portal__head.is-in .mia-portal__sub { transition-delay: 0.15s; }
.mia-portal__head.is-in .mia-portal__nav { transition-delay: 0.3s; }

/* apple-style liquid glass buttons with a springy bounce */
.mia-portal__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(34, 54, 74, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  box-shadow:
    0 10px 26px rgba(9, 40, 72, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -6px 12px rgba(255, 255, 255, 0.3);
  color: #22364a;
  cursor: pointer;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.mia-portal__arrow svg { width: 20px; height: 20px; }

.mia-portal__arrow:hover {
  background: rgba(255, 255, 255, 0.65);
  transform: scale(1.12);
  box-shadow:
    0 14px 32px rgba(9, 40, 72, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -6px 12px rgba(255, 255, 255, 0.35);
}

.mia-portal__arrow:active {
  transform: scale(0.9);
  transition-duration: 0.15s;
}

/* one-time attention bounce when the section scrolls into view */
@keyframes mia-arrow-bounce {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.22); }
  55%      { transform: scale(0.92); }
  78%      { transform: scale(1.08); }
}

.mia-portal__nav.is-cue .mia-portal__arrow--prev { animation: mia-arrow-bounce 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s; }
.mia-portal__nav.is-cue .mia-portal__arrow--next { animation: mia-arrow-bounce 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s; }

/* ---------------- track ---------------- */

.mia-portal__viewport { position: relative; }

.mia-portal__track {
  --edge: max(clamp(16px, 4vw, 56px), calc((100vw - 1280px) / 2));

  display: flex;
  gap: clamp(20px, 3vw, 36px);
  overflow-x: auto;
  padding: 8px var(--edge) 12px;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--edge);
  scrollbar-width: none;               /* hidden scrollbar — arrows page through */
  outline: none;
}

.mia-portal__track::-webkit-scrollbar { display: none; }

.mia-portal__track:focus-visible {
  outline: 2px solid #4a90c2;
  outline-offset: -2px;
  border-radius: 12px;
}

/* ---------------- item = card + caption ---------------- */

.mia-portal__item {
  flex: 0 0 auto;
  width: clamp(560px, 62vw, 900px);
  scroll-snap-align: start;
  opacity: 0;
  /* scale-only reveal — the track clips vertically (overflow-x: auto), so any
     translateY here would cut the card's edge mid-animation */
  transform: scale(0.96);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 0.8, 0.3, 1);
  will-change: opacity, transform;
}

.mia-portal__item.is-in { opacity: 1; transform: none; }

.mia-portal__item:nth-child(2) { transition-delay: 0.12s; }
.mia-portal__item:nth-child(3) { transition-delay: 0.24s; }

/* caption fades in just after its card lands — no translate, so the track
   never clips it at the bottom mid-animation */
.mia-portal__item .mia-portal__caption {
  opacity: 0;
  transition: opacity 0.7s ease 0.25s;
}

.mia-portal__item.is-in .mia-portal__caption { opacity: 1; }

/* ---------------- card art panel ---------------- */

.mia-portal__card {
  --ghost-c: rgba(255, 255, 255, 0.55);
  --chip-bg: rgba(255, 255, 255, 0.45);
  --chip-c: #22364a;

  position: relative;
  height: clamp(330px, 38vw, 530px);
  border-radius: clamp(18px, 2vw, 28px);
  overflow: hidden;
  isolation: isolate;
}

/* lake-blue depth scale: #184E6C → #387EA2 → #5BA3C6 → #9BCBE5 → #DDECF6 */
.mia-portal__card--inspection {
  background: linear-gradient(150deg, #184e6c 0%, #246285 100%);      /* deep lake */
  --ghost-c: rgba(255, 255, 255, 0.1);
  --chip-bg: rgba(255, 255, 255, 0.16);
  --chip-c: #eaf3fb;
}

.mia-portal__card--maintenance {
  background: linear-gradient(150deg, #387ea2 0%, #4a90b5 100%);      /* mid-water blue */
  --ghost-c: rgba(255, 255, 255, 0.14);
  --chip-bg: rgba(255, 255, 255, 0.2);
  --chip-c: #f2f9fe;
}

.mia-portal__card--schedule    { background: linear-gradient(150deg, #5ba3c6 0%, #77b5d3 100%); }  /* clear shallows */
.mia-portal__card--compliance  { background: linear-gradient(150deg, #9bcbe5 0%, #b5daee 100%); }  /* sky on water */
.mia-portal__card--logbook     { background: linear-gradient(150deg, #ddecf6 0%, #ecf5fb 100%); }  /* morning mist */

/* chips */
.mia-portal__chip {
  position: absolute;
  top: clamp(14px, 1.8vw, 24px);
  z-index: 3;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.28) 0%,
    var(--chip-bg) 60%
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--chip-c);
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 500;
  letter-spacing: 0.06em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    0 8px 22px -8px rgba(9, 40, 72, 0.4);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
}

.mia-portal__chip--year { left: clamp(14px, 1.8vw, 24px); }
.mia-portal__chip--idx  { right: clamp(14px, 1.8vw, 24px); }

/* giant ghost word behind the screenshot */
.mia-portal__ghost {
  position: absolute;
  left: 3%;
  bottom: -1%;
  z-index: 1;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(64px, 9.5vw, 150px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ghost-c);
  pointer-events: none;
}

/* screenshot in a mini browser frame, cropped by the card's bottom-right */
.mia-portal__shot {
  position: absolute;
  right: -2%;
  bottom: -4%;
  z-index: 2;
  width: 88%;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 34px 64px -22px rgba(9, 40, 72, 0.5), 0 12px 28px rgba(9, 40, 72, 0.16);
  transition: transform 0.5s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.mia-portal__card:hover .mia-portal__shot { transform: translateY(-10px); }

/* apple-style frosted glass title bar — the card gradient glows through it */
.mia-portal__shot-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(14px) saturate(1.8);
  -webkit-backdrop-filter: blur(14px) saturate(1.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

/* mac traffic lights */
.mia-portal__shot-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.15);
}

.mia-portal__shot-bar i:nth-child(1) { background: #ff5f57; }
.mia-portal__shot-bar i:nth-child(2) { background: #febc2e; }
.mia-portal__shot-bar i:nth-child(3) { background: #28c840; }

.mia-portal__shot img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  pointer-events: none;
}

/* ---------------- caption under the card ---------------- */

.mia-portal__caption {
  padding: clamp(14px, 1.8vw, 22px) 6px 0;
}

.mia-portal__name {
  margin: 0 0 6px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(18px, 1.8vw, 24px);
  color: #1f6fb5;
}

.mia-portal__desc {
  margin: 0;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(13px, 1.15vw, 16px);
  line-height: 1.55;
  color: #6b7f92;
}

/* ---------------- dark theme ---------------- */

[data-theme="dark"] .mia-portal {
  background: linear-gradient(180deg, #04101d 0%, #0d1726 32%, #0d1726 100%);
}
[data-theme="dark"] .mia-portal__bg-map {
  opacity: 0.1;
  filter: saturate(1.3) brightness(1.5);
}
[data-theme="dark"] .mia-portal__bg-glow {
  background:
    radial-gradient(46% 38% at 20% 30%, rgba(74, 144, 194, 0.14), transparent 70%),
    radial-gradient(52% 44% at 82% 62%, rgba(43, 95, 143, 0.18), transparent 72%),
    radial-gradient(38% 32% at 55% 12%, rgba(125, 184, 232, 0.08), transparent 70%);
}
[data-theme="dark"] .mia-portal__bg-haze {
  opacity: 0.45;
  background:
    radial-gradient(60% 42% at 30% 78%, rgba(16, 38, 60, 0.6), transparent 68%),
    radial-gradient(44% 36% at 76% 22%, rgba(9, 24, 40, 0.55), transparent 70%);
}
[data-theme="dark"] .mia-portal__title { color: #e8f1f9; }
[data-theme="dark"] .mia-portal__title-accent { color: #7db8e8; }
[data-theme="dark"] .mia-portal__title::after { background-color: #6fb1de; }
[data-theme="dark"] .mia-portal__sub { color: #9db4c8; }
[data-theme="dark"] .mia-portal__arrow {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #d7e7f4;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .mia-portal__arrow:hover {
  background: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .mia-portal__name { color: #7db8e8; }
[data-theme="dark"] .mia-portal__desc { color: #8aa2b5; }

/* ---------------- small screens ---------------- */

@media (max-width: 720px) {
  .mia-portal__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .mia-portal__item { width: 86vw; }
  .mia-portal__card { height: 60vw; }
  .mia-portal__shot { width: 94%; right: -4%; }
  .mia-portal__ghost { font-size: clamp(44px, 13vw, 72px); }
}

@media (prefers-reduced-motion: reduce) {
  .mia-portal__item,
  .mia-portal__item .mia-portal__caption,
  .mia-portal__head .mia-portal__title,
  .mia-portal__head .mia-portal__sub,
  .mia-portal__head .mia-portal__nav {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .mia-portal__shot { transition: none; }
  /* portal.js also skips the parallax loop under reduced motion — this just
     pins the planes for any transform a frame already applied */
  .mia-portal__bg > * { transform: none !important; }
}

/* =====================================================================
   SECTION CTAs — Sign up + Book a demo. Same pill UI as the Portal CTA's
   "Sign Up" / "Login" (bright blue gradient + outlined blue ghost).
   ===================================================================== */
.mia-portal__actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: clamp(30px, 4.5vh, 52px);
  max-width: 1280px; margin-left: auto; margin-right: auto;
  padding: 0 clamp(16px, 4vw, 56px);
}
.mia-portal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  padding: 15px 34px;
  border-radius: 999px;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-weight: 500;
  font-size: clamp(15px, 1.3vw, 17px);
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease,
    background 0.3s ease,
    color 0.3s ease;
  will-change: transform;
}
.mia-portal__btn--signup {
  color: #ffffff;
  background: linear-gradient(180deg, #2f7ff2 0%, #0a63e6 100%);
  box-shadow:
    0 12px 28px -8px rgba(10, 99, 230, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.mia-portal__btn--signup:hover {
  transform: translateY(-2px) scale(1.04);
  background: linear-gradient(180deg, #4a90f5 0%, #1a70ec 100%);
  box-shadow:
    0 18px 38px -10px rgba(10, 99, 230, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.mia-portal__btn--demo {
  color: #0a63e6;
  border: 1.5px solid rgba(10, 99, 230, 0.45);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mia-portal__btn--demo:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #0a63e6;
  background: rgba(10, 99, 230, 0.07);
  box-shadow: 0 12px 28px -12px rgba(10, 99, 230, 0.35);
}
.mia-portal__btn:active { transform: scale(0.97); }
.mia-portal__btn:focus-visible { outline: 3px solid rgba(10, 99, 230, 0.4); outline-offset: 3px; }

/* phone: both pills centered, equal width */
@media (max-width: 720px) {
  .mia-portal__actions { justify-content: center; gap: 10px; }
  .mia-portal__btn { flex: 1 1 0; min-width: 0; max-width: 220px; padding: 13px 18px; }
}
