/* ==========================================================
   Components — one block per section of the page
   ========================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-weight: 600;
  border: 1px solid var(--color-accent);
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s;
}
.btn:hover { transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-text); }

.btn-small { padding: 0.55rem 1.1rem; font-size: var(--fs-sm); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgb(14 14 16 / 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--color-border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 0.7rem; font-weight: 600; }
.logo-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-display);
  font-weight: 800;
}

.site-nav ul { display: flex; align-items: center; gap: var(--space-md); }
.site-nav a:not(.btn) { color: var(--color-muted); transition: color 0.2s; }
.site-nav a:not(.btn):hover { color: var(--color-text); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle {
    display: block;
    width: 44px; height: 44px;
    position: relative;
    z-index: 60;
  }
  .nav-toggle-bar {
    position: absolute;
    left: 10px;
    top: 21px;
    width: 24px; height: 2px;
    background: var(--color-text);
    transition: transform 0.3s var(--ease);
  }
  .nav-toggle-bar:first-of-type { transform: translateY(-4px); }
  .nav-toggle-bar:last-of-type { transform: translateY(4px); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-of-type { transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-of-type { transform: rotate(-45deg); }

  .site-nav {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; }
  .site-nav ul { flex-direction: column; gap: var(--space-lg); }
  .site-nav a:not(.btn) { font-family: var(--font-display); font-size: 2rem; color: var(--color-text); }
  .logo-text { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-h) + var(--space-lg));
  padding-bottom: var(--space-xl);
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  width: 60vmax; height: 60vmax;
  right: -20vmax; top: -20vmax;
  background: radial-gradient(circle, rgb(198 255 61 / 0.18), transparent 60%);
  filter: blur(20px);
  animation: float 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes float {
  to { transform: translate(-10vmax, 12vmax) scale(1.1); }
}

.hero .container { position: relative; }

.hero-title { font-size: var(--fs-h1); font-weight: 800; max-width: 14ch; }
.hero-title em {
  font-style: italic;
  color: var(--color-muted);
}

.hero-lead {
  max-width: 52ch;
  margin-top: var(--space-md);
  font-size: var(--fs-lg);
  color: var(--color-muted);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dt { color: var(--color-muted); font-size: var(--fs-sm); }
.hero-stats dd { margin: 0; font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding-block: 1rem;
  transform: rotate(-1.5deg) scale(1.02);
}
.marquee-track {
  display: flex;
  gap: 2rem;
  width: max-content;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  text-transform: uppercase;
  animation: marquee 30s linear infinite;
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-sm);
}

.service-card {
  padding: var(--space-lg) var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.3s, transform 0.3s var(--ease), background 0.3s;
}
.service-card:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-2);
  transform: translateY(-4px);
}
.service-num { display: block; color: var(--color-accent); font-family: var(--font-display); margin-bottom: var(--space-lg); }
.service-card h3 { font-size: var(--fs-h3); margin-bottom: var(--space-xs); }
.service-card p { color: var(--color-muted); }

/* ---------- Work (carousel) ---------- */
.section-head--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.carousel-controls { display: flex; align-items: center; gap: var(--space-xs); }
.carousel-count {
  margin-right: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}
.carousel-count [data-carousel-current] { color: var(--color-text); }

.carousel-btn {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  transition: background 0.25s, color 0.25s, border-color 0.25s, opacity 0.25s;
}
.carousel-btn svg { width: 22px; height: 22px; }
.carousel-btn:hover:not(:disabled) { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-accent); }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }

/* Native horizontal scroll + snap: swipe on phones, trackpad on desktop */
.carousel-track {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* Slightly narrower than the track so the next card peeks in */
.project-slide {
  flex: 0 0 calc(100% - 96px);
  scroll-snap-align: start;
  scroll-snap-stop: always; /* a fast swipe moves one card at most */
  display: flex;
}

.project-card {
  flex: 1;
  display: grid;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  opacity: 0.45;
  transition: opacity 0.5s var(--ease), border-color 0.5s;
}
.project-slide.is-active .project-card { opacity: 1; }
.project-card--landscape { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.project-card--portrait { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }

.project-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius-lg) - 8px);
  background: linear-gradient(135deg, var(--g1, #333), var(--g2, #555));
  overflow: hidden;
}
.project-card--portrait .project-media {
  aspect-ratio: 9 / 16;
  box-shadow: 0 0 0 6px var(--color-bg), 0 20px 50px rgb(0 0 0 / 0.5);
}
.project-media img { width: 100%; height: 100%; object-fit: cover; }

.project-text h3 { font-size: var(--fs-h3); margin-top: var(--space-xs); }
.project-text p { color: var(--color-muted); margin-top: var(--space-sm); max-width: 46ch; }

.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }
.tag-list li {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

.carousel-dots { display: flex; justify-content: center; gap: 0.5rem; margin-top: var(--space-md); }
.carousel-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  transition: width 0.4s var(--ease), background 0.3s;
}
.carousel-dot[aria-current="true"] { width: 28px; background: var(--color-accent); }

/* Photo gallery media (a carousel inside a project card) */
.gallery { background: #000; }
/* Vertical photos: 2:3 frame, 308px wide so it's as tall as a 260px 9:16 video */
.project-card--portrait .gallery { aspect-ratio: 2 / 3; }
/* Desktop only: wider photo column (must not override the stacked layout below 1000px) */
@media (min-width: 1001px) {
  .project-card--portrait.project-card--photos { grid-template-columns: minmax(0, 308px) minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .project-card--photos.project-card--portrait .project-media { width: min(308px, 100%); }
}
.gallery-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; /* swiping photos never moves the outer carousel */
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--g1, #333), var(--g2, #555));
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: rgb(255 255 255 / 0.6);
}

.gallery-count {
  position: absolute;
  top: 12px; right: 12px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgb(14 14 16 / 0.7);
  backdrop-filter: blur(6px);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.gallery-btn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgb(14 14 16 / 0.7);
  backdrop-filter: blur(6px);
  transition: background 0.25s, color 0.25s, opacity 0.25s;
}
.gallery-btn svg { width: 18px; height: 18px; }
.gallery-btn--prev { left: 12px; }
.gallery-btn--next { right: 12px; }
.gallery-btn:hover:not(:disabled) { background: var(--color-accent); color: var(--color-accent-ink); }
.gallery-btn:disabled { opacity: 0; pointer-events: none; }

.gallery-dots {
  position: absolute;
  left: 50%; bottom: 12px;
  translate: -50% 0;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgb(14 14 16 / 0.55);
}
.gallery-dots .carousel-dot { width: 6px; height: 6px; background: rgb(255 255 255 / 0.4); }
.gallery-dots .carousel-dot[aria-current="true"] { width: 18px; background: var(--color-accent); }

/* Clickable photos (wrapped in a button by main.js) */
.gallery-zoom {
  position: relative;
  display: block;
  width: 100%; height: 100%;
  padding: 0;
  cursor: zoom-in;
}
.gallery-zoom-icon {
  position: absolute;
  top: 12px; left: 12px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgb(14 14 16 / 0.7);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: background 0.25s, color 0.25s;
}
.gallery-zoom-icon svg { width: 16px; height: 16px; }
.gallery-zoom:hover .gallery-zoom-icon { background: var(--color-accent); color: var(--color-accent-ink); }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  overflow: hidden;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop {
  background: rgb(8 8 10 / 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: lightbox-fade 0.3s ease both;
}
.lightbox.is-closing::backdrop { animation: lightbox-fade 0.2s ease reverse both; }

.lightbox-figure { margin: 0; animation: lightbox-pop 0.4s var(--ease) both; }
.lightbox.is-closing .lightbox-figure { animation: lightbox-pop 0.2s ease reverse both; }
.lightbox-figure.is-switching { animation: lightbox-swap 0.3s var(--ease) both; }
.lightbox-figure img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 84dvh;
  width: auto; height: auto;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6);
}

@keyframes lightbox-fade { from { opacity: 0; } }
@keyframes lightbox-pop { from { opacity: 0; transform: scale(0.9) translateY(12px); } }
@keyframes lightbox-swap { from { opacity: 0.2; transform: scale(0.97); } }

.lightbox-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgb(14 14 16 / 0.75);
  border: 1px solid var(--color-border);
  transition: background 0.25s, color 0.25s, opacity 0.25s;
}
.lightbox-btn svg { width: 22px; height: 22px; }
.lightbox-btn:hover:not(:disabled) { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-accent); }
.lightbox-btn:disabled { opacity: 0; pointer-events: none; }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; translate: 0 -50%; }
.lightbox-next { right: 20px; top: 50%; translate: 0 -50%; }

.lightbox-count {
  position: fixed;
  bottom: 20px; left: 50%;
  translate: -50% 0;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgb(14 14 16 / 0.75);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .lightbox-figure img { max-width: 94vw; max-height: 76dvh; }
  .lightbox-btn { width: 44px; height: 44px; }
  .lightbox-close { top: 12px; right: 12px; }
  /* Arrows sit beside the counter at the bottom, clear of the photo */
  .lightbox-prev, .lightbox-next { top: auto; bottom: 12px; translate: none; }
  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }
  .lightbox-count { bottom: 20px; }
}

/* Video media */
.project-media--video { background: #000; }
.project-media--video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-media--video.is-playing video { object-fit: contain; }

.play-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  box-shadow: 0 0 0 10px rgb(198 255 61 / 0.18), 0 10px 30px rgb(0 0 0 / 0.4);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.play-btn svg { width: 34px; height: 34px; margin-left: 4px; }
.play-btn:hover { transform: scale(1.08); box-shadow: 0 0 0 16px rgb(198 255 61 / 0.15), 0 10px 30px rgb(0 0 0 / 0.4); }
.is-playing .play-btn { display: none; }

/* Stack media above text */
@media (max-width: 1000px) {
  .project-card--landscape,
  .project-card--portrait { grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--space-md); }
  .project-card--portrait .project-media { width: min(260px, 100%); justify-self: center; }
}

@media (max-width: 760px) {
  .project-slide { flex-basis: calc(100% - 32px); }
  .project-card { padding: var(--space-sm); }
  .carousel-btn { width: 44px; height: 44px; }
  .play-btn { width: 64px; height: 64px; }
  .play-btn svg { width: 26px; height: 26px; }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--space-xl);
  align-items: center;
}
.about-photo {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.about-text p:not(.eyebrow) { color: var(--color-muted); font-size: var(--fs-lg); margin-top: var(--space-md); max-width: 55ch; }

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; gap: var(--space-lg); }
  .about-photo { max-width: 360px; }
}

/* ---------- Contact ---------- */
.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; }

.contact-inner {
  display: grid;
  /* minmax(0, …) stops the sliding track from stretching the column */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-xl);
  align-items: center;
}
.contact-title { font-size: var(--fs-h2); }
.contact-title .highlight { display: block; }
.contact-lead { margin-top: var(--space-md); color: var(--color-muted); font-size: var(--fs-lg); max-width: 40ch; }

.contact-card {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xs);
}

/* Tabs */
.tab-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--color-bg);
  border-radius: calc(var(--radius-lg) - 6px);
  padding: 4px;
}
.tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 0.5rem;
  border-radius: calc(var(--radius-lg) - 10px);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--color-muted);
  transition: color 0.3s;
}
.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { color: var(--color-accent-ink); }
.tab-indicator {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: calc(var(--radius-lg) - 10px);
  background: var(--color-accent);
  transform: translateX(calc(var(--tab-index, 0) * 100%));
  transition: transform 0.45s var(--ease);
}

/* Sliding panels */
.tab-viewport { overflow: hidden; }
/* Panels share 5 rows through subgrid, so badge, title, text, value and
   buttons line up at the same height in every tab. */
.tab-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  grid-template-rows: repeat(5, auto);
  transform: translateX(calc(var(--tab-index, 0) * -100%));
  transition: transform 0.55s var(--ease);
}
.tab-panel {
  grid-row: span 5;
  display: grid;
  grid-template-rows: subgrid;
  align-items: start;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  transition: opacity 0.4s;
}
.tab-panel[inert] { opacity: 0.25; }
.tab-panel h3 { font-size: var(--fs-h3); }
.tab-panel p:not(.panel-value) { color: var(--color-muted); margin-top: var(--space-xs); }

.panel-value {
  align-self: center;
  margin-block: var(--space-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 0.9rem + 1vw, 1.6rem);
  overflow-wrap: anywhere;
}

.panel-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: var(--space-sm);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgb(198 255 61 / 0.12);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.panel-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.panel-actions {
  align-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
}
.panel-actions .btn { justify-content: center; }

@media (max-width: 1200px) {
  .contact-inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
}

@media (max-width: 760px) {
  .tab { flex-direction: column; gap: 0.25rem; font-size: 0.8rem; }
  .tab-panel { padding: var(--space-md) var(--space-sm) var(--space-sm); }
  .panel-actions { grid-template-columns: 1fr; }
}

/* ---------- Floating WhatsApp button ---------- */
.whatsapp-float {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 40;
  display: grid;
  place-items: center;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.4), 0 0 24px rgb(198 255 61 / 0.25);
  transition: transform 0.25s var(--ease);
}
.whatsapp-float .icon { width: 30px; height: 30px; }
.whatsapp-float:hover { transform: scale(1.08); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-md);
  padding-right: 80px; /* keep clear of the floating WhatsApp button */
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  color: var(--color-muted);
  font-size: var(--fs-sm);
}
.footer-inner a:hover { color: var(--color-text); }
