/* ==========================================================================
   Jonathan Campillos — Portfolio
   ========================================================================== */

:root {
  --ink: #070a16;
  --ink-2: #10142a;
  --paper: #edf0f7;
  --muted: #9aa3bd;
  --blue: #5b8cff;
  --blue-soft: #8eb0ff;

  --navy: #0e1a3a;
  --cobalt: #2c4dff;
  --light: #e8ebf4;
  --graphite: #14182a;
  --periwinkle: #c9d6ff;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 3vw, 40px);
  --radius: 14px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-soft);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  inset: 16px var(--gutter) auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 10px 10px 22px;
  background: rgba(16, 20, 42, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.nav__logo {
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.nav__logo-short { display: none; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav__links a {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  color: var(--paper);
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav__links a:hover { background: rgba(255, 255, 255, 0.08); }
.nav__links .nav__cta {
  background: var(--paper);
  color: var(--ink);
}
.nav__links .nav__cta:hover { background: var(--blue); color: #fff; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  padding: clamp(112px, 11vw, 150px) var(--gutter) 0;
}

/* Animated shader background (falls back to a static gradient without WebGL) */
.hero__bg {
  position: absolute;
  inset: 0 0 -120px;
  z-index: -1;
  width: 100%;
  height: calc(100% + 120px);
  display: block;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 80% 20%, rgba(44, 77, 255, 0.35), transparent 70%),
    radial-gradient(50% 40% at 15% 70%, rgba(91, 140, 255, 0.18), transparent 70%),
    var(--ink);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  font-size: 16px;
  color: var(--muted);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18);
}

.hero__title {
  margin: 0 0 clamp(28px, 4vw, 48px);
  font-family: var(--display);
  font-weight: 850;
  font-variation-settings: "wdth" 112;
  font-size: clamp(44px, 7.4vw, 136px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.hero__intro {
  margin: 0 0 0.3em;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  font-size: clamp(24px, 3.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--blue-soft);
}
.hero__title-accent {
  color: var(--blue); /* fallback */
  background: linear-gradient(
    100deg,
    #5b8cff 0%,
    #9fc0ff 24%,
    #ffe0c7 38%,
    #ff9a5a 50%,
    #ffe0c7 62%,
    #9fc0ff 76%,
    #5b8cff 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: accent-flow 7s ease-in-out infinite alternate;
}

@keyframes accent-flow {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}
.hero__title,
.about__title,
.bio__statement { text-wrap: balance; }

/* --------------------------------------------------------------------------
   Carousel + cards
   -------------------------------------------------------------------------- */
.carousel {
  margin: 0 calc(var(--gutter) * -1);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  cursor: grab;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}
.carousel.is-dragging .card { pointer-events: none; }

.carousel__track {
  display: flex;
  gap: clamp(12px, 1.5vw, 20px);
  width: max-content;
  padding: 0 var(--gutter);
}

.card {
  --w: clamp(280px, 40vw, 620px);
  --ratio: 0.75; /* height / width */
  position: relative;
  flex: 0 0 auto;
  width: var(--w);
  height: calc(var(--w) * var(--ratio));
  border-radius: var(--radius);
  overflow: hidden;
  scroll-snap-align: start;
  user-select: none;
  cursor: pointer;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.card--hero { --w: clamp(300px, 44vw, 680px); }
.card--square {
  --w: clamp(240px, 28vw, 420px);
  --ratio: 1;
}

/* Hover: the card widens a little and nudges its neighbours along */
@media (hover: hover) {
  .card:hover { width: calc(var(--w) * 1.18); }
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.card:hover img { transform: scale(1.03); }

/* Placeholder artwork */
.card[class*="ph-"]::before {
  content: "Placeholder";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: clamp(18px, 2vw, 26px);
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.55);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}
.ph-1 { background: linear-gradient(135deg, #1b2a6b, #5b8cff); }
.ph-2 { background: linear-gradient(135deg, #0b1230, #2c4dff); }
.ph-3 { background: linear-gradient(135deg, #2a3350, #8eb0ff); }
.ph-4 { background: linear-gradient(135deg, #111527, #3b4466); }
.ph-5 { background: linear-gradient(135deg, #3045c9, #b9c9ff); }

.card__tags {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card__tags span {
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  background: rgba(7, 10, 22, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 6px;
}

/* Prev/next arrows */
.carousel-wrap { position: relative; }

.carousel__arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(4, 6, 14, 0.35);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, color 0.2s ease, opacity 0.25s ease, transform 0.2s ease;
}
.carousel__arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.carousel__arrow--prev { left: 12px; }
.carousel__arrow--next { right: 12px; }
.carousel__arrow:hover { background: var(--blue); color: #fff; }
.carousel__arrow:active { transform: translateY(-50%) scale(0.94); }
.carousel__arrow:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

@media (max-width: 560px) {
  .carousel__arrow { width: 44px; height: 44px; }
  .carousel__arrow svg { width: 18px; height: 18px; }
  .carousel__arrow--prev { left: 4px; }
  .carousel__arrow--next { right: 4px; }
}

/* --------------------------------------------------------------------------
   Bio
   -------------------------------------------------------------------------- */
.bio {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(96px, 12vw, 160px) var(--gutter);
}
:where(.bio > :not(.bio__fx)) { max-width: 1400px; }

/* Interactive dot field on the right side */
.bio__fx {
  position: absolute;
  top: 0;
  right: 0;
  z-index: -1;
  width: 60%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 45%),
                      linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent 0%, #000 45%),
                      linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%);
          mask-composite: intersect;
}
@media (max-width: 820px) {
  .bio__fx { width: 100%; opacity: 0.35; }
}

.bio__statement {
  margin: 0 0 32px;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  font-size: clamp(36px, 5.6vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.bio__statement em {
  font-style: normal;
  color: var(--blue);
}

.bio__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 500;
}
.bio__skills li:not(:last-child)::after {
  content: "•";
  margin: 0 14px;
  color: var(--blue);
}

.bio__text {
  max-width: 640px;
  margin: 0;
  font-size: clamp(18px, 1.5vw, 20px);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Showcase sections
   -------------------------------------------------------------------------- */
.showcase {
  --bg: var(--navy);
  --title: var(--blue-soft);
  --text: var(--paper);
  --sub: rgba(237, 240, 247, 0.72);

  padding: clamp(64px, 8vw, 120px) var(--gutter) clamp(72px, 9vw, 128px);
  background: var(--bg);
  color: var(--text);
}

.showcase--web    { --bg: var(--navy); }
.showcase--brand  { --bg: var(--light); --title: var(--ink); --text: var(--ink); --sub: #4a5270; }
.showcase--logo   { --bg: var(--light); --title: var(--ink); --text: var(--ink); --sub: #4a5270; }
.showcase--print  { --bg: var(--graphite); --title: var(--blue); }
.showcase--social { --bg: var(--periwinkle); --title: #10195a; --text: #10195a; --sub: #33407a; }

/* Stacking: 02 and 03 stick, and the next section slides up over them */
.showcase[hidden] { display: none; }

.showcase[data-stack] {
  position: sticky;
  top: 0;
  box-shadow: 0 -24px 60px rgba(4, 6, 14, 0.35);
}
.showcase--brand { z-index: 1; }
.showcase--logo  { z-index: 2; }
.showcase--print {
  position: relative;
  z-index: 3;
  box-shadow: 0 -24px 60px rgba(4, 6, 14, 0.35);
}
.showcase--social { position: relative; z-index: 4; }

.showcase__head {
  margin-bottom: clamp(32px, 4vw, 56px);
}

.showcase__index {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--sub);
}

.showcase__title {
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 850;
  font-variation-settings: "wdth" 115;
  font-size: clamp(48px, 9.4vw, 168px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--title);
}

.showcase__desc {
  max-width: 620px;
  margin: 0;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
  color: var(--sub);
}

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  padding: clamp(96px, 12vw, 160px) var(--gutter);
  max-width: 1440px;
  margin: 0 auto;
}

.about__photo {
  width: 100%;
  height: auto;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(160deg, #1b2a6b, #070a16);
  color: var(--muted);
  font-size: 16px;
  position: sticky;
  top: 110px;
}

.about__title {
  margin: 0 0 28px;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.about__text {
  max-width: 640px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: clamp(18px, 1.4vw, 20px);
}

.tools { margin-top: 40px; }
.tools ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tools li {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Footer / contact
   -------------------------------------------------------------------------- */
.footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(96px, 12vw, 160px) var(--gutter) 32px;
  background: var(--blue);
  color: var(--ink);
}

.footer__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.footer__title {
  margin: 0 0 32px;
  font-family: var(--display);
  font-weight: 850;
  font-variation-settings: "wdth" 115;
  font-size: clamp(56px, 11vw, 176px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.footer__email {
  display: inline-block;
  font-size: clamp(22px, 3vw, 40px);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid currentColor;
  padding-bottom: 4px;
  word-break: break-all;
  transition: opacity 0.2s ease;
}
.footer__email:hover { opacity: 0.7; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: clamp(80px, 10vw, 140px);
  padding-top: 24px;
  border-top: 1px solid rgba(7, 10, 22, 0.25);
  font-size: 16px;
}
.footer__bottom p { margin: 0; }

.footer__links {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer__links a {
  font-weight: 600;
  text-decoration: none;
}
.footer__links a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Drag cursor (desktop only)
   -------------------------------------------------------------------------- */
.drag-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.drag-cursor.is-visible {
  opacity: 1;
  transform: scale(1);
}

@media (hover: none) {
  .drag-cursor { display: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .about { grid-template-columns: 1fr; }
  .about__photo {
    position: static;
    max-width: 420px;
  }
}

@media (max-width: 560px) {
  .nav { padding-left: 16px; }
  .nav__logo-full { display: none; }
  .nav__logo-short { display: inline; }
  .nav__links a { padding: 10px 12px; }

  .card,
  .card--hero { --w: 82vw; }
  .card--square { --w: 72vw; }

}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (hover: hover) {
  .carousel,
  .carousel.is-dragging { cursor: none; }
}

/* --------------------------------------------------------------------------
   Lightbox (click a card to view it larger)
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 5vw, 64px);
  background: rgba(4, 6, 14, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__stage {
  position: relative;
  width: min(1100px, calc(100vw - 180px));
  transform: scale(0.92);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.lightbox.is-open .lightbox__stage { transform: scale(1); }

.lightbox__stage .card {
  --w: 100%;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 160px);
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  cursor: default;
}
.lightbox__stage .card--square {
  aspect-ratio: 1 / 1;
  width: auto;
  height: min(calc(100vh - 160px), calc(100vw - 32px));
}
.lightbox__stage .card:hover { width: 100%; }
.lightbox__stage .card--square:hover { width: auto; }
.lightbox__stage .card img { object-fit: contain; background: var(--ink-2); }

.lightbox__btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.lightbox__btn:hover { background: var(--blue); color: #fff; }
.lightbox__close { top: 20px; right: 20px; }
.lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 560px) {
  .lightbox__stage { width: 100%; }
  .lightbox__prev,
  .lightbox__next { top: auto; bottom: 20px; transform: none; }
}

body.is-locked { overflow: hidden; }
