@import url('https://fonts.googleapis.com/css2?family=Konkhmer+Sleokchher&family=Syne:wght@400;500;600;700;800&family=Space+Grotesk:wght@300;400;500;600&display=swap');

/* ==========================================================================
   CAFOAR EDITORIAL — DESIGN TOKENS & RESET
   ========================================================================== */

:root {
  --bg-color: #F5F5F0;
  --text-primary: #1A1A1A;
  --text-secondary: #777777;
  --text-muted: #999999;
  --placeholder-bg: #E8E8E4;
  --border-subtle: #E0E0E0;
  --margin-lateral: 100px;
  --font-editorial: 'Konkhmer Sleokchher', 'Syne', serif;
  --font-sans: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-editorial);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-color: var(--bg-color);
  overflow-x: hidden;
  position: relative;
  cursor: none; /* Custom interactive cursor */
}

/* ==========================================================================
   CUSTOM CURSOR
   ========================================================================== */

.custom-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background-color: var(--text-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.custom-cursor-circle {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(26, 26, 26, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--transition-smooth), 
              height 0.3s var(--transition-smooth), 
              background-color 0.3s ease, 
              border-color 0.3s ease;
}

body.cursor-hover .custom-cursor-circle {
  width: 64px;
  height: 64px;
  background-color: rgba(26, 26, 26, 0.08);
  border-color: rgba(26, 26, 26, 0.8);
}

/* ==========================================================================
   PRELOADER
   ========================================================================== */

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 1.2s var(--transition-smooth);
}

.preloader.hidden {
  transform: translateY(-100%);
  pointer-events: none;
}

.preloader-title {
  font-family: var(--font-editorial);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--text-primary);
  margin-bottom: 2rem;
  display: flex;
  overflow: hidden;
}

.preloader-letter {
  display: inline-block;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.8s var(--transition-smooth), opacity 0.8s ease;
}

.preloader-bar-container {
  width: 240px;
  height: 1px;
  background-color: rgba(26, 26, 26, 0.15);
  position: relative;
  overflow: hidden;
}

.preloader-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background-color: var(--text-primary);
  transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ==========================================================================
   STRICT 100PX LATERAL MARGIN WRAPPER
   ========================================================================== */

.page-container {
  width: 100%;
  max-width: 100%;
  padding-left: var(--margin-lateral);
  padding-right: var(--margin-lateral);
  margin: 0 auto;
  box-sizing: border-box;
}

/* ==========================================================================
   HEADER & NAVIGATION (FULL-WIDTH 100% BACKGROUND + 100PX INNER MARGINS)
   ========================================================================== */

.site-header {
  width: 100%;
  padding-top: 36px;
  padding-bottom: 30px;
  padding-left: var(--margin-lateral);
  padding-right: var(--margin-lateral);
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand-logo {
  font-family: var(--font-editorial);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.2s ease;
}

.brand-logo:hover {
  opacity: 0.6;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-link {
  font-family: var(--font-editorial);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  transition: opacity 0.2s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--text-primary);
  transition: width 0.3s var(--transition-smooth);
}

.nav-link:hover::after {
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-editorial);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: var(--text-primary);
  transform: translateX(-4px);
}

/* ==========================================================================
   HOMEPAGE HERO — CAFOAR
   ========================================================================== */

.hero-section {
  padding-top: 60px;
  padding-bottom: 50px;
}

.hero-title {
  font-family: var(--font-editorial);
  font-size: clamp(4.5rem, 14vw, 15rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  user-select: none;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ==========================================================================
   MARQUEE SECTION (HORIZONTAL CAROUSEL)
   ========================================================================== */

.marquee-section {
  margin-top: 20px;
  margin-bottom: 90px;
  overflow: hidden;
}

.marquee-wrapper {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.marquee-track {
  display: flex;
  gap: 24px;
  width: max-content;
  animation: marqueeScroll 35s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.marquee-item {
  width: 280px;
  height: 380px;
  background-color: var(--placeholder-bg);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--transition-smooth);
}

/* SMART CROPPING RULE FOR MARQUEE */
.marquee-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.6s var(--transition-smooth);
}

.marquee-item:hover img {
  transform: scale(1.05);
}

/* ==========================================================================
   SELECTED WORK (HOMEPAGE 3-COLUMN GRID)
   ========================================================================== */

.selected-work-section {
  padding-bottom: 120px;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 40px;
}

.section-title {
  font-family: var(--font-editorial);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.section-count {
  font-family: var(--font-editorial);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 32px;
}

.project-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.4s var(--transition-smooth);
}

.project-card:hover {
  transform: translateY(-6px);
}

/* SMART CROPPING FOR HOMEPAGE COVERS */
.project-img-wrapper {
  width: 100%;
  aspect-ratio: 3 / 4;
  background-color: var(--placeholder-bg);
  position: relative;
  overflow: hidden;
}

.project-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.6s var(--transition-smooth);
}

.project-card:hover .project-img-wrapper img {
  transform: scale(1.04);
}

.project-info {
  margin-top: 18px;
}

.project-title {
  font-family: var(--font-editorial);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: color 0.2s ease;
}

.project-card:hover .project-title {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-desc {
  font-family: var(--font-editorial);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-secondary);
  text-transform: uppercase; /* MAYÚSCULAS */
}

/* ==========================================================================
   INDIVIDUAL PROJECT PAGES (ASYMMETRIC LAYOUT)
   ========================================================================== */

.asymmetric-hero {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 50px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 60px;
  border-bottom: 1px solid var(--border-subtle);
}

.project-meta-col {
  display: flex;
  flex-direction: column;
}

.detail-project-title {
  font-family: var(--font-editorial);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.detail-project-desc {
  font-family: var(--font-editorial);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-transform: uppercase; /* MAYÚSCULAS */
  max-width: 92%;
}

/* Featured Hero Image: NO CROPPING, natural flow */
.featured-img-box {
  width: 100%;
  height: auto;
  overflow: hidden;
}

.featured-img-box img {
  width: 100%;
  height: auto;
  display: block;
}

/* Controls Bar */
.project-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 60px;
  font-family: var(--font-editorial);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.control-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.control-link:hover {
  opacity: 0.5;
}

.control-counter {
  margin: 0 16px;
  color: var(--text-muted);
}

/* ==========================================================================
   PROJECT BODY STREAM — STRICTLY NO-CROPPING & GAP HARMONIZATION
   ========================================================================== */

.project-body-stream {
  display: flex;
  flex-direction: column;
  gap: 50px;
  padding-bottom: 90px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Row of 3 */
.body-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  align-items: start;
}

.body-row-3 .img-item {
  width: 100%;
  height: auto;
}

.body-row-3 .img-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s var(--transition-smooth);
}

.body-row-3 .img-item:hover img {
  transform: translateY(-4px);
}

/* Row of 2 */
.body-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  align-items: start;
}

.body-row-2 .img-item {
  width: 100%;
  height: auto;
}

.body-row-2 .img-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s var(--transition-smooth);
}

.body-row-2 .img-item:hover img {
  transform: translateY(-4px);
}

/* Row of 1 Full Width (Margen a margen dentro de 100px) */
.body-row-full, .img-full-width {
  width: 100%;
  height: auto;
}

.body-row-full .img-item, .img-full-width .img-item {
  width: 100%;
  height: auto;
}

.body-row-full .img-item img, .img-full-width .img-item img, .img-full-width img {
  width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   VIDEOS (SUB-CARPETAS VID) — EXPANDIDOS AL MÁXIMO ANCHO SIN RECORTE
   ========================================================================== */

.project-videos-section {
  display: flex;
  flex-direction: column;
  gap: 50px;
  width: 100%;
  padding-top: 50px;
}

.video-item {
  width: 100%;
  height: auto;
  overflow: hidden;
}

.video-item video {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

/* Next Project Section */
.next-project-section {
  padding: 80px 0 100px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.next-project-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.next-project-label {
  font-family: var(--font-editorial);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.next-project-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.next-project-title {
  font-family: var(--font-editorial);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 400;
  color: var(--text-primary);
  transition: transform 0.4s var(--transition-smooth);
}

.next-project-arrow {
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--text-primary);
  transition: transform 0.4s var(--transition-smooth);
}

.next-project-link:hover .next-project-title {
  transform: translateX(12px);
}

.next-project-link:hover .next-project-arrow {
  transform: translateX(16px);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  width: 100%;
  padding-top: 40px;
  padding-bottom: 60px;
  background-color: var(--bg-color);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-editorial);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.footer-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 0.5;
}

/* ==========================================================================
   TEXT TRANSITIONS & SCROLL REVEAL ANIMATIONS
   ========================================================================== */

.reveal-text {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth);
}

.reveal-text.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  :root {
    --margin-lateral: 40px;
  }
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .asymmetric-hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .body-row-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --margin-lateral: 24px;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .body-row-3, .body-row-2 {
    grid-template-columns: 1fr;
  }
  .footer-row {
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
  }
}
