/* ─── RESET ─────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ─── ICON UTILITY ───────────────────────────────────── */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask-image: var(--i);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-image: var(--i);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  flex-shrink: 0;
}

.icon--24 {
  width: 24px;
  height: 24px;
}

/* ─── TOKENS: Tailwind v4 Stone ──────────────────────── */
:root {
  --stone-50:  #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;
  --stone-950: #0C0A09;

  --font-display: 'Funnel Display', sans-serif;
  --font-body:    'Archivo', sans-serif;
}

/* ─── BASE ───────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--stone-950);
  color: var(--stone-100);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════
   PAGE LAYOUT
   Two columns. Left sticky, right natural scroll.
   No outer padding — each column pads itself.
══════════════════════════════════════════════════════════ */
.page-layout {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ─── LEFT COLUMN ────────────────────────────────────── */
.left-col {
  width: 30%;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

/* Masks the scrolling track */
.left-track-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Translates up on scroll via JS */
.left-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  will-change: transform;
}

/* Each content block in the track */
.left-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
}

/* Footer pinned at the bottom of left-col, never scrolls */
.left-footer {
  flex-shrink: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── RIGHT COLUMN ───────────────────────────────────── */
.right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Each block is exactly one viewport tall */
.right-block {
  height: 100vh;
  flex-shrink: 0;
  padding: 12px 12px 12px 0;
  position: relative;
}

/* ─── HERO VIDEO ─────────────────────────────────────── */
.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* Bottom gradient over video */
.hero-gradient {
  position: absolute;
  inset: 12px 12px 12px 0; /* matches right-block padding (no left) */
  border-radius: 12px;
  background: linear-gradient(to bottom, transparent 40%, #0C0A09 100%);
  pointer-events: none;
}

/* Scroll cue sits above the gradient */
.scroll-cue {
  position: absolute;
  bottom: 0;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--stone-600);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  cursor: pointer;
  padding: 12px 12px 40px 12px;
  transition: color 0.6s ease;
}

.scroll-cue:hover { color: var(--stone-300); }

.scroll-cue.bouncing { color: var(--stone-300); }

@keyframes bounce-y {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}

.scroll-cue.bouncing .icon {
  animation: bounce-y 1.2s ease-in-out infinite;
}

/* ─── PROJECT IMAGES ─────────────────────────────────── */
.project-img {
  width: 100%;
  height: 100%;
  background: var(--stone-900);
  border-radius: 12px;
  overflow: hidden;
}

.project-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── CONTACT VIDEO ──────────────────────────────────── */
.contact-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* ─── TYPOGRAPHY ─────────────────────────────────────── */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.05;
  font-weight: 400;
  color: var(--stone-50);
  letter-spacing: -0.02em;
}

.blink-cursor {
  animation: blink 0.7s steps(1, end) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--stone-400);
}

.hero-subtitle-bright { color: var(--stone-200); }

.project-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.33;
  font-weight: 400;
  color: var(--stone-50);
  letter-spacing: -0.02em;
}

.project-desc {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-desc p {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  color: var(--stone-400);
}

.project-meta-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px; /* 8px + 16px flex gap = 24px from project subtext */
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-header .icon {
  color: var(--stone-600);
  flex-shrink: 0;
}

.meta-key {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--stone-200);
}

.meta-val {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--stone-400);
  padding-left: 20px; /* 16px icon + 4px gap — indents under the label */
}

/* ─── CONTACT ────────────────────────────────────────── */
.contact-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.33;
  font-weight: 400;
  color: var(--stone-50);
  letter-spacing: -0.02em;
}

.contact-subtitle {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--stone-400);
}

/* Inline "or email me directly" — copies the address on click */
.email-copy {
  position: relative;
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--stone-200);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.email-copy:hover {
  color: var(--stone-50);
}

.email-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--stone-800);
  color: var(--stone-100);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.email-copy:hover .email-tooltip,
.email-copy:focus-visible .email-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px; /* 16px + 16px block gap = 32px from subtitle */
}

.form-field {
  display: flex;
}

.form-input {
  width: 100%;
  padding: 12px;
  background: var(--stone-900);
  border: 1px solid var(--stone-800);
  border-radius: 4px;
  color: var(--stone-100);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  resize: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form-input::placeholder {
  color: var(--stone-600);
}

.form-input:hover {
  border-color: var(--stone-700);
}

.form-input:focus {
  outline: none;
  border-color: var(--stone-600);
  background: var(--stone-800);
}

.form-textarea {
  min-height: 96px;
  max-height: 200px;
}

.contact-form .cta-btn {
  margin-top: 8px;
}

/* ─── CTA BUTTON ─────────────────────────────────────── */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 24px;
  background: var(--stone-800);
  border: none;
  border-radius: 4px;
  color: var(--stone-100);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease,
              opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-btn:hover { background: var(--stone-700); }

.cta-btn .icon { color: var(--stone-400); }

.hero-left-top .cta-btn { margin-top: 8px; }

/* ─── FOOTER NAV ─────────────────────────────────────── */
.footer-nav {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 8px);
}

.footer-pill {
  flex: 1;
  min-width: 0; /* allow the pill to shrink instead of overflowing the column */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px clamp(8px, 1.4vw, 24px);
  background: var(--stone-900);
  border: none;
  border-radius: 4px;
  color: var(--stone-600);
  font-family: var(--font-display);
  font-size: clamp(12px, 1.1vw, 14px);
  line-height: 16px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease,
              opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  overflow: hidden;
}

.footer-pill:hover { background: var(--stone-800); }

.footer-pill--icon {
  flex: none;
  padding: 8px clamp(10px, 1.4vw, 24px);
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.1vw, 14px);
  line-height: 16px;
  font-weight: 400;
  color: var(--stone-700);
  white-space: nowrap;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── HERO ENTRANCE ANIMATIONS ──────────────────────── */
.hero-anim {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-anim.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── LOADER ─────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

#loader-grid {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
}

.pixel-cell {
  width: 24px;
  height: 24px;
  background: var(--stone-950);
  transition: opacity 0.2s ease;
}

#loader-counter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--stone-100);
  z-index: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

/* ─── RESPONSIVE / MOBILE ────────────────────────────── */
#mobile-root { display: none; }

@media (max-width: 768px) {
  /* Desktop shell is emptied by the JS builder, then hidden */
  .page-layout { display: none; }
  #mobile-root { display: block; }

  .m-sec {
    position: relative;
    isolation: isolate; /* keep each section's caption/gallery stacking local */
  }

  /* Sticky caption — pins at the top while its gallery scrolls past */
  .m-cap {
    position: sticky;
    top: 0;
    z-index: 1;          /* behind the gallery, so images scroll up over it */
    background: var(--stone-950);
    padding: 20px 16px 24px;
  }

  .m-cap .left-block {
    height: auto !important;
    padding: 0;
    gap: 16px;
  }

  /* Gallery — scrolls over the caption */
  .m-gallery {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px 16px;
    background: var(--stone-950);
  }

  /* Read gap — transparent space lets the caption stay visible a beat
     longer before the images scroll up and cover it */
  .m-sec:not(.m-sec--contact) .m-gallery {
    margin-top: 25vh;
  }

  .m-gallery .right-block {
    height: auto;
    padding: 0;
  }

  .m-gallery .hero-video,
  .m-gallery .contact-video {
    height: 72vh;
  }

  /* Project screenshots keep their own aspect ratio — full width, no crop */
  .m-gallery .project-img {
    height: auto;
  }

  .m-gallery .project-img img {
    height: auto;
    object-fit: contain;
  }

  .m-gallery .hero-gradient { inset: 0; border-radius: 12px; }
  .scroll-cue { display: none; }

  /* Contact flows normally so the form stays fully usable */
  .m-sec--contact .m-cap { position: static; z-index: auto; }
  .m-sec--contact .m-gallery { z-index: auto; }

  /* Footer sits at the end of the contact section */
  .m-sec .left-footer {
    position: static;
    padding: 24px 16px 32px;
  }

  /* Title sizing on small screens */
  .hero-title { font-size: 32px; line-height: 1.1; }
  .project-title,
  .contact-title { font-size: 24px; line-height: 1.3; }
}
