@import url('./fonts.css');

/* ---------------------------------------------------------------------------
   Caio Buni — portfólio
   Reconstrução própria do layout de duas colunas (sidebar + conteúdo).
   Tipografia: Archivo (títulos) e Inter (interface/texto), ambas SIL OFL.
--------------------------------------------------------------------------- */

:root {
  --ink: #222;
  --muted: #999;
  --faint: #ddd;
  --bg: #fff;
  --rule: #eee;

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --ui: 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --site-max: 1400px;
  --sidebar: 25%;
  --content-max: 800px;
  --grid-gap: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { border: 0; max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- shell ---------------------------------------------------------------- */

.site {
  max-width: var(--site-max);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  align-self: stretch;
}

.content { flex: 1 1 auto; min-width: 0; }

/* --- sidebar -------------------------------------------------------------- */

.site-header { padding: 50px 0; text-align: center; }

.logo a {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 30px;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.site-nav { width: 80%; margin: 0 auto; text-align: center; }
.site-nav ul { list-style: none; margin: 0; padding: 0 0 40px; }

.site-nav .gallery-title { padding: 0 0 20px; }
.site-nav .gallery-title a {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  line-height: 14px;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.site-nav .project-title { padding: 0 0 10px; }
.site-nav .project-title a,
.site-nav .page-title a {
  font-family: var(--ui);
  font-size: 16px;
  line-height: 20px;
  color: var(--muted);
  transition: color 0.2s;
}

.site-nav .page-title { padding: 0 0 20px; }

.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--ink); }

/* --- page header ---------------------------------------------------------- */

.page-header {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 70px 0;
  text-align: center;
}

.page-header h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 50px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  padding: 0 0 20px;
  letter-spacing: 0.01em;
}

.page-header .description {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.page-header:empty, .page-header.is-bare { padding: 40px 0 0; }

/* --- modules -------------------------------------------------------------- */

.module { padding: 0 0 40px; }

.module-text {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 0 40px;
  color: var(--ink);
}
.module-text a { text-decoration: underline; }
.module-text div:empty { min-height: 1em; }

.module-image { padding: 0 0 40px; }
.module-image figure { margin: 0; }
.module-image img { margin: 0 auto; }

.module-embed { padding: 0 0 40px; }
.module-embed .module-caption,
.module-image figcaption {
  max-width: var(--content-max);
  margin: 20px auto 0;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
}
.module-embed .embed-frame {
  margin: 0 auto;
  position: relative;
  width: 100%;
  background: #000;
}
.module-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- justified image grid ------------------------------------------------- */

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--grid-gap);
}
/* soaks up the leftover space so the last row keeps a sane height */
.grid::after { content: ''; flex-grow: 1000000; }

.grid-item {
  position: relative;
  display: block;
  flex-grow: var(--ar, 1);
  flex-basis: calc(var(--ar, 1) * 180px);
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.03);
  cursor: zoom-in;
}
.grid-item::before { content: ''; display: block; padding-bottom: calc(100% / var(--ar, 1)); }
.grid-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- gallery covers ------------------------------------------------------- */

.covers { display: flex; flex-wrap: wrap; }

.cover {
  position: relative;
  display: block;
  width: 50%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }

.cover .details {
  position: absolute;
  inset: 5%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 5%;
  background: rgba(255, 255, 255, 0.9);
  opacity: 0;
  transition: opacity 0.15s;
  text-align: center;
}
.cover:hover .details,
.cover:focus-visible .details { opacity: 1; }

/* projects with no cover art keep their label visible so the tile isn't blank */
.cover.is-blank { background: #f6f6f6; }
.cover.is-blank .details { opacity: 1; background: transparent; }

.cover .date {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  padding: 0 0 20px;
}
.cover .title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 50px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ink);
}

/* --- back to top + footer ------------------------------------------------- */

.back-to-top {
  padding: 60px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.back-to-top a { display: inline-block; }
.back-to-top a:hover { color: var(--ink); }
.back-to-top .arrow { display: block; font-size: 18px; line-height: 1.4; }

.site-footer {
  padding: 60px 0;
  text-align: center;
  font-size: 13px;
  line-height: 19px;
  color: var(--faint);
}
.site-footer a:hover { color: var(--muted); }

/* --- lightbox ------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox[open], .lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 28px;
  line-height: 1;
  padding: 16px 20px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.lightbox button:hover { opacity: 1; }
.lightbox .lb-close { top: 8px; right: 8px; font-size: 32px; }
.lightbox .lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
body.lb-locked { overflow: hidden; }

/* --- mobile --------------------------------------------------------------- */

.nav-toggle {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: 56px;
  height: 56px;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px auto;
  background: var(--ink);
  transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .site { display: block; }

  .nav-toggle { display: block; }

  .sidebar {
    width: 100%;
    flex: none;
  }

  .site-header { padding: 26px 0 18px; }
  .logo a { font-size: 24px; }

  .site-nav {
    display: none;
    width: 100%;
    padding: 10px 0 30px;
    border-bottom: 1px solid var(--rule);
  }
  body.nav-open .site-nav { display: block; }

  .page-header { padding: 40px 16px; }
  .page-header h1 { font-size: 32px; }

  .module-text { padding: 16px 16px 30px; }
  .module-image, .module-embed { padding: 0 16px 30px; }

  .cover { width: 100%; }
  .cover .title { font-size: 32px; }
  .cover .date { font-size: 16px; padding-bottom: 12px; }

  .grid-item { flex-basis: calc(var(--ar, 1) * 130px); }

  .back-to-top, .site-footer { padding: 40px 16px; }
}

@media (min-width: 901px) {
  .site-nav { display: block !important; }
}
