/* ---------- Fonts ---------- */
@font-face {
  font-family: "ABC Diatype";
  src: url("../fonts/ABCDiatype-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Diatype";
  src: url("../fonts/ABCDiatype-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Diatype";
  src: url("../fonts/ABCDiatype-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Diatype";
  src: url("../fonts/ABCDiatype-black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 420px;
  --grid-gap: 16px;
  --text: #111111;
  --muted: #6b6b6b;
  --bg: #ffffff;
  --overlay-bg: rgba(255, 255, 255, 0.97);
  --border: #e6e6e6;
  --font: "ABC Diatype", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
}

img { display: block; max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Desktop sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid transparent;
  line-height: 1.2;
}

.brand {
  display: block;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-decoration: none;
  margin-bottom: 1em;
  font-size: 14px;
}

.project-nav {
  margin-bottom: 2em;
}

.project-nav ol {
  list-style: none;
  counter-reset: none;
}

.project-nav li {
  margin-bottom: 0;
}

.project-nav a {
  text-decoration: underline;
  font-size: 14px;
}

.project-nav a.active {
  font-weight: 700;
}

.infos {
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.infos-label {
  font-weight: 900;
  margin-bottom: 1em;
  letter-spacing: 0.02em;
}

.infos a {
  text-decoration: underline;
  margin-bottom: 0;
}

/* Mobile topbar, hidden on desktop */
.mobile-topbar {
  display: none;
}

/* Content area */
.content {
  flex: 1;
  min-width: 0;
}

/* ---------- Home grid ---------- */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid-gap);
  padding: 16px;
}

.cover {
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Project page ---------- */
.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 16px 0;
  line-height: 1.2;
}

.project-title {
  font-weight: 400;
}

.title-break {
  display: none;
}

.mobile-projects-link {
  display: none;
}

.home-link {
  text-decoration: underline;
}

.project-images {
  display: flex;
  flex-direction: column;
  padding-right: 16px;
}

.project-row {
  display: grid;
  gap: var(--grid-gap);
  margin-bottom: var(--grid-gap);
}

.project-row:last-child {
  margin-bottom: 0;
}

.project-row.grid-1 { grid-template-columns: 1fr; }
.project-row.grid-2 { grid-template-columns: 1fr 1fr; }
.project-row.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.project-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Scroll reveal (project image grids only) ---------- */
.project-row img {
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.project-row img.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .project-row img {
    transition: none;
    opacity: 1;
  }
}

.project-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 16px 16px 32px 0;
}

.credits p {
  margin-bottom: 4px;
}

.descriptions .lang-label {
  font-weight: 700;
  margin: 16px 0 8px;
}

.descriptions .lang-label:first-child {
  margin-top: 0;
}

.descriptions p {
  margin-bottom: 12px;
}

/* ---------- Overlays: Sobre mim / Contato ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.scrim.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--overlay-bg);
  padding: 16px;
  transform: translateX(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  line-height: 1.2;
  overflow-y: auto;
}

.overlay.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1em;
}

.overlay-head .brand {
  font-weight: 900;
  font-size: 14px;
  margin-bottom: 0;
}

.overlay-title {
  font-weight: 900;
  font-size: 14px;
}

.overlay-head a[data-overlay-close],
.overlay-head a[data-menu-close] {
  line-height: 1;
}

.overlay-body .lang-label {
  font-weight: 700;
  margin: 16px 0 8px;
}

.overlay-body .lang-label:first-child {
  margin-top: 0;
}

.overlay-body p {
  margin-bottom: 12px;
}

.contact-list {
  list-style: none;
}

.contact-list li {
  margin-bottom: 0;
}

.contact-list a {
  text-decoration: underline;
}

/* ---------- Mobile menu (Projetos) ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--bg);
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 60;
  overflow-y: auto;
  line-height: 1.2;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

/* ==================================================
   Mobile
   ================================================== */
@media (max-width: 860px) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
    position: sticky;
    top: 0;
    background: var(--bg);
    padding: 16px 20px;
    z-index: 30;
    border-bottom: 1px solid var(--border);
  }

  .mobile-topbar .brand {
    margin-bottom: 0;
  }

  .mobile-topbar-links {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
  }

  .mobile-topbar-links a {
    text-decoration: underline;
    white-space: nowrap;
  }

  .layout {
    flex-direction: column;
  }

  .content {
    width: 100%;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.project-page .mobile-topbar {
    display: none;
  }

  .project-header {
    padding: 16px 20px;
    align-items: flex-start;
  }

  .project-title {
    flex: 1;
    min-width: 0;
    margin-right: 16px;
  }

  .title-break {
    display: inline;
  }

  .mobile-projects-link {
    display: inline;
    text-decoration: underline;
    flex-shrink: 0;
    margin-right: 16px;
  }

  .home-link {
    flex-shrink: 0;
  }

  .project-images {
    padding-right: 0;
  }

  .project-row {
    gap: 8px;
    margin-bottom: 8px;
  }

  .project-footer {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px;
  }

  .overlay {
    width: 100%;
  }
}
