/* ============================================================
   MARCELO PENNA — Format-style portfolio
   Pure black & white. Edge-to-edge grid. Subtle motion.
   ============================================================ */

:root {
  --bg:        #ffffff;
  --ink:       #111111;
  --ink-soft:  #1a1a1a;
  --muted:     #b8b8b8;
  --paper:     #f4f4f4;
  --gap:       2px;
  --pad:       clamp(1.5rem, 3vw, 2.5rem);
  --sans:      "Hanken Grotesk", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --track:     .22em;
}

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

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  opacity: 0;
  animation: pageIn .6s .05s ease forwards;
}
@keyframes pageIn { to { opacity: 1; } }

a {
  color: inherit;
  text-decoration: none;
  transition: color .35s ease, opacity .35s ease;
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1.4rem, 2.4vw, 2rem) var(--pad);
  background: var(--bg);
  border-bottom: 0;
}

.nav__name,
.nav__links a {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
}

.nav__name { font-weight: 500; }

.nav__links {
  display: flex;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.nav__links a {
  color: var(--muted);
  position: relative;
}
.nav__links a.is-active,
.nav__links a:hover { color: var(--ink); }

/* ============================================================
   HOME — GRID DE FOTOS (edge-to-edge, 2 col)
   ============================================================ */
.work { padding: 0 0 var(--gap); }

/* Masonry — respeita aspect ratio nativo de cada foto */
.grid {
  column-count: 3;
  column-gap: var(--gap);
  width: 100%;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 var(--gap);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  aspect-ratio: var(--ar, 1);
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  cursor: zoom-in;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;

  /* Animação de entrada */
  opacity: 0;
  transform: translateY(28px) scale(.985);
  transition:
    opacity .9s cubic-bezier(.22,.61,.36,1),
    transform 1.1s cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform;
}
.tile.is-in {
  opacity: 1;
  transform: none;
}

/* Sub-elemento background que escala suavemente no hover (ken-burns leve) */
.tile__img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.001);
  transition: transform 1.4s cubic-bezier(.22,.61,.36,1), filter .8s ease;
  will-change: transform;
}
.tile:hover .tile__img {
  transform: scale(1.04);
  filter: brightness(1.03);
}

/* Overlay com título que aparece no hover */
.tile__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}
.tile:hover .tile__overlay { opacity: 1; transform: none; }

.tile__title {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .04em;
}
.tile__meta {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .8;
}

.tile__shield {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ============================================================
   SOBRE
   ============================================================ */
.about {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 8rem) var(--pad) clamp(4rem, 8vh, 6rem);
  display: grid;
  gap: clamp(3rem, 6vh, 5rem);
}

.about__bio p {
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.7;
  max-width: 62ch;
  font-weight: 300;
  color: var(--ink);
}
.about__bio p + p { margin-top: 1.1em; }

.about__h {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 1.4rem;
}

.about__cv ul {
  list-style: none;
  border-top: 1px solid #ececec;
}
.about__cv li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid #ececec;
  font-size: 14px;
  font-weight: 300;
}
.about__cv li span {
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--muted);
}

.about__contact a {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
}
.about__contact a:hover { opacity: .55; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 2.5rem var(--pad);
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer span {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lb {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: #000;
  color: #fff;
  z-index: 1000;
}
.lb[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb::backdrop { background: rgba(0,0,0,1); }

.lb__stage {
  width: min(92vw, 1200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: lbIn .45s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes lbIn {
  from { opacity: 0; transform: scale(.99); }
  to   { opacity: 1; transform: none; }
}

.lb__photo {
  width: 100%;
  height: 78svh;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-user-select: none;
  user-select: none;
}

.lb__caption {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  font-weight: 300;
}
.lb__sep { opacity: .4; }

.lb__close,
.lb__nav {
  position: absolute;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 14px;
  opacity: .55;
  transition: opacity .25s ease;
}
.lb__close:hover, .lb__nav:hover { opacity: 1; }
.lb__close { top: 18px; right: 18px; }
.lb__nav--prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb__nav--next { right: 18px; top: 50%; transform: translateY(-50%); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid { column-count: 2; }
}

@media (max-width: 720px) {
  .nav { padding: 1.1rem var(--pad); }
  .nav__name, .nav__links a { font-size: 11px; letter-spacing: .2em; }
  .nav__links { gap: 1.25rem; }

  .grid { column-count: 1; }

  .about__cv li { grid-template-columns: 64px 1fr; gap: 1rem; }
  .lb__photo { height: 68svh; }
}

/* ============================================================
   IMG PROTECTION
   ============================================================ */
img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
  .tile { opacity: 1; transform: none; }
}
