/* ============================================================
   impuslodigital.com — cube.css
   Scroll-driven 3D portfolio cube. Light warm commercial theme.
   Mechanics adapted from Luis Martinez Riancho's "Six Faces"
   technique (scroll-driven rotateX/rotateY interpolation with
   inertia smoothing). Repointed at commerce: faces = projects.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap");

:root {
  --bg: #f5f1e8;
  --bg-2: #efe9dc;
  --ink: #1a1410;
  --ink-dim: #5a4f44;
  --ink-muted: #948779;
  --accent: #b8421f;
  --accent-dark: #963318;
  --accent-soft: rgba(184, 66, 31, 0.08);
  --green: #3a7d2c;
  --hairline: 1px;
  --ui-inset: 2rem;
  --card-bg: rgba(255, 252, 246, 0.82);
  --card-border: rgba(184, 66, 31, 0.18);
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "DM Mono", monospace;
  --z-ui: 10;
  --reveal-offset: 0.625rem;
  --reveal-duration: 0.5s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ============================================================
   HEADER (sticky, minimal)
   ============================================================ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(245, 241, 232, 0.88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(184, 66, 31, 0.1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0.9rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { text-decoration: none; font-family: var(--font-display); font-size: 1.4rem; letter-spacing: 0.03em; color: var(--ink); }
.brand em { font-style: normal; color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 1.6rem; font-family: var(--font-mono); font-size: 0.8rem; }
.site-nav a { text-decoration: none; color: var(--ink-dim); transition: color 0.2s ease; }
.site-nav a:hover { color: var(--accent); }
.site-nav .nav-cta { color: var(--bg); background: var(--accent); padding: 0.55rem 1.1rem; font-weight: 500; }

/* ============================================================
   3D CUBE SCENE — the signature element
   ============================================================ */
#scene {
  position: fixed; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  perspective: 1100px; pointer-events: none;
  transition: opacity 0.5s ease;
}
#scene.fade { opacity: 0; pointer-events: none; }

#cube {
  --s: min(70vw, 60vh, 480px);
  width: var(--s); height: var(--s);
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(90deg) rotateY(0deg);
  will-change: transform;
}

.face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(184,66,31,0.03) 0, rgba(184,66,31,0.03) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(90deg, rgba(184,66,31,0.03) 0, rgba(184,66,31,0.03) 1px, transparent 1px, transparent 48px),
    var(--bg-2);
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 1.5rem;
}
.face-content { position: relative; z-index: 2; }
.face-num { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.2em; color: var(--accent); margin-bottom: 0.4rem; }
.face-name { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 0.95; letter-spacing: 0.02em; color: var(--ink); }
.face-status { display: inline-block; margin-top: 0.6rem; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; padding: 0.2rem 0.5rem; border: 1px solid; }
.face-status.live { color: var(--green); border-color: var(--green); }
.face-status.demo { color: var(--accent); border-color: var(--accent); }
.face-status.case { color: var(--ink-muted); border-color: var(--ink-muted); }

.face[data-face="front"]  { transform: translateZ(calc(var(--s) / 2)); }
.face[data-face="back"]   { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.face[data-face="right"]  { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.face[data-face="left"]   { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.face[data-face="top"]    { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.face[data-face="bottom"] { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }

/* ============================================================
   SCROLL CONTAINER — cube sections
   ============================================================ */
#scroll_container { position: relative; z-index: 1; }

section.cube-section {
  min-height: 100vh;
  display: flex; align-items: center;
  padding: 6rem calc(5rem + var(--ui-inset)) 6rem 5rem;
}
section.cube-section.card-right { justify-content: flex-end; padding: 6rem 5rem 6rem calc(5rem + var(--ui-inset)); }

/* ============================================================
   TEXT CARDS — glassmorphic on warm light
   ============================================================ */
.text-card {
  max-width: 24rem;
  padding: 2.25rem 2rem;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(80, 50, 20, 0.06);
}
.text-card.right {
  border-left: none;
  border-right: 1px solid var(--card-border);
  text-align: right;
}
.text-card.center { margin: 0 auto; border-left: none; border-top: 1px solid var(--card-border); text-align: center; max-width: 30rem; }

.tag { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.1rem; }
.text-card h1, .text-card h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.02em; line-height: 0.92; color: var(--ink); }
.text-card h1 { font-size: clamp(2.6rem, 6vw, 5rem); }
.text-card h2 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.body-text { font-size: 0.92rem; line-height: 1.7; color: var(--ink-dim); margin-top: 1.25rem; }

.h-line { width: 3rem; height: 1px; background: var(--accent); margin-bottom: 1.2rem; }

.stat-row { display: flex; gap: 2rem; margin-top: 1.8rem; flex-wrap: wrap; }
.text-card.right .stat-row { justify-content: flex-end; }
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-num { font-family: var(--font-display); font-size: 2rem; color: var(--accent); line-height: 1; }
.stat-label { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); }

.cta-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.text-card.right .cta-row { justify-content: flex-end; }

.cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.3rem; border: 1px solid var(--accent);
  color: var(--accent); font-family: var(--font-mono); font-size: 0.64rem;
  letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.cta:hover { background: var(--accent); color: var(--bg); }
.cta svg { width: 0.7rem; height: 0.7rem; }

.status-badge { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 0.25rem 0.55rem; border: 1px solid; margin-top: 0.8rem; }
.status-badge.live { color: var(--green); border-color: var(--green); }
.status-badge.demo { color: var(--accent); border-color: var(--accent); }
.status-badge.case { color: var(--ink-muted); border-color: var(--ink-muted); }

/* ============================================================
   HUD (top-right) + scene dots (left)
   ============================================================ */
#hud {
  position: fixed; top: calc(var(--ui-inset) + 3rem); right: var(--ui-inset);
  z-index: var(--z-ui); text-align: right;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.14em;
  color: var(--ink-muted); text-transform: uppercase;
  transition: opacity 0.4s ease;
}
#hud.fade { opacity: 0; }
.progress-bar { width: 7rem; height: 1px; background: var(--ink-muted); margin-top: 0.5rem; margin-left: auto; position: relative; overflow: hidden; opacity: 0.4; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--accent); transition: width 0.1s linear; }
.scene-label { font-size: 0.58rem; color: var(--accent); margin-top: 0.4rem; }

#scene_strip {
  position: fixed; left: 1.5rem; top: 50%;
  translate: 0 -50%; z-index: var(--z-ui);
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: opacity 0.4s ease;
}
#scene_strip.fade { opacity: 0; }
.scene-dot { position: relative; display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-muted); opacity: 0.4; transition: background 0.3s, scale 0.3s, opacity 0.3s; cursor: pointer; }
.scene-dot::before { content: ""; position: absolute; inset: -5px; }
.scene-dot.active { background: var(--accent); scale: 1.8; opacity: 1; }

/* Face caption (bottom center) */
#face_caption { position: fixed; bottom: var(--ui-inset); left: 50%; translate: -50% 0; z-index: var(--z-ui); text-align: center; pointer-events: none; user-select: none; transition: opacity 0.4s ease; }
#face_caption.fade { opacity: 0; }
#face_caption_num { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.28em; color: var(--accent); text-transform: uppercase; margin-bottom: 0.15rem; }
#face_caption_name { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.8rem); letter-spacing: 0.08em; color: var(--ink-muted); opacity: 0.4; line-height: 1; }

/* ============================================================
   POST-CUBE SECTIONS (normal scrolling)
   ============================================================ */
#post_cube { position: relative; z-index: 2; background: var(--bg); }

.standard-section { padding: 5rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.section-head { margin-bottom: 3rem; }
.section-tag { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.8rem; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 400; letter-spacing: 0.01em; line-height: 1; color: var(--ink); }
.section-head h2 em { font-style: normal; color: var(--accent); }
.section-head .lede { font-size: 1.1rem; color: var(--ink-dim); max-width: 520px; margin-top: 1rem; }

/* Services */
.services { border-top: 1px solid rgba(184,66,31,0.1); }
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.svc { padding-top: 1.5rem; border-top: 1px solid rgba(184,66,31,0.12); }
.svc-num { font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent); margin-bottom: 0.6rem; }
.svc h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; letter-spacing: 0.01em; margin-bottom: 0.5rem; color: var(--ink); }
.svc p { font-size: 0.95rem; color: var(--ink-dim); line-height: 1.55; }

/* Tools */
.tools { border-top: 1px solid rgba(184,66,31,0.1); }
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.tool-card { padding: 2rem; background: var(--bg-2); border: 1px solid rgba(184,66,31,0.12); text-decoration: none; color: inherit; transition: transform 0.25s ease, border-color 0.25s ease; }
.tool-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.tool-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-size: 1.1rem; margin-bottom: 1rem; }
.tool-card h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 400; margin-bottom: 0.4rem; color: var(--ink); }
.tool-card p { font-size: 0.9rem; color: var(--ink-dim); line-height: 1.5; margin-bottom: 0.9rem; }
.tool-link { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); }

/* Contact */
.contact-section { text-align: center; border-top: 1px solid rgba(184,66,31,0.1); padding: 6rem 1.5rem; }
.contact-section h2 { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 4.5rem); font-weight: 400; letter-spacing: 0.02em; line-height: 1; color: var(--ink); margin-bottom: 1rem; }
.contact-section h2 em { font-style: normal; color: var(--accent); }
.contact-section p { font-size: 1.15rem; color: var(--ink-dim); max-width: 460px; margin: 0 auto 2rem; }
.contact-cta { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-body); font-size: 1rem; font-weight: 500; padding: 1rem 2rem; background: var(--accent); color: var(--bg); text-decoration: none; transition: background 0.2s ease, transform 0.2s ease; }
.contact-cta:hover { background: var(--accent-dark); transform: translateY(-2px); }

/* Footer */
.site-footer { border-top: 1px solid rgba(184,66,31,0.1); padding: 2.5rem 1.5rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-brand { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.03em; color: var(--ink-dim); }
.footer-links { display: flex; gap: 0.6rem; }
.footer-links a { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid rgba(184,66,31,0.15); color: var(--ink-dim); text-decoration: none; transition: all 0.2s ease; }
.footer-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   REVEAL ANIMATIONS
   ============================================================ */
.reveal { opacity: 0; translate: 0 var(--reveal-offset); transition: opacity var(--reveal-duration) ease, translate var(--reveal-duration) ease; }
.reveal.is-h { translate: 0 1rem; transition-delay: 0.08s; }
.reveal.is-body { transition-delay: 0.2s; }
.reveal.is-stat { transition-delay: 0.3s; }
.reveal.is-cta { transition-delay: 0.35s; }
.reveal.is-line { opacity: 0; scale: 0 1; transition: opacity 0.4s ease, scale 0.4s ease; }
.reveal.visible { opacity: 1; translate: 0 0; scale: 1 1; }

/* ============================================================
   REDUCED MOTION — static fallback
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #scene, #hud, #scene_strip, #face_caption { display: none !important; }
  section.cube-section { min-height: auto; padding: 3rem 1.5rem; justify-content: flex-start !important; }
  .text-card { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg-2); box-shadow: none; max-width: 100%; }
  .reveal { opacity: 1; translate: 0 0; scale: 1 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  #cube { --s: min(80vw, 40vh, 360px); }
  section.cube-section { min-height: 130vh; align-items: flex-end; padding: 0 1.5rem 4rem; flex-direction: column; }
  section.cube-section.card-right { justify-content: flex-end; padding: 0 1.5rem 4rem; }
  .text-card, .text-card.right, .text-card.center { max-width: 100%; padding: 1.5rem 1.25rem; text-align: left; }
  .text-card.right .cta-row, .text-card.right .stat-row { justify-content: flex-start; }
  #hud { top: 4.5rem; right: 1rem; }
  #scene_strip { display: none; }
  #face_caption { bottom: 1rem; }
  .services-grid, .tools-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .site-nav a:not(.nav-cta) { display: none; }
}
