/* Tokens from Figma: portafolio-2026 */
@font-face {
  font-family: "Kalmansk";
  src: url("assets/Kalmansk-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-bg: #fffffd;
  --color-about-cream: #f0fcdd;
  --color-accent: #96416a;
  --color-hero: rgba(77, 73, 252, 1);
  --color-text: #424940;
  --color-project: #18373d;

  --font-display: "Kalmansk", "Bebas Neue", sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-nav: "Rubik", system-ui, sans-serif;

  --page-max: 1440px;
  --page-gutter: clamp(24px, 5vw, 140px);
  --content-gutter: clamp(24px, 3.2vw, 46px);

  --reveal-duration: 0.9s;
  --reveal-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --header-height: 94px;
  --tab-row-height: 72px;
  --tab-gap: 36px;
  --tab-step: calc(var(--tab-row-height) + var(--tab-gap));
  --grouped-top: clamp(132px, 18vh, 172px);
  --grouped-height: calc(100vh - var(--header-height) - var(--grouped-top) + 96px);
  --expanded-top: 0px;
  --about-height: clamp(440px, 52vw, 750px);
  --about-text-width: min(575px, 39.93vw);
  --about-text-top: 37.736%; /* 337px / 893px from Figma */
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  overflow-x: clip;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--header-height);
  padding: 0 var(--page-gutter);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 200;
}

.social-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.social-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.social-link:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}

.social-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--color-text);
  color: #fff;
  font-family: var(--font-nav);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.social-link[data-tooltip]:hover::after,
.social-link[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.social-link img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  padding: 8px;
  font-family: var(--font-nav);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 48px;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link--active,
.nav-link:hover {
  color: var(--color-accent);
  font-weight: 500;
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  overflow-x: clip;
}

/* ── Hero + About overlay scroll ── */
.intro-scroll {
  position: relative;
  /* Tall runway: hero stays pinned while about scrolls over it */
  min-height: calc(200vh - var(--header-height));
}

.intro-spacer {
  height: clamp(360px, 65vh, 720px);
}

.hero {
  position: sticky;
  top: var(--header-height);
  z-index: 1;
  min-height: calc(100vh - var(--header-height));
  padding: clamp(48px, 12vw, 180px) var(--content-gutter)
    clamp(80px, 12vw, 160px);
  display: flex;
  align-items: flex-start;
  opacity: calc(1 - var(--cover-progress, 0) * 0.6);
  transform: translateY(calc(var(--cover-progress, 0) * -28px));
  will-change: opacity, transform;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 575px;
}

.hero-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(64px, 9vw, 132px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--color-hero);
}

.hero-role {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 96px);
  font-weight: 400;
  line-height: 1;
  color: var(--color-text);
}

.about {
  position: relative;
  z-index: 10;
  min-height: var(--about-height);
  height: var(--about-height);
  background: var(--color-about-cream);
}

.about-shape {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(-1 * clamp(80px, 14vw, 180px));
  pointer-events: none;
  z-index: 0;
}

.about-shape__paper {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.about-shape__paper.is-ready {
  opacity: 1;
}

.about-text {
  position: absolute;
  top: var(--about-text-top);
  left: 50%;
  z-index: 2;
  width: var(--about-text-width);
  margin: 0;
  font-size: clamp(18px, 1.67vw, 24px);
  line-height: 1.667;
  text-align: center;
  color: var(--color-text);
  pointer-events: none;
}

.about-text strong {
  font-weight: 500;
}

/* ── Work ── */
.work {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 0;
}

.work-heading {
  position: absolute;
  top: 16px;
  left: var(--content-gutter);
  z-index: 150;
  opacity: calc(1 - var(--heading-exit, 0));
  transform: translateY(calc(var(--heading-exit, 0) * -120px));
  will-change: opacity, transform;
}

.work-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  line-height: var(--tab-row-height);
  letter-spacing: 0;
  color: var(--color-text);
}

.work-intro {
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: -0.2px;
  color: var(--color-text);
}

/* Scroll track: tall runway drives folder open animation */
.work-scroll {
  position: relative;
  height: 800vh;
}

.work-stage {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  width: 100%;
  overflow: hidden;
}

/* ── Folder cards ── */
.work-card {
  --expand: 0;
  --peel: 0;
  --separate: 0;
  --separation-offset: 0px;
  --expanded-offset: 0px;
  --index: 0;
  --tab-offset: calc(var(--index) * var(--tab-step));

  position: absolute;
  left: calc(var(--content-gutter) * (1 - var(--expand)));
  top: calc(
    (
        var(--grouped-top) + var(--tab-offset) +
          var(--separation-offset) * var(--separate)
      ) *
      (1 - var(--expand)) +
      (var(--expanded-top) + var(--expanded-offset)) * var(--expand) -
      100vh * var(--peel)
  );
  width: calc(
    (100% - var(--content-gutter) * 2) * (1 - var(--expand)) + 100% * var(--expand)
  );
  height: calc(
    var(--grouped-height) * (1 - var(--expand)) +
      (100% - var(--expanded-top)) * var(--expand)
  );
  z-index: calc(10 + var(--index));
  will-change: top, left, width, height;
  pointer-events: none;
}

.work-card.is-active {
  pointer-events: auto;
}

.work-card__folder,
.work-card__panel {
  position: absolute;
  inset: 0;
  border-radius: calc(12px * (1 - var(--expand)));
  overflow: hidden;
}

/* Grouped: SVG folder tabs */
.work-card__folder {
  opacity: calc(1 - var(--expand));
}

.work-card__shape {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.work-card__title {
  position: absolute;
  top: 0;
  left: clamp(24px, 2.8vw, 40px);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 600;
  line-height: var(--tab-row-height);
  color: var(--folder-text-color, var(--color-project));
  opacity: clamp(0, calc(1 - var(--expand) * 2.2222), 1);
}

/* Expanded: fullscreen folder panel (Figma Desktop - 1) */
.work-card__panel {
  background: var(--folder-color);
  opacity: var(--expand);
  border-bottom: 4px solid var(--color-bg);
  padding: 24px var(--content-gutter) var(--content-gutter);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.work-card__panel-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 600;
  line-height: var(--tab-row-height);
  color: var(--folder-text-color, var(--color-project));
  opacity: clamp(0, calc((var(--expand) - 0.55) * 4), 1);
}

.work-card__logo {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

img.work-card__logo {
  display: block;
  object-fit: contain;
}

span.work-card__logo {
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: #fffffd;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.work-card__logo--tend {
  background: #4a9aa9;
}

.work-card__logo--notnoyze {
  background: #d237e7;
}

.work-card__content {
  flex: 0 0 641px;
  width: 100%;
  max-width: 658px;
  height: 641px;
  background: var(--folder-color);
  border-radius: 20px;
  overflow: hidden;
  opacity: clamp(0, calc((var(--expand) - 0.65) * 3), 1);
}

.work-card__content video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: left top;
  background: var(--folder-color);
  border-radius: inherit;
  clip-path: inset(1px round 19px);
}

/* ── Project folder accordion ── */
.work-scroll {
  height: auto !important;
}

.work-stage {
  position: relative;
  top: auto;
  height: auto;
  overflow: visible;
  padding-bottom: 64px;
}

.work-heading {
  position: relative;
  top: auto;
  left: auto;
  margin: 0 var(--content-gutter) 48px;
  opacity: 1;
  transform: none;
}

.work-card {
  --expand: 1;

  position: relative;
  top: auto;
  left: auto;
  width: calc(100% - var(--content-gutter) * 2);
  height: auto;
  min-height: 0;
  margin: 0 var(--content-gutter) 24px;
  background: var(--folder-color);
  border-radius: 16px;
  overflow: hidden;
  pointer-events: auto;
  will-change: auto;
}

.work-card__folder {
  position: relative;
  inset: auto;
  height: var(--tab-row-height);
  opacity: 1;
  transform: none;
  cursor: pointer;
  user-select: none;
  transition:
    height 0.9s var(--reveal-ease),
    opacity 0.35s ease,
    visibility 0s;
}

.work-card__folder:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

.work-card__folder::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 28px;
  color: var(--folder-text-color, var(--color-project));
  font-family: var(--font-body);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-50%);
  transition: transform 0.3s var(--reveal-ease);
}

.work-card.is-open .work-card__folder::after {
  transform: translateY(-50%) rotate(45deg);
}

.work-card.is-open .work-card__folder {
  height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    height 1.1s var(--reveal-ease),
    opacity 0.25s ease,
    visibility 0s linear 0.25s;
}

.work-card__shape {
  display: none;
}

.work-card__title {
  right: 72px;
  opacity: 1;
}

.work-card__panel {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: min(556px, 43.3%) minmax(0, 1fr);
  grid-template-areas: "media details";
  align-items: center;
  column-gap: clamp(80px, 10.28%, 132px);
  height: 0;
  background: transparent;
  border: 0;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  padding: 0 40px;
  row-gap: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    height 0.9s var(--reveal-ease),
    max-height 0.9s var(--reveal-ease),
    opacity 0.45s ease,
    padding 0.9s var(--reveal-ease),
    visibility 0s linear 0.9s;
}

.work-card.is-open .work-card__panel {
  height: 623px;
  max-height: 623px;
  opacity: 1;
  visibility: visible;
  padding: 27px 32px 24px;
  pointer-events: auto;
  transition:
    height 1.1s var(--reveal-ease),
    max-height 1.1s var(--reveal-ease),
    opacity 0.5s ease 0.15s,
    padding 1.1s var(--reveal-ease),
    visibility 0s;
}

.work-card__panel-title {
  display: block;
  margin: 0 0 24px;
  color: var(--folder-text-color, var(--color-project));
  font-size: clamp(40px, 4.45vw, 64px);
  font-weight: 600;
  line-height: 1.1;
  opacity: 1;
}

.work-card__content {
  grid-area: media;
  width: 100%;
  height: auto;
  max-width: 556px;
  max-height: 572px;
  aspect-ratio: 556 / 572;
  opacity: 1;
}

.work-card__details {
  grid-area: details;
  align-self: center;
  color: var(--folder-text-color, var(--color-project));
}

.work-card__details--with-cta {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  padding-top: 32px;
}

.work-card__details p {
  max-width: 390px;
  margin: 0 0 18px;
  font-size: 20px;
  line-height: 1.35;
}

.work-card__cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 32px;
  color: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
}

.work-card__cta svg {
  flex: 0 0 auto;
}

.work-card__cta:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.work-card__cta:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}

.work-card__panel--case-study {
  cursor: none;
}

.work-card__panel--case-study a {
  cursor: pointer;
}

.work-card__panel--case-study:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: -6px;
}

.work-card__lock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px !important;
  font-weight: 600;
  opacity: 0.75;
}

.work-card__lock svg {
  flex: 0 0 auto;
}

.case-study-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(3, 1, 76, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-100px, -100px, 0);
  transition: opacity 0.18s ease;
}

.case-study-cursor.is-visible {
  opacity: 1;
}

.case-study-cursor svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* ── Scroll reveal states ── */
.reveal {
  will-change: transform, opacity;
}

.reveal[data-reveal="fade-up"] {
  opacity: 0;
  transform: translateY(48px);
  transition:
    opacity var(--reveal-duration) var(--reveal-ease),
    transform var(--reveal-duration) var(--reveal-ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal[data-reveal="slide-right"] {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity var(--reveal-duration) var(--reveal-ease),
    transform var(--reveal-duration) var(--reveal-ease);
}

.reveal[data-reveal="card-rise"] {
  opacity: 0;
  transform: translateY(56px) scale(0.985);
  transform-origin: center bottom;
  transition:
    opacity 0.75s var(--reveal-ease),
    transform 0.9s var(--reveal-ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal[data-reveal="uncover"] {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.1s var(--reveal-ease);
}

.reveal[data-reveal="fade-up"].about-text {
  opacity: calc(clamp((var(--cover-progress, 0) - 0.2) / 0.45, 0, 1));
  transform: translateX(-50%)
    translateY(calc((1 - min(var(--cover-progress, 0), 1)) * 24px));
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.reveal.is-visible:not(.about-text) {
  opacity: 1;
  transform: none;
}

.reveal[data-reveal="uncover"].is-visible {
  clip-path: inset(0 0 0 0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  :root {
    --grouped-top: 118px;
    --grouped-height: calc(100vh - var(--header-height) - 64px);
    --expanded-top: 0px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 16px;
  }

  .nav-link {
    line-height: 1.4;
    font-size: 18px;
  }

  .work-card {
    width: calc(100% - 32px);
    margin-right: 16px;
    margin-left: 16px;
  }

  .work-card__panel,
  .work-card.is-open .work-card__panel {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .work-scroll {
    height: auto !important;
  }

  .work-stage {
    position: relative;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 48px;
  }

  .work-card {
    position: relative;
    top: auto !important;
    left: auto !important;
    width: calc(100% - var(--content-gutter) * 2) !important;
    height: auto !important;
    min-height: 0;
    --expand: 1;
    --peel: 0;
    pointer-events: auto;
  }

  .work-card__folder {
    display: block;
  }

  .work-card__panel {
    max-height: 0;
    min-height: 0;
    opacity: 0;
    position: relative;
    transition: none;
  }

  .work-card.is-open .work-card__panel {
    max-height: 760px;
    opacity: 1;
    transition: none;
  }

  .reveal[data-reveal="fade-up"].about-text {
    transform: translateX(-50%);
  }

  .hero {
    position: relative;
    opacity: 1;
    transform: none;
  }

  .intro-spacer {
    height: 0;
  }

  .about {
    margin-top: 0;
  }

  .reveal,
  .reveal[data-reveal="fade-up"],
  .reveal[data-reveal="slide-right"],
  .reveal[data-reveal="uncover"] {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }
}
