/* ==========================================================================
   Laboratório — grade infinita de projetos pessoais
   Movimento: design.cash.app (arrastar em qualquer direção, inércia, desfoque na velocidade)
   Visual dos cards: curated.supply (cards brancos, objeto centralizado, legenda pequena embaixo)
   Entrada: freshman.tv (rabiscos desenhados à mão que circulam a palavra)
   Usa os tokens do style.css: PP Neue Montreal nos títulos, Inter no texto, margem --pad, gap de 12px.
   ========================================================================== */

.lab-page { --bg: #f2f2f2; --card: #ffffff; --gap: 12px; background: var(--bg); color: var(--ink); overflow: hidden; height: 100svh; overscroll-behavior: none; }
.lab-main { position: relative; height: 100svh; }
.lab-page .bar { transform: translate(-50%, 0); } /* a barra fica sempre visível nesta página */

/* ---------- Grade ---------- */
.lab-canvas {
  position: fixed; inset: 0; overflow: hidden;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.lab-canvas.is-dragging { cursor: grabbing; }
.lab-canvas__layer { position: absolute; inset: 0; }
.lab-cell { position: absolute; left: 0; top: 0; display: grid; place-items: center; will-change: transform; }

/* caixa com a imagem inteira (ref. design.cash.app); hover igual aos projetos da home */
.lab-tile {
  position: relative; display: block; padding: 0; border-radius: 8px; overflow: hidden; background: #e6e6e6; text-align: left;
  transition: transform .7s var(--ease);
}
.lab-tile__media, .lab-tile__media img, .lab-tile__media video { position: absolute; inset: 0; width: 100%; height: 100%; }
.lab-tile__media img, .lab-tile__media video { object-fit: cover; pointer-events: none; -webkit-user-drag: none; transform: scale(1.001); transition: transform 1.1s var(--ease); }
/* véu preto de 60% nos outros projetos (como na home) */
.lab-tile::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: #000; opacity: 0; transition: opacity .5s var(--ease);
}
.lab-canvas.has-hover .lab-tile::after { opacity: .6; }
.lab-canvas.has-hover .lab-tile.is-hover::after { opacity: .45; }
.lab-tile:focus-visible::after { opacity: .45; }
.lab-canvas.is-intro .lab-tile { transition: none; }
.lab-tile.is-hover .lab-tile__media img, .lab-tile.is-hover .lab-tile__media video { transform: scale(1.06); }

/* setinha branca no canto, aparece no hover */
.lab-tile__arrow {
  position: absolute; z-index: 3; top: clamp(10px, 1vw, 14px); right: clamp(10px, 1vw, 14px); width: 12px; height: 12px;
  display: grid; place-items: center; color: #fff; pointer-events: none;
  opacity: 0; transform: scale(.5); transition: transform .6s var(--ease), opacity .4s var(--ease);
}
.lab-tile__arrow svg { width: 10px; height: 10px; }
.lab-tile.is-hover .lab-tile__arrow, .lab-tile:focus-visible .lab-tile__arrow { opacity: 1; transform: none; }

/* nome em cima, categoria e ano embaixo, em branco sobre a imagem (como nos cards da home) */
.lab-tile__cap { position: absolute; z-index: 2; inset: clamp(14px, 1.2vw, 18px); display: flex; flex-direction: column; justify-content: space-between; color: #fff; pointer-events: none; }
.lab-tile__title { padding-right: 20px; font: 500 14px/1.2 var(--ui); text-transform: uppercase; letter-spacing: .04em; }
.lab-tile__meta { font: 500 12px/1.2 var(--ui); text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.78); }
.lab-tile__title, .lab-tile__meta { opacity: 0; transition: transform .7s var(--ease), opacity .5s var(--ease); }
.lab-tile__title { transform: translateY(-12px); }
.lab-tile__meta { transform: translateY(12px); transition-delay: .06s; }
.lab-tile.is-hover .lab-tile__title, .lab-tile.is-hover .lab-tile__meta,
.lab-tile:focus-visible .lab-tile__title, .lab-tile:focus-visible .lab-tile__meta { opacity: 1; transform: none; }

/* título e dica ficam só para leitores de tela: a barra fixa já identifica a página */
.lab-hud { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* lista para leitores de tela */
.lab-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Projeto aberto: pop-up (folha clara que sobe sobre a grade) ---------- */
.lab-view { position: fixed; inset: 0; z-index: 95; visibility: hidden; transition: visibility .7s; }
.lab-view.is-open { visibility: visible; }
.lab-view__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .6s var(--ease); cursor: pointer; }
.lab-view.is-open .lab-view__backdrop { opacity: 1; }
.lab-view__sheet {
  position: absolute; inset: 12px; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px;
  background: var(--bg); color: var(--ink);
  transform: translateY(calc(100% + 24px)); transition: transform .8s var(--ease-io);
}
.lab-view.is-open .lab-view__sheet { transform: none; }
.lab-view .lc-gal { padding-top: clamp(16px, 1.6vw, 24px); }
.lab-view__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lab-view .lc-gal__item { height: min(58svh, 40vw); }
.lab-view .lc-story { padding-top: clamp(48px, 5vw, 88px); padding-bottom: clamp(40px, 4vw, 64px); }
.lab-view__foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 24px var(--pad) 28px; border-top: 1px solid var(--line); font: 400 14px/1.2 var(--ui); }
.lab-view__step { color: var(--ink); }
.lab-view__count { color: var(--muted); font-variant-numeric: tabular-nums; }
.lab-view__close { position: absolute; z-index: 3; top: 28px; right: 28px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; transition: background-color var(--fast), opacity .4s; opacity: 0; }
.lab-view.is-open .lab-view__close { opacity: 1; }
.lab-view__close:hover { background: var(--slate); }

/* ---------- Entrada ---------- */
.lab-intro {
  position: fixed; inset: 0; z-index: 100; background: var(--silver); color: #000;
  display: grid; place-items: center; overflow: hidden; cursor: pointer;
}
.no-lab-js .lab-intro { display: none; }
.lab-intro svg { overflow: visible; }
.lab-intro path { fill: none; stroke: #000; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lab-intro__bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lab-intro__mark { position: relative; }
.lab-intro__clip { display: block; overflow: hidden; }
.lab-intro__word { display: block; padding: .04em .06em .08em; font: 500 clamp(48px, 9vw, 132px)/1 var(--display); letter-spacing: -.04em; }
.lab-intro__ring { position: absolute; left: -14%; top: -38%; width: 128%; height: 176%; pointer-events: none; }
.lab-intro__note { position: absolute; font: 600 12px/1.2 var(--ui); letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.lab-intro__note--tl { left: -30%; top: -92%; }
.lab-intro__note--tr { right: -30%; top: -80%; }
.lab-intro__note--bl { left: -26%; bottom: -96%; }
.lab-intro__note--br { right: -32%; bottom: -88%; }

/* ---------- Mobile: a barra vai para baixo, então o título sobe ---------- */
@media (max-width: 860px) {
  .lab-page .bar { transform: none; }
  .lab-view__sheet { inset: 8px 8px 0; border-radius: 14px 14px 0 0; }
  .lab-view__close { top: 20px; right: 20px; }
  .lab-view .lc-gal__item { height: 62vw; }
  .lab-view__foot { padding-bottom: 96px; } /* a barra fica embaixo no celular */
  .lab-intro__note { font-size: 10px; }
  .lab-intro__note--tl { left: -6%; top: -110%; }
  .lab-intro__note--tr { right: -4%; top: -100%; }
  .lab-intro__note--bl { left: -4%; bottom: -110%; }
  .lab-intro__note--br { right: -4%; bottom: -104%; }
}

/* ==========================================================================
   Página de um projeto do laboratório (/lab/nome/) — estrutura ref. wearecollins.com/case-studies
   Mesmo topo e rodapé das páginas de projeto; fundo cinza-claro do laboratório.
   ========================================================================== */
.lc-page { --bg: #f2f2f2; --card: #ffffff; background: var(--bg); }
.lc { padding: clamp(120px, 14vw, 220px) 0 0; }

/* rótulo à esquerda, nome e subtítulo começando em ~42% da largura */
.lc-head, .lc-story { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 12px; padding: 0 var(--pad); }
.lc-head { align-items: start; margin-bottom: clamp(40px, 4.4vw, 64px); }
.lc-head__kicker { grid-column: 1 / 4; justify-self: start; margin-top: .9em; font: 400 14px/1.2 var(--ui); color: var(--slate); }
.lc-head__main { grid-column: 6 / 13; }
.lc-head__title { font: 400 clamp(44px, 5.4vw, 84px)/1 var(--display); letter-spacing: -.035em; }
.lc-head__sub { margin-top: 18px; font: 400 16px/1.35 var(--ui); color: var(--muted); }

/* carrossel: todas as imagens com a mesma altura, largura pela proporção; arrasta com inércia */
.lc-gal { overflow: hidden; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.lc-gal.is-dragging { cursor: grabbing; }
.lc-gal__track { display: flex; gap: 12px; width: max-content; padding: 0 var(--pad); will-change: transform; }
.lc-gal__item { flex: none; height: min(72svh, 50vw); margin: 0; border-radius: 8px; overflow: hidden; background: #e6e6e6; }
.lc-gal__item img, .lc-gal__item video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }

/* informações à esquerda + texto grande à direita */
.lc-story { padding-top: clamp(72px, 8vw, 128px); padding-bottom: clamp(72px, 8vw, 128px); align-items: start; }
.lc-story__meta { grid-column: 3 / 6; display: grid; gap: 22px; margin: .35em 0 0; font: 400 15px/1.35 var(--ui); }
.lc-story__meta dt { color: var(--ink); }
.lc-story__meta dd { margin: 2px 0 0; color: var(--muted); }
.lc-story__meta dd a { color: var(--ink); }
.lc-story__body { grid-column: 6 / 12; }
.lc-story__text { font: 400 clamp(24px, 2.4vw, 38px)/1.2 var(--display); letter-spacing: -.02em; }
.lc-story__text p + p { margin-top: .7em; }
.lc-story__text a { text-decoration: underline; text-underline-offset: .12em; }
/* parágrafos menores, no estilo do texto dos projetos da home (no editor: <p class="lc-small">) */
.lc-story__text .lc-small { max-width: 580px; font: 400 clamp(15px, 1.1vw, 16px)/1.35 var(--ui); letter-spacing: 0; }
.lc-story__text p + .lc-small { margin-top: 1.25em; }
.lc-story__text p:not(.lc-small) + .lc-small { margin-top: 2.2em; }
/* fechado: umas 5 linhas que somem num degradê, como na referência */
.lc-story__body.is-clamped .lc-story__text {
  max-height: 6em; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
}
.lc-story__more {
  display: none; align-items: center; gap: 10px; margin-top: 28px; padding: 11px 18px;
  border: 1px solid #cfcfcf; border-radius: 999px; font: 400 14px/1 var(--ui); color: var(--ink);
  transition: background-color var(--fast), border-color var(--fast), color var(--fast);
}
.lc-story__more svg { width: 9px; height: 9px; }
.lc-story__more:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.lc-story__body.is-clamped .lc-story__more { display: inline-flex; }

/* mais do laboratório: mesmas caixas e o mesmo hover da grade do /lab/ */
.lc-more { padding: 0 var(--pad); }
.lc-more__head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: clamp(20px, 2vw, 32px); }
.lc-more__title { font: 400 clamp(28px, 3vw, 44px)/1 var(--display); letter-spacing: -.025em; }
.lc-more__all { font: 400 14px/1.2 var(--ui); color: var(--slate); }
.lc-more__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lc-more__grid .lab-tile { width: 100%; aspect-ratio: 4 / 5; }
@media (hover: hover) {
  .lc-more__grid:has(.lab-tile:hover) .lab-tile::after { opacity: .6; }
  .lc-more__grid .lab-tile:hover::after { opacity: .45; }
  .lc-more__grid .lab-tile:hover .lab-tile__media img { transform: scale(1.06); }
  .lc-more__grid .lab-tile:hover .lab-tile__arrow, .lc-more__grid .lab-tile:hover .lab-tile__title, .lc-more__grid .lab-tile:hover .lab-tile__meta { opacity: 1; transform: none; }
}
@media (hover: none) { /* no toque, nome e legenda sempre visíveis */
  .lc-more__grid .lab-tile::after { opacity: .35; }
  .lc-more__grid .lab-tile__title, .lc-more__grid .lab-tile__meta, .lc-more__grid .lab-tile__arrow { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .lc-head, .lc-story { display: block; }
  .lc-head__kicker { display: inline-block; margin: 0 0 16px; }
  .lc-gal__item { height: 58vw; }
  .lc-story__meta { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 40px; }
  .lc-more__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
