/* ---------- Design tokens ---------- */
:root {
  color-scheme: dark;
  --color-bg: #0a0a0a;
  --color-bg-tile: #111111;
  --color-fg: #f2efe9;
  --color-muted: #9a9a94;
  --color-border: rgba(255, 255, 255, 0.08);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 64px;
  --grid-gap: 4px;
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-ui);
  line-height: 1.5;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

.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;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}

.logo img {
  height: 28px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: currentColor;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-fg);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    transition: max-height 0.3s ease;
  }

  .site-nav.is-open {
    max-height: 320px;
  }

  .site-nav a {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
  }
}

/* ---------- Hero ---------- */
.hero {
  background: var(--color-bg);
}

.hero-image {
  width: 100%;
  height: auto;
}

/* ---------- Work grid ---------- */
.work-grid-section {
  background: var(--color-bg);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
  padding: var(--grid-gap);
}

@media (max-width: 720px) {
  .work-grid {
    grid-template-columns: 1fr;
  }
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--color-bg-tile);
  border: none;
  padding: 0;
  cursor: pointer;
}

.tile[data-size="landscape"] {
  aspect-ratio: 16 / 9;
}

.tile[data-size="square"] {
  aspect-ratio: 1 / 1;
}

.tile[data-size="tall"] {
  aspect-ratio: 3 / 4;
}

.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-img--hover {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.tile:focus-visible {
  outline: 2px solid var(--color-fg);
  outline-offset: -2px;
}

@media (hover: hover) {
  .tile:hover .tile-img--hover,
  .tile:focus-visible .tile-img--hover {
    opacity: 1;
  }
}

.tile-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 0.6rem 0.85rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 1;
}

@media (hover: hover) {
  .tile-label {
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .tile:hover .tile-label,
  .tile:focus-visible .tile-label {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile-img--hover,
  .tile-label {
    transition: none;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--color-border);
}

/* ---------- Simple content pages (Sobre / Contato) ---------- */
.page-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

.page-content h1 {
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
}

.page-content p {
  color: var(--color-fg);
  margin-bottom: 1.1rem;
}

.page-content a.contact-link {
  display: inline-block;
  margin-top: 0.5rem;
  text-decoration: underline;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 3.5rem;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
}

.lightbox-caption {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: var(--color-fg);
  cursor: pointer;
  line-height: 1;
}

.lightbox-close {
  top: 1.25rem;
  right: 1.5rem;
  font-size: 2.25rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  padding: 0.5rem 0.75rem;
}

.lightbox-prev {
  left: 0.5rem;
}

.lightbox-next {
  right: 0.5rem;
}

@media (max-width: 600px) {
  .lightbox {
    padding: 1.5rem;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 2.25rem;
  }
}
