/* ============================================================
   CT3D — Portfolio Web
   Estética: clara, premium, toque cálido (Apple pero cercano)
   ============================================================ */

:root {
  --bg: #faf8f5;
  --bg-soft: #f1ede7;
  --ink: #1d1c1a;
  --ink-soft: #6e6a63;
  --accent: #e0662f;        /* terracota cálido */
  --accent-soft: #f6dfd2;
  --card: #ffffff;
  --line: #e7e2da;
  --radius: 22px;
  --shadow: 0 20px 60px -25px rgba(29, 28, 26, 0.18);
  --font-body: "Manrope", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: transparent; /* el canvas fijo se ve a través */
  overflow-x: hidden;
  line-height: 1.6;
}

/* Halo cálido tras el cubo: le da contraste sobre el fondo crema */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%, rgba(235, 200, 170, 0.55) 0%, rgba(235, 200, 170, 0) 52%);
}

/* ---------- Canvas 3D fijo, detrás del contenido ---------- */
#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  filter: blur(10px);       /* arranca difuminado tras el titular */
}

main, .site-header, .site-footer {
  position: relative;
  z-index: 1;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(250, 248, 245, 0.65);
  border-bottom: 1px solid rgba(231, 226, 218, 0.6);
}

.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.logo span { color: var(--accent); }

.site-header nav {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
}
.site-header nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
  transition: color 0.2s;
}
.site-header nav a:hover { color: var(--ink); }

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); background: var(--accent); }
.btn-small { padding: 9px 18px; font-size: 0.85rem; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }

/* ---------- Hero ---------- */
.hero { height: 220vh; }

.hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(5rem, 18vw, 13rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.hero-title .accent { color: var(--accent); }

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 2rem);
  margin-top: 18px;
  color: var(--ink);
}

.hero-sub {
  margin-top: 10px;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--ink-soft);
  max-width: 46ch;
  padding: 0 20px;
}

.scroll-hint {
  position: absolute;
  bottom: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.scroll-hint-line {
  width: 1.5px;
  height: 48px;
  background: linear-gradient(var(--ink-soft), transparent);
  animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { transform: scaleY(1); opacity: 0.9; }
  50% { transform: scaleY(0.55); opacity: 0.4; }
}

/* ---------- Showcase (el cubo gira) ---------- */
.showcase { height: 260vh; }

.showcase-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.callout {
  position: absolute;
  max-width: 320px;
  opacity: 0;               /* GSAP las muestra */
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}
.callout h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.callout p { color: var(--ink-soft); font-size: 0.98rem; }

.callout-1 { top: 20%; left: clamp(16px, 8vw, 12%); }
.callout-2 { top: 42%; right: clamp(16px, 8vw, 12%); }
.callout-3 { bottom: 18%; left: clamp(16px, 12vw, 18%); }

/* ---------- Secciones genéricas ---------- */
section { padding: 0 clamp(20px, 6vw, 72px); }

.section-head {
  max-width: 640px;
  margin: 0 auto 64px;
  text-align: center;
}
.kicker {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.section-head h2, .contact h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.section-sub {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---------- Catálogo ---------- */
.catalog { padding-top: 8vh; padding-bottom: 12vh; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 26px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-6px); }

.card-featured {
  grid-column: span 2;           /* apaisada, como el resto de tarjetas */
  flex-direction: row;
  background: transparent;       /* la ventana del cubo se ve a través */
  border: 1.5px solid var(--line);
}

/* Ventana transparente donde "aterriza" el cubo 3D */
.cube-slot {
  flex: 1.25;
  min-height: 320px;
  background: transparent;
}

.card-featured .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  background: var(--card);
  border-left: 1px solid var(--line);
}

.card-body { padding: 26px 28px 30px; }
.card-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.card-body p { color: var(--ink-soft); font-size: 0.98rem; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 12px;
}

.card-visual {
  height: 180px;
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  color: var(--accent);
}
.visual-llavero        { background: linear-gradient(135deg, #f6ede3, #f1e2d2); }
.visual-posacubiertos  { background: linear-gradient(135deg, #eef0e9, #e2e7da); }
.visual-senaletica     { background: linear-gradient(135deg, #eaeef2, #dbe3ea); }
.visual-medida         { background: linear-gradient(135deg, #f4ebee, #ecdce2); }

/* ---------- Webs ---------- */
.webs { padding-top: 10vh; padding-bottom: 14vh; background: var(--bg-soft); }
.webs .section-head { padding-top: 10vh; }

.webs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 26px;
  max-width: 1100px;
  margin: 0 auto;
}

.web-card p {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 0.98rem;
  padding: 0 4px;
}

.browser-frame {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
  transition: transform 0.3s ease;
}
.web-card:hover .browser-frame { transform: translateY(-6px) rotate(-0.5deg); }

.browser-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: #f3f0eb;
  border-bottom: 1px solid var(--line);
}
.browser-bar i {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ddd6cc;
}

.browser-body {
  height: 170px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.wb-1 { background: linear-gradient(160deg, #fdf6ef, #f7e5d4); }
.wb-2 { background: linear-gradient(160deg, #f2f6ef, #e2ecd9); }
.wb-3 { background: linear-gradient(160deg, #eff3f6, #d9e5ec); }

.card-more {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.card:hover .card-more { text-decoration: underline; }

/* ---------- Ruleta de webs ---------- */
.web-carousel {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  max-width: 1100px;
  margin: 0 auto;
}

.car-stage {
  position: relative;
  flex: 1;
  height: 520px;
  perspective: 1600px;
  touch-action: pan-y;
}

.car-item {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(780px, 94%);
  height: fit-content;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  will-change: transform;
}
.car-item .browser-frame { box-shadow: 0 30px 70px -30px rgba(29, 28, 26, 0.35); }
.car-item.is-front .browser-frame:hover { transform: translateY(-4px); }

.browser-url {
  margin-left: 10px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: #fff;
  border-radius: 6px;
  padding: 1px 10px;
  border: 1px solid var(--line);
}

.browser-body { flex-direction: column; gap: 6px; display: flex; align-items: center; justify-content: center; }
.browser-body em { font-style: normal; font-size: 2rem; }

/* Los previews de la ruleta son grandes para que la web se lea */
.car-item .browser-body { height: 420px; }

/* Preview vivo: la web real incrustada, escalada por ui.js */
.browser-live {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: #0e0e0e;
}
.browser-live iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1560px;
  height: 840px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none; /* el clic va al enlace, no a la web incrustada */
}
.wb-4 { background: linear-gradient(160deg, #fdf0ea, #f3d8c8); }

.car-btn {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 12;
}
.car-btn:hover { background: var(--accent); color: #fff; transform: scale(1.06); }

.car-caption {
  text-align: center;
  margin: 26px auto 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---------- Ficha de producto ---------- */
.product-modal { position: fixed; inset: 0; z-index: 50; }
.product-modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 28, 26, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  margin: 6vh auto 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(26px, 4vw, 44px);
  box-shadow: 0 40px 90px -30px rgba(29, 28, 26, 0.45);
}

.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--accent-soft); }

.modal-panel h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin: 10px 0 12px;
}
.pm-desc { color: var(--ink-soft); }

.pm-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0;
}
.pm-gallery figure {
  border-radius: 14px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
}
.pm-gallery span { font-size: 2.2rem; }
.pm-gallery figcaption { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; }

.pm-features {
  margin: 0 0 22px;
  padding-left: 20px;
  color: var(--ink);
}
.pm-features li { margin-bottom: 7px; }

.pm-clients h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 10px;
}
.pm-clients small { color: var(--ink-soft); font-weight: 400; }
.pm-chip {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  margin: 0 8px 8px 0;
}
.pm-clients { margin-bottom: 26px; }

/* ---------- Contacto ---------- */
.contact {
  text-align: center;
  padding-top: 16vh;
  padding-bottom: 16vh;
  max-width: 640px;
  margin: 0 auto;
}
.contact p { margin-top: 14px; color: var(--ink-soft); font-size: 1.1rem; }
.contact-actions {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 34px 20px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  .site-header { padding: 14px 18px; }
  .site-header nav { display: none; }

  .hero-title { font-size: clamp(3.6rem, 21vw, 6rem); }
  .hero-tagline { font-size: 1.2rem; margin-top: 12px; }
  .hero-sub { font-size: 0.92rem; }

  .callout {
    max-width: min(320px, calc(100vw - 32px));
    padding: 16px 18px;
    border-radius: 16px;
  }
  .callout h3 { font-size: 1.1rem; }
  .callout p { font-size: 0.88rem; }
  .callout-1 { top: 14%; left: 16px; right: auto; }
  .callout-2 { top: 40%; right: 16px; left: auto; }
  .callout-3 { bottom: 14%; left: 16px; right: auto; }

  section { padding-left: 18px; padding-right: 18px; }
  .section-head { margin-bottom: 40px; }
  .section-head h2, .contact h2 { font-size: 2rem; }
  .section-sub, .contact p { font-size: 0.95rem; }

  .card-featured { grid-column: span 1; flex-direction: column; }
  .card-featured .card-body { border-left: none; border-top: 1px solid var(--line); }
  .cube-slot { min-height: 260px; }
  .card-body { padding: 20px 22px 24px; }
  .card-visual { height: 140px; font-size: 2.6rem; }
  .browser-body { height: 140px; }

  .btn { padding: 12px 22px; font-size: 0.95rem; }

  .car-stage { height: 300px; }
  .car-item .browser-body { height: 230px; }
  .car-btn { width: 38px; height: 38px; }
  .modal-panel { margin: 4vh 12px 0; }
  .pm-gallery { gap: 8px; }
}

/* ---------- Accesibilidad: sin animaciones ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #webgl { filter: none; }
  .hero, .showcase { height: auto; min-height: 100vh; }
  .callout { opacity: 1; position: static; margin: 20px auto; }
  .showcase-sticky { height: auto; padding: 12vh 0; }
  .scroll-hint-line { animation: none; }
}
