/* =========================================================
   IGNASI FERRÚS — PRODUCTION PORTFOLIO
   Tokens: negro/blanco + acento azul (de las gafas del logo)
   ========================================================= */

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

:root{
  --ink:        #0f0f10;
  --paper:      #fbfbfa;
  --paper-2:    #f1f1ef;
  --line:       #e2e2df;
  --line-dark:  #2a2a2c;
  --accent:     #155efc;
  --accent-2:   #35c3ff;
  --accent-dark:#0a2fa8;
  --accent-soft:#eaf2ff;
  --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --accent-gradient-deep: linear-gradient(150deg, var(--accent-dark) 0%, var(--accent) 55%, var(--accent-2) 100%);
  --muted:      #6b6b68;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);

  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 10px;

  --nav-h: 104px;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
html, body{
  overflow-x:hidden;
  width:100%;
  max-width:100%;
}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:16px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
img{max-width:100%;display:block;}
a{color:inherit;}
h1,h2,h3,h4{
  font-family:var(--font-display);
  font-weight:600;
  margin:0;
  letter-spacing:-0.01em;
}
p{margin:0;}
.wrap{max-width:var(--maxw); margin:0 auto; padding:0 var(--gutter);}

::selection{background:var(--accent); color:#fff;}

.hl{ color:var(--accent); font-weight:600; }

/* Focus visibility */
a:focus-visible, button:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px;
}

/* =====================  NAV  ===================== */
.site-nav{
  position:sticky; top:0; z-index:50;
  background:var(--accent-gradient-deep);
  box-shadow:0 8px 30px rgba(10,47,168,.25);
}
.site-nav .wrap{
  display:flex; align-items:center; justify-content:space-between;
  height:var(--nav-h);
}
.nav-brand{
  display:flex; align-items:center; gap:16px;
  text-decoration:none; color:#fff;
}
.nav-brand img{width:76px; height:76px; object-fit:contain; flex:none;}
.nav-brand-text{ display:flex; flex-direction:column; line-height:1.2; }
.nav-name{
  font-family:var(--font-display); font-weight:600; font-size:1.3rem;
  color:#fff;
}
.nav-role{
  font-family:var(--font-body); font-weight:600; font-size:.76rem;
  letter-spacing:.05em; text-transform:uppercase; color:rgba(255,255,255,.82);
  margin-top:3px;
}

/* Glass nav pill — no hard border, soft frosted look */
.nav-links{
  position:relative;
  display:flex; align-items:center; gap:2px; list-style:none;
  margin:0; padding:6px;
  background:rgba(255,255,255,.12);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  border-radius:999px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25), 0 10px 26px rgba(3,11,60,.2);
}
.nav-links a{
  position:relative;
  text-decoration:none;
  font-size:.9rem;
  font-weight:500;
  color:rgba(255,255,255,.78);
  padding:10px 22px;
  border-radius:999px;
  transition:color .35s cubic-bezier(.65,0,.35,1), background .35s cubic-bezier(.65,0,.35,1);
  white-space:nowrap;
  display:inline-block;
}
.nav-links a:hover{ color:#fff; background:rgba(255,255,255,.16); }
.nav-links a.active{color:var(--accent-dark); background:#fff;}
.nav-links a.active:hover{ background:#fff; }
.nav-toggle{display:none;}

@media (max-width: 720px){
  .nav-links{
    position:fixed; inset:calc(var(--nav-h) + 10px) 16px auto 16px;
    background:var(--accent-dark);
    backdrop-filter:none;
    flex-direction:column; gap:4px; padding:10px;
    border-radius:26px;
    transform:translateY(-8px); opacity:0; pointer-events:none;
    transition:opacity .2s ease, transform .2s ease;
    box-shadow:0 20px 50px rgba(0,0,0,.25);
  }
  .nav-links.open{opacity:1; pointer-events:auto; transform:translateY(0);}
  .nav-links a{display:block; padding:14px 18px; font-size:1rem; border-radius:16px;}
  .nav-toggle{
    display:flex; flex-direction:column; gap:5px; background:none; border:none; cursor:pointer; padding:8px;
  }
  .nav-toggle span{width:22px; height:2px; background:#fff; display:block;}
}

/* =====================  HERO CAROUSEL (coverflow)  ===================== */
.hero-carousel{
  padding: 40px 0 0;
  width:100vw;
  position:relative;
  left:50%;
  margin-left:-50vw;
  overflow:hidden;
}
.hc-stage{
  position:relative;
  width:100%;
  height:clamp(280px, 38vw, 480px);
  overflow:hidden;
  -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image:linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.hc-slide{
  position:absolute;
  top:0; left:50%;
  width:min(46%, 780px);
  height:100%;
  border-radius:var(--radius-lg);
  overflow:hidden;
  cursor:pointer;
  will-change:transform, opacity;
  transition:transform .9s cubic-bezier(.65,0,.35,1), opacity .9s ease, filter .9s ease;
  box-shadow:0 20px 50px rgba(15,15,16,.18);
}
.hc-slide img:not(.hc-logo-corner):not(.hc-logo){
  width:100%; height:100%; object-fit:cover;
  position:relative;
  z-index:0;
  transition:transform .6s ease, filter .5s ease;
}
/* Hover effects (darken/blur/logo) only ever trigger on the active, centered slide */
.hc-slide.hc-active:hover img:not(.hc-logo-corner):not(.hc-logo){ transform:scale(1.05); filter:blur(4px) brightness(.5); }

.hc-scrim{
  position:absolute; inset:0;
  z-index:1;
  background:linear-gradient(to top, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 38%);
  pointer-events:none;
  transition:background .5s ease;
}
.hc-slide.hc-active:hover .hc-scrim{
  background:linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,.15) 100%);
}

/* Small logo, always visible in the corner — hides on hover of the active slide */
.hc-logo-corner{
  position:absolute; left:20px; bottom:20px;
  z-index:3;
  max-width:120px;
  max-height:50px;
  width:auto; height:auto;
  object-fit:contain;
  opacity:1;
  transform:translateY(0);
  filter:drop-shadow(0 4px 14px rgba(0,0,0,.55));
  pointer-events:none;
  transition:opacity .35s ease, transform .35s ease;
}
.hc-slide.hc-active:hover .hc-logo-corner{ opacity:0; }

/* Big logo, appears centered and large only when hovering the active slide.
   z-index kept above the scrim/blur so it never renders underneath them. */
.hc-logo{
  position:absolute; left:50%; top:50%;
  z-index:2;
  max-width:75%;
  max-height:60%;
  width:auto; height:auto;
  object-fit:contain;
  transform:translate(-50%,-50%) scale(.82);
  opacity:0;
  filter:drop-shadow(0 6px 20px rgba(0,0,0,.6));
  pointer-events:none;
  transition:transform .55s cubic-bezier(.65,0,.35,1), opacity .5s ease;
}
.hc-slide.hc-active:hover .hc-logo{ opacity:1; transform:translate(-50%,-50%) scale(1); }

/* First paint: slides jump straight into their coverflow position, no fly-in animation */
.hc-slide.no-transition{ transition:none !important; }
.hero-carousel{
  opacity:0;
  animation:hc-fade-in .5s ease forwards;
  animation-delay:.05s;
}
@keyframes hc-fade-in{ to{ opacity:1; } }

@media (max-width:720px){
  .hc-stage{ height:clamp(220px, 66vw, 320px); }
  .hc-slide{ width:78%; }
  .hc-logo{ max-width:70%; max-height:46%; }
  .hc-logo-corner{ left:12px; bottom:12px; max-width:82px; max-height:34px; }
}

.hc-info{
  text-align:center;
  margin-top:24px;
}
.hc-info-title{
  font-family:var(--font-display); font-weight:600; font-size:1.1rem;
  display:block;
}
.hc-info-role{
  color:var(--muted); font-size:.88rem; display:block; margin-top:2px;
}

.hc-controls{
  display:flex; align-items:center; justify-content:center; gap:18px;
  margin-top:16px; padding-bottom:8px;
}
.hc-dots{ display:flex; gap:8px; }
.hc-dots button{
  width:8px; height:8px; border-radius:50%; border:1px solid var(--line);
  background:var(--paper-2); cursor:pointer; padding:0; transition:all .2s ease;
}
.hc-dots button.active{background:var(--accent-gradient); border-color:var(--accent); width:20px; border-radius:5px;}

/* =====================  SECTION / DIVIDER  ===================== */
.section{ padding: clamp(64px, 9vw, 120px) 0; }
.section-intro{
  max-width:640px; margin-bottom:3rem;
}
.section-intro .eyebrow{
  color:var(--accent); font-weight:600; font-size:.9rem; margin-bottom:.4rem; display:block;
}
.section-intro h2{ font-size:clamp(1.7rem, 3vw, 2.3rem); }

.project-divider{
  display:flex; align-items:center; gap:24px;
  margin: 110px 0 56px;
}
.project-divider img{
  width:240px; height:240px; object-fit:contain; flex:none;
  filter:brightness(0);
  opacity:.9;
}
.project-divider .pd-line{
  flex:1; height:1px; background:var(--line);
}
.project-divider .pd-title{
  font-family:var(--font-display); font-weight:600; font-size:1.15rem;
  white-space:nowrap;
}
.project-divider .pd-role{
  color:var(--muted); font-size:.9rem; white-space:nowrap;
}

@media (max-width:640px){
  .project-divider{ flex-wrap:wrap; row-gap:14px; margin:80px 0 40px; }
  .project-divider img{ width:140px; height:140px; }
  .project-divider .pd-line{ order:3; flex:1 1 100%; }
  .project-divider .pd-role{ white-space:normal; font-size:.82rem; }
} 

/* =====================  BREAKDOWN BLOCKS  ===================== */
.breakdown{
  display:grid; gap:56px;
}
.bd-row{
  display:grid; grid-template-columns: 1.05fr 0.95fr; gap:56px; align-items:center;
}
.bd-row.reverse{ grid-template-columns: 0.95fr 1.05fr; }
.bd-row.reverse .bd-media{ order:2; }
.bd-row.reverse .bd-text{ order:1; }

.bd-row.stacked{ grid-template-columns:1fr; }
.bd-row.stacked .bd-media{margin-bottom:8px;}

.bd-text .bd-kicker{
  font-size:.8rem; letter-spacing:.03em; color:var(--accent); font-weight:600; margin-bottom:.5rem; display:block;
}
.bd-text h3{ font-size:1.4rem; margin-bottom:.7rem; }
.bd-text p{ color:#333; font-size:.98rem; }
.bd-text p + p{margin-top:.7rem;}

.bd-media{
  border-radius:var(--radius);
  border:0px solid var(--line);
}
.bd-media img, .bd-media .lb-trigger img{
  cursor:zoom-in;
  display:block;
  width:100%;
  border-radius:var(--radius);
  transition:transform .5s cubic-bezier(.65,0,.35,1);
}
.bd-media:hover img{ transform:scale(1.045); }

@media (max-width:860px){
  .bd-row, .bd-row.reverse{ grid-template-columns:1fr; }
  .bd-row.reverse .bd-media{order:1;} .bd-row.reverse .bd-text{order:2;}
}

/* Mini carousel for grouped shots (e.g. ShotGrid views) — crossfade, bulletproof
   Height is driven by each image's real intrinsic ratio via JS (padding-bottom trick),
   so it's never a guessed/fixed aspect ratio and never shows letterbox bars. */
.mini-carousel{ position:relative; }
.mc-stage{
  position:relative;
  width:100%;
  height:0;
  padding-bottom:52%; /* fallback until JS measures the first image */
  border-radius:var(--radius);
  overflow:hidden;
  transition:padding-bottom .45s cubic-bezier(.65,0,.35,1);
}
.mc-slide{
  position:absolute; inset:0;
  opacity:0; visibility:hidden;
  transition:opacity .45s ease, visibility .45s;
  z-index:1;
}
.mc-slide.active{ opacity:1; visibility:visible; z-index:2; }
.mc-slide img{
  position:absolute; inset:0;
  width:100%; height:100%; object-fit:contain;
  cursor:zoom-in; display:block;
}
.mc-nav{
  display:flex; justify-content:center; align-items:center; margin-top:10px;
}
.mc-tabs{
  display:inline-flex; gap:2px; flex-wrap:wrap;
  background:var(--ink); border-radius:999px; padding:5px;
}
.mc-tabs button{
  border:none; background:transparent; color:rgba(255,255,255,.6);
  font-family:var(--font-body); font-size:.76rem; font-weight:500;
  padding:7px 15px; border-radius:999px;
  cursor:pointer; transition:all .25s cubic-bezier(.65,0,.35,1);
}
.mc-tabs button.active{ background:#fff; color:var(--ink); }

/* =====================  CHALLENGES  ===================== */
.challenges{ margin-top:24px; }
.challenges-head{ margin-bottom:2.2rem; }
.challenges-head h3{ font-size:1.5rem; margin-top:.3rem; }
.ch-carousel{
  display:flex; flex-direction:column;
}
.ch-item{
  position:relative;
  display:flex; flex-direction:row; align-items:center; gap:28px;
  padding:26px 8px;
  border-bottom:1px solid var(--line);
  transition:background .3s ease, padding-left .3s ease;
}
.ch-item:first-child{ border-top:1px solid var(--line); }
.ch-item::before{
  content:'';
  position:absolute; left:0; top:0; bottom:0; width:3px;
  background:var(--accent-gradient);
  opacity:0;
  transition:opacity .3s ease;
}
.ch-item:hover{
  background:rgba(10,47,168,.03);
  padding-left:20px;
}
.ch-item:hover::before{ opacity:1; }
.ch-item .ch-num{
  font-family:var(--font-display); font-weight:700; font-size:1.7rem;
  line-height:1;
  background:var(--accent-gradient);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  flex:0 0 auto;
  min-width:56px;
}
.ch-item p{ color:#333; font-size:.98rem; line-height:1.55; margin:0; }

.ch-controls{ display:none; }

@media (max-width:720px){
  .ch-item{ align-items:flex-start; gap:16px; padding:20px 4px; }
  .ch-item .ch-num{ font-size:1.4rem; min-width:40px; }
}

/* =====================  CTA BAND  ===================== */
.cta-band{
  display:flex; gap:16px; flex-wrap:wrap; justify-content:center;
  padding: 56px var(--gutter) 80px;
  border-top:1px solid var(--line);
  margin-top:40px;
}
.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:13px 28px; border-radius:999px;
  font-family:var(--font-body); font-weight:600; font-size:.92rem;
  text-decoration:none; cursor:pointer; border:1px solid var(--ink);
  transition:all .15s ease;
}
.btn-primary{ background:var(--ink); color:#fff; }
.btn-primary:hover{ background:var(--accent-gradient); border-color:var(--accent); }
.btn-outline{ background:transparent; color:var(--ink); }
.btn-outline:hover{ background:var(--ink); color:#fff; }
.btn-accent{ background:var(--accent-gradient); border-color:var(--accent); color:#fff; }
.btn-accent:hover{ background:var(--accent-gradient-deep); border-color:var(--accent-dark); }

/* =====================  FOOTER  ===================== */
.site-footer{
  padding:52px var(--gutter);
  background:var(--accent-gradient-deep);
  color:#fff;
}
.footer-inner{
  max-width:var(--maxw); margin:0 auto;
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:20px;
}
.footer-brand{ display:flex; align-items:center; gap:10px; }
.footer-brand img{width:30px; height:30px; object-fit:contain;}
.footer-brand span{ font-family:var(--font-display); font-weight:600; font-size:.95rem; color:#fff; }
.footer-meta{ font-size:.82rem; color:rgba(255,255,255,.75); }
.footer-socials{ display:flex; gap:10px; }
.footer-socials a{
  width:38px; height:38px; border-radius:50%; border:1px solid rgba(255,255,255,.35);
  display:flex; align-items:center; justify-content:center;
  text-decoration:none; color:#fff;
  transition:all .15s ease;
}
.footer-socials a:hover{ background:#fff; border-color:#fff; color:var(--accent-dark); }
.footer-socials svg{ width:17px; height:17px; }

/* =====================  BACK TO TOP  ===================== */
.back-to-top{
  position:fixed; right:22px; bottom:22px; z-index:60;
  width:46px; height:46px; border-radius:50%;
  background:var(--ink); color:#fff; border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transform:translateY(8px);
  transition:opacity .2s ease, transform .2s ease, background .15s ease;
  box-shadow:0 10px 30px rgba(0,0,0,.2);
}
.back-to-top.visible{ opacity:1; pointer-events:auto; transform:translateY(0); }
.back-to-top:hover{ background:var(--accent); }

/* =====================  TOAST  ===================== */
.toast{
  position:fixed; top:20px; right:20px; z-index:200;
  background:var(--ink); color:#fff;
  font-family:var(--font-body); font-weight:600; font-size:.88rem;
  padding:13px 20px; border-radius:12px;
  box-shadow:0 14px 40px rgba(0,0,0,.28);
  display:flex; align-items:center; gap:8px;
  transform:translateY(-14px); opacity:0; pointer-events:none;
  transition:transform .3s cubic-bezier(.65,0,.35,1), opacity .3s ease;
}
.toast::before{
  content:'✓';
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px; border-radius:50%;
  background:var(--accent); font-size:.7rem;
}
.toast.visible{ transform:translateY(0); opacity:1; }

/* =====================  LIGHTBOX  ===================== */
.lightbox{
  position:fixed; inset:0; background:rgba(10,10,11,.94);
  display:flex; align-items:center; justify-content:center;
  z-index:100; opacity:0; pointer-events:none; transition:opacity .2s ease;
  padding:40px;
}
.lightbox.open{ opacity:1; pointer-events:auto; }
.lightbox img{ max-width:100%; max-height:88vh; border-radius:var(--radius); }
.lightbox-close{
  position:absolute; top:24px; right:28px; background:none; border:none;
  color:#fff; font-size:2rem; cursor:pointer; line-height:1;
}

/* =====================  PAGE HERO (Resume/About)  ===================== */
.page-hero{
  padding: clamp(64px,9vw,110px) 0 20px;
}
.page-hero h1{ font-size:clamp(2rem,4.5vw,3rem); }
.page-hero .sub{ color:var(--muted); margin-top:.8rem; max-width:560px; }

/* Sticky title used on About page */
.sticky-title{
  position:sticky; top:var(--nav-h); z-index:20;
  background:rgba(251,251,250,.92);
  backdrop-filter:blur(10px);
  padding:18px 0;
  border-bottom:1px solid var(--line);
}
.sticky-title h1{ font-size:clamp(1.5rem,3vw,2rem); }

/* =====================  RESUME PAGE  ===================== */
.resume-frame-wrap{
  border:1px solid var(--line);
  background:#fff;
  box-shadow:0 20px 60px rgba(0,0,0,.08);
  border-radius:var(--radius);
  overflow:hidden;
}
.resume-frame-wrap iframe{ width:100%; height:82vh; border:none; display:block; }
.resume-actions{
  display:flex; justify-content:center; margin-top:28px;
}

/* =====================  ABOUT PAGE  ===================== */
.about-grid{
  display:grid; grid-template-columns: 0.85fr 1.15fr; gap:64px; align-items:start;
}
.about-photo{
  position:sticky; top:calc(var(--nav-h) + 20px);
}
.about-photo img{
  width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:var(--radius-lg);
  border:1px solid var(--line);
}
.about-text h2{ font-size:1.7rem; margin-bottom:1.2rem; }
.about-text p{ color:#333; margin-bottom:1rem; font-size:1.02rem; }
.about-facts{
  display:grid; grid-template-columns:repeat(2,1fr); gap:20px 32px;
  margin:2rem 0; padding:1.6rem 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line);
}
.about-facts dt{ font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); margin-bottom:.25rem; }
.about-facts dd{ margin:0; font-weight:500; }

.about-block{ margin-top:2.4rem; }
.about-block > .bd-kicker{ margin-bottom:.8rem; }

.about-tools{ display:flex; flex-wrap:wrap; gap:10px; margin-top:1rem; }
.about-tools span{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--line); background:#fff; border-radius:999px; padding:7px 14px 7px 8px; font-size:.85rem; color:#333;
}
.tool-icon{
  width:24px; height:24px; border-radius:6px;
  object-fit:contain; background:#fff;
  flex:none; display:block;
}

.skills-grid{
  display:grid; grid-template-columns:repeat(2,1fr); gap:14px 24px; margin-top:1rem;
}
.skill-item{ display:flex; flex-direction:column; gap:6px; }
.skill-item-head{ display:flex; justify-content:space-between; align-items:center; }
.skill-item-head span{ font-size:.92rem; font-weight:500; }
.skill-dots{ display:flex; gap:4px; }
.skill-dots i{
  width:7px; height:7px; border-radius:50%; background:var(--line); display:block;
}
.skill-dots i.filled{ background:var(--accent); }

.accomplishments{
  display:grid; grid-template-columns:repeat(2,1fr); gap:16px; margin-top:1rem;
}
.acc-item{
  display:flex; gap:14px; align-items:flex-start;
  border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; background:#fff;
}
.acc-icon{
  width:34px; height:34px; border-radius:50%; flex:none;
  background:var(--accent-soft); color:var(--accent);
  display:flex; align-items:center; justify-content:center;
}
.acc-icon svg{ width:17px; height:17px; }
.acc-item p{ font-size:.9rem; color:#333; line-height:1.45; }

.about-contact-btn{ margin-top:2rem; }

@media (max-width:860px){
  .about-grid{ grid-template-columns:1fr; }
  .about-photo{ position:static; max-width:320px; }
  .skills-grid, .accomplishments{ grid-template-columns:1fr; }
}
