:root {
  --bg-primary: #f6f2ea;
  --bg-secondary: #e6ddd0;
  --ink: #182028;
  --ink-soft: #4f5a67;
  --accent: #e06032;
  --accent-2: #248a66;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --bar: rgba(20, 29, 34, 0.88);
  --ring: rgba(224, 96, 50, 0.42);
  --shadow: 0 14px 32px rgba(9, 18, 24, 0.24);
  --character-left: 24px;
  --character-width: min(32vw, 220px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(224, 96, 50, 0.24), transparent 36%),
    radial-gradient(circle at 83% 74%, rgba(36, 138, 102, 0.24), transparent 33%),
    linear-gradient(145deg, var(--bg-primary), var(--bg-secondary));
}

.gallery-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(17, 25, 35, 0.28);
  backdrop-filter: blur(4px);
  transition: opacity 320ms ease, visibility 320ms ease;
}

.gallery-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #f6f2ea;
  animation: spin 0.9s linear infinite;
}

.gallery-loader p {
  position: absolute;
  bottom: calc(50% - 110px);
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.atmosphere {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(120deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 42%),
    url("assets/backgrounds/bg.webp");
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  opacity: 0.6;
  filter: saturate(1.1) contrast(1.02);
  transform: scale(1.03);
}

.stage {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  padding: 28px 24px 0;
  gap: 20px;
  isolation: isolate;
}

.media-layer {
  position: absolute;
  inset: 18px 16px 120px calc(var(--character-left) + var(--character-width) + 420px);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 10px 30px rgba(17, 31, 39, 0.2);
  backdrop-filter: blur(4px);
}

.media-grid,
.video-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 340ms ease;
}

.contact-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  opacity: 0;
  pointer-events: none;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
  transition: opacity 280ms ease;
}

.contact-panel.active {
  opacity: 1;
  pointer-events: auto;
}

.contact-panel h2 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.contact-panel p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.contact-panel a {
  color: #143a6f;
  font-weight: 700;
  text-decoration: none;
}

.contact-panel a:hover,
.contact-panel a:focus-visible {
  text-decoration: underline;
}

.media-grid.active,
.video-grid.active {
  opacity: 1;
  pointer-events: auto;
}

.media-grid {
  padding: clamp(10px, 2vw, 20px);
  display: grid;
  gap: clamp(8px, 1.4vw, 16px);
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  align-content: start;
  justify-content: end;
  justify-items: end;
  overflow: auto;
}

.media-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  min-height: 110px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 255, 255, 0.65);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  animation: revealTile 480ms ease forwards;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 260ms ease;
}

.media-item:hover img,
.media-item:focus-visible img {
  transform: scale(1.08);
}

.media-item::after {
  content: "Open";
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(24, 32, 40, 0.7);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.video-card {
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.65);
  display: flex;
  flex-direction: column;
}

.video-card iframe {
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 0;
  background: #111;
}

.video-card p {
  margin: 0;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
}

.character-wrap {
  position: fixed;
  z-index: 4;
  left: var(--character-left);
  bottom: 0;
  width: var(--character-width);
}

.character {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.28));
  transform-origin: bottom center;
  animation: floatIn 780ms ease;
}

.tool-badges {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tool-badge {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(17, 25, 31, 0.15);
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
  animation: floatBadge 3.4s ease-in-out infinite alternate;
}

.tool-badge img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

.badge-photoshop { left: 2%; top: 66%; animation-delay: 0s; }
.badge-canva { left: 34%; top: 46%; animation-delay: 0.4s; }
.badge-premiere { left: 62%; top: 56%; animation-delay: 0.8s; }
.badge-after-effects { left: 11%; top: 53%; animation-delay: 1.2s; }
.badge-gemini { left: 30%; top: 65%; animation-delay: 1.6s; }
.badge-character-animator { left: 52%; top: 74%; animation-delay: 2s; }

.bubble-wrap {
  position: fixed;
  left: 230px;
  top: 24px;
  bottom: auto;
  z-index: 5;
  width: min(420px, calc(100vw - (var(--character-left) + 48px)));
}

.bubble {
  position: relative;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.4vw, 26px);
  backdrop-filter: blur(3px);
  animation: bubbleIn 460ms ease;
}

.bubble::before {
  content: "";
  position: absolute;
  left: -14px;
  bottom: 26px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  transform: rotate(45deg);
  background: var(--panel-strong);
  border-left: 1px solid rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
}

.bubble h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  letter-spacing: 0.01em;
}

.bubble p {
  margin: 10px 0 0;
  line-height: 1.6;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bar);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-btn {
  justify-self: center;
  min-width: 126px;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: #f5eee4;
  color: #1a2834;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 120ms ease, background-color 150ms ease;
}

#nextBtn {
  justify-self: center;
  justify-content: flex-end;
  text-align: right;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  transform: translateY(-1px);
  background: #ffffff;
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.nav-btn img {
  width: 18px;
  height: 18px;
}

.step-indicator {
  justify-self: center;
  color: #f3e8d8;
  font-weight: 700;
  letter-spacing: 0.07em;
  font-size: 0.86rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(6, 12, 15, 0.88);
}

.lightbox.open {
  display: grid;
}

.lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 84vh;
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

@keyframes bubbleIn {
  from {
    transform: translateY(16px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes floatIn {
  from {
    transform: translateY(22px) scale(0.96);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes revealTile {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes floatBadge {
  0% {
    transform: translateY(0px) rotate(-4deg);
  }
  100% {
    transform: translateY(-12px) rotate(4deg);
  }
}

@media (max-width: 960px) {
  .stage {
    padding: 10px 12px 78px;
  }

  .media-layer {
    inset: 10px 12px 78px 50%;
    border-radius: 18px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .character-wrap {
    left: 14px;
    bottom: 0;
    width: min(42vw, 320px);
  }

  .bubble-wrap {
    position: fixed;
    top: 18px;
    left: 14px;
    bottom: auto;
    width: calc(50vw - 30px);
    z-index: 6;
  }

  .bubble {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    backdrop-filter: none;
  }

  .bubble::before {
    display: none;
  }

  .bubble h1 {
    font-size: clamp(1.15rem, 2.2vw, 1.7rem);
    color: #101820;
    text-shadow: 0 2px 7px rgba(255, 255, 255, 0.55);
  }

  .bubble p {
    margin-top: 8px;
    font-size: clamp(0.9rem, 1.4vw, 1rem);
    line-height: 1.48;
    color: #1f2c3a;
    text-shadow: 0 2px 7px rgba(255, 255, 255, 0.55);
  }

  .contact-panel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100% - 20px));
    max-width: calc(100% - 20px);
  }
}

@media (max-width: 640px) {
  .stage {
    align-items: start;
    padding: 8px 10px 62px;
  }

  .media-layer {
    position: fixed;
    inset: 8px 10px auto 10px;
    height: calc(50vh - 16px);
    border-radius: 14px;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .character-wrap {
    position: fixed;
    left: 10px;
    bottom: 0;
    width: min(34vw, 124px);
  }

  .bubble-wrap {
    position: fixed;
    top: calc(50vh + 10px);
    left: calc(min(34vw, 124px) + 18px);
    bottom: auto;
    width: calc(100vw - (min(34vw, 124px) + 30px));
    max-height: calc(50vh - 84px);
    overflow: auto;
  }

  .bubble {
    border-radius: 0;
    padding: 0;
  }

  .bubble h1 {
    font-size: 1.02rem;
  }

  .bubble p {
    font-size: 0.88rem;
    line-height: 1.42;
  }

  .contact-panel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: calc(100% - 20px);
    max-width: 360px;
    padding: 12px 14px;
  }

  .bottom-bar {
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .step-indicator {
    font-size: 0.74rem;
    letter-spacing: 0.04em;
  }

  .nav-btn {
    width: auto;
    min-width: 44px;
    padding: 7px;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .nav-btn img {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
