:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #7a7a7a;
  --line: #e2e2e2;
  --serif: "ogg", 'Georgia', 'Times New Roman', serif;
  --serif-text: "ogg-text", 'Georgia', 'Times New Roman', serif;
  --sans: "macho", 'Helvetica Neue', Arial, sans-serif;
}

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

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

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

/* ---------- Nav ---------- */

.top-nav {
  display: flex;
  align-items: center;
  padding: 2rem 3rem 0;
}

.top-nav nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}

.top-nav a {
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  font-variant: small-caps;
  font-feature-settings: "smcp";
}

.top-nav a:hover {
  color: var(--muted);
}

/* ---------- Hero ---------- */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem 3rem;
  padding-bottom: clamp(8rem, 24vw, 18rem);
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 100;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1;
}

.work-tabs {
  display: flex;
  gap: 1.75rem;
}

.work-tab {
  background: none;
  border: none;
  padding: 0 0 0.25rem;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  font-variant: small-caps;
  font-feature-settings: "smcp";
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.work-tab:hover {
  color: var(--text);
}

.work-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.hero-info {
  text-align: right;
  font-family: var(--serif-text);
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.7;
}

.hero-info a:hover {
  color: var(--muted);
}

/* ---------- Gallery strip ---------- */

.gallery-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: clamp(4rem, 12vw, 9rem);
}

.gallery-item {
  display: block;
  padding: 1.25rem 1.25rem 0;
}

.gallery-item .label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
  font-variant: small-caps;
  font-feature-settings: "smcp";
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

/* ---------- Photo filter + grid ---------- */

.photo-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0 3rem 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.filter-btn {
  background: none;
  border: none;
  padding: 0 0 0.5rem;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  font-variant: small-caps;
  font-feature-settings: "smcp";
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.photo-grid {
  position: relative;
  padding: 0 3rem;
  padding-bottom: clamp(4rem, 12vw, 9rem);
}

.photo-item {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.photo-grid-item {
  width: 100%;
  height: auto;
  display: block;
}

.photo-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.photo-item:hover .photo-overlay {
  transform: translateY(0);
}

/* Column count for .photo-grid is computed in JS (site.js, getColumnCount)
   at the same breakpoints: 2 / 640px:3 / 900px:4 / 1300px:5 */

/* ---------- Project pages ---------- */

.back-link {
  font-size: 0.85rem;
  font-variant: small-caps;
  font-feature-settings: "smcp";
}

.back-link:hover {
  color: var(--muted);
}

.project-page {
  padding: 3rem;
}

.project-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.project-info {
  max-width: 480px;
  order: -1;
}

.project-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.project-description {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.7;
}

.project-photos {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-photos img {
  width: 100%;
  height: auto;
  display: block;
}

.project-photos > img {
  max-width: 560px;
}

.photo-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.photo-row img {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
}

@media (min-width: 900px) {
  .project-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 5rem;
  }

  .project-info {
    flex: 0 0 320px;
    position: sticky;
    top: 3rem;
    order: 0;
  }

  .project-photos {
    flex: 0 1 760px;
    min-width: 0;
  }
}

/* ---------- Contact page ---------- */

.contact-page {
  min-height: calc(100vh - 6rem);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 3rem;
}

.contact-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-name {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.95rem;
  font-variant: small-caps;
  font-feature-settings: "smcp";
}

.contact-detail {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}

.contact-detail a:hover {
  color: var(--text);
}

/* ---------- About page ---------- */

.about-page {
  min-height: calc(100vh - 6rem);
  display: flex;
  align-items: center;
  padding: 3rem;
}

.about-block {
  max-width: 520px;
}

.about-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 1.5rem;
}

.about-bio {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.cv-button {
  display: inline-block;
  border: 1px solid var(--text);
  padding: 0.6rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  font-variant: small-caps;
  font-feature-settings: "smcp";
  transition: background 0.2s ease, color 0.2s ease;
}

.cv-button:hover {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Footer ---------- */

.contacto {
  text-align: center;
  padding: 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.contacto p {
  margin-bottom: 0.4rem;
}

.contacto a:hover {
  color: var(--text);
}

.copyright {
  margin-top: 0.75rem;
  font-size: 0.7rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .gallery-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery-item {
    padding-bottom: 1.25rem;
  }
  .hero {
    padding: 2rem 1.5rem;
    padding-bottom: 5rem;
  }
  .top-nav {
    padding: 1.5rem 1.5rem 0;
  }
}

@media (max-width: 500px) {
  .gallery-strip {
    grid-template-columns: 1fr;
  }
}

/* ---------- Lightbox ---------- */

.lightbox-trigger {
  cursor: zoom-in;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 4rem 5rem;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: var(--serif);
  line-height: 1;
  padding: 0.5rem;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: var(--muted);
}

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

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

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

@media (max-width: 700px) {
  .lightbox-overlay {
    padding: 4rem 1rem;
  }
}
