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

:root {
  --bg:       #f4f1ea;
  --ink:      #1c1c1c;
  --muted:    #6b6460;
  --accent:   #2c2c2c;
  --border:   #d7d4ce;
  --white:    #ffffff;
  --serif:    Georgia, 'Palatino Linotype', Palatino, serif;
  --sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius:   4px;
  --gap:      20px;
  --sidebar:  220px;
  --pad:      56px;
}

html { scroll-behavior: smooth; background: var(--bg); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Sidebar nav (right) ──────────────────────── */
#nav {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--sidebar);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 48px 36px;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.nav-name {
  font-family: var(--sans);
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-bottom: 52px;
}

#nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#nav ul a {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 7px 0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
  transition: color 0.2s, border-color 0.2s;
}

#nav ul a:hover  { color: var(--ink); }
#nav ul a.active { color: var(--ink); border-left-color: var(--accent); }

.nav-bottom {
  margin-top: auto;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Language toggle ──────────────────────────── */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.lang-btn {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.lang-btn:hover        { color: var(--ink); }
.lang-btn.active       { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.lang-sep              { font-size: 0.72rem; color: var(--border); }

/* ── Hamburger (hidden on desktop) ───────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Main content offset ──────────────────────── */
main {
  margin-right: var(--sidebar);
}

/* ── Section header ───────────────────────────── */
.section-header {
  padding: 50px var(--pad) 24px;
}

/* ── Filters ──────────────────────────────────── */
.filters {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}

.filter-btn::after {
  content: attr(data-name);
  max-width: 0;
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
  transition: max-width 0.3s ease, margin-left 0.3s ease;
  margin-left: 0;
  white-space: nowrap;
}

.filter-btn:hover::after {
  max-width: 10em;
  margin-left: 0.4em;
}

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

.filter-btn.active {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ── Series sections (single-page mode) ──────── */
.series-section {
  margin-bottom: 40px;
}

.series-section.hero-section {
  margin-bottom: 0;
}

.hero-card {
  padding: 0 var(--pad) 80px;
  cursor: pointer;
  display: flex;
  justify-content: center;
}

.hero-card img {
  max-width: 55vw;
  max-height: 80vh;
  height: auto;
  width: auto;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.hero-card:hover img {
  opacity: 0.95;
  transform: scale(1.005);
}

.series-label {
  padding: 50px var(--pad) 22px;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
}

.series-section:first-child .series-label {
  padding-top: 50px;
}

.series-label::after {
  content: attr(data-name);
  max-width: 0;
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
  transition: max-width 0.3s ease, margin-left 0.3s ease;
  margin-left: 0;
  white-space: nowrap;
}

.series-label:hover::after {
  max-width: 10em;
  margin-left: 0.4em;
}

/* ── Gallery grid ─────────────────────────────── */
.masonry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: dense;
  gap: 24px;
  padding: 0 var(--pad) 80px;
}

/* ── Horizontal scroll (Presences) ────────────── */
.scroll-view {
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 0 var(--pad) 80px;
  gap: 80px;
  height: 75vh;
  align-items: center;
}

.scroll-view.active {
  display: flex;
}

.scroll-item {
  flex: 0 0 auto;
  height: 65vh;
  cursor: pointer;
  padding: 6px;
  background: #f0ede9;
}

.scroll-item img {
  height: 100%;
  width: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.scroll-item:hover img {
  opacity: 0.85;
}

.scroll-item-meta {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

/* ── Flex row (Tardes) ───────────────────────── */
.flex-row {
  display: flex;
  gap: 24px;
  padding: 0 var(--pad) 80px;
  align-items: stretch;
}

.flex-row-item {
  flex: var(--aspect, 1);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
}

.flex-row-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.flex-row-item:hover img {
  transform: scale(1.03);
}

.flex-row-item .card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.35s;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

.flex-row-item:hover .card-overlay { opacity: 1; }

.flex-row-item .card-overlay-text h4 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
}

.flex-row-item .card-overlay-text p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  margin-top: 3px;
}

.painting-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.painting-card .thumb {
  display: block;
  width: 100%;
  transition: transform 0.5s ease;
}

.painting-card .thumb-gradient {
  width: 100%;
  transition: transform 0.5s ease;
}

.painting-card:hover .thumb,
.painting-card:hover .thumb-gradient {
  transform: scale(1.03);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.35s;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

.painting-card:hover .card-overlay { opacity: 1; }

.card-overlay-text h4 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
}

.card-overlay-text p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  margin-top: 3px;
}

.painting-card.hidden { display: none; }

.painting-card.wide {
  grid-column: span 2;
}

/* ── Disturbances grid (scattered feel) ──────── */
.masonry[data-series="Disturbances"] {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
  gap: 64px 28px;
  align-items: start;
}

.masonry[data-series="Disturbances"] .painting-card {
  margin-top: var(--mt, 0);
}

.masonry[data-series="Disturbances"] .painting-card.wide {
  grid-column: span 2;
}

/* ── About ────────────────────────────────────── */
#about {
  padding: 80px var(--pad);
  border-top: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
}

.about-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.portrait-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #d4b896, #a07850, #6b4423);
  border-radius: var(--radius);
}

.about-portrait img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius);
}

.about-text h2 {
  font-family: var(--sans);
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 32px;
}

.about-statement {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 20px;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.75;
}

.about-meta {
  margin-top: 32px;
  font-size: 0.9rem;
  color: var(--accent) !important;
}

/* ── Contact ──────────────────────────────────── */
#contact {
  padding: 80px var(--pad);
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--bg);
}

.contact-inner h2 {
  font-family: var(--sans);
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.contact-form {
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-submit {
  display: inline-block;
  padding: 10px 36px;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--white);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
}

.form-submit:hover { opacity: 0.8; }

.form-status {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--accent);
}

/* ── Footer ───────────────────────────────────── */
footer {
  padding: 28px var(--pad);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Lightbox ─────────────────────────────────── */
.lb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.98);
  z-index: 200;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 201;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lb-backdrop.open,
.lightbox.open { display: flex; }

.lb-inner {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  max-width: 90vw;
  width: 100%;
  max-height: 90vh;
  animation: lb-in 0.25s ease;
}

@keyframes lb-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lb-image-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 85vh;
}

.lb-image {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius);
  object-fit: contain;
}

.lb-image img {
  max-height: 85vh;
  max-width: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}

.lb-info {
  flex: 0 0 220px;
  padding-top: 8px;
}

.lb-series {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 10px;
}

.lb-info h3 {
  font-family: var(--sans);
  font-size: 1.6rem;
  font-weight: 300;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 14px;
}

.lb-meta {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.8;
}

.lb-badge {
  display: none;
}

.lb-close {
  position: fixed;
  top: 24px; right: 28px;
  background: rgba(0,0,0,0.35);
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  z-index: 202;
}

.lb-close:hover { background: rgba(0,0,0,0.55); color: #fff; }

.lb-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.35);
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  z-index: 202;
  user-select: none;
}

.lb-nav:hover { background: rgba(0,0,0,0.55); color: #fff; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar: 180px; --pad: 36px; }
  .masonry { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  /* sidebar → top bar */
  #nav {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: auto;
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 16px 24px;
    border-left: none;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .nav-name    { margin-bottom: 0; }
  .nav-bottom  { display: none; }

  .hamburger { display: flex; margin-left: auto; }

  #nav ul {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding-top: 16px;
  }

  #nav ul.open { display: flex; }

  #nav ul a {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding-left: 0;
    margin-left: 0;
    padding-bottom: 2px;
  }

  #nav ul a.active { border-bottom-color: var(--accent); }

  .lang-toggle {
    display: none;
    margin-top: 0;
    width: 100%;
    padding-top: 8px;
  }

  .lang-toggle.open { display: flex; }

  main { margin-right: 0; padding-top: 56px; }

  .masonry { grid-template-columns: 1fr; }

  .about-inner { grid-template-columns: 1fr; gap: 36px; }

  .scroll-view {
    flex-direction: column;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: normal;
    gap: 40px;
    align-items: stretch;
  }

  .scroll-item {
    height: auto;
    width: 100%;
  }

  .scroll-item img {
    height: auto;
    width: 100%;
  }

  .flex-row {
    flex-direction: column;
    gap: 16px;
  }

  .flex-row-item {
    flex: none;
  }

  .lb-inner { flex-direction: column; gap: 20px; }
  .lb-info  { flex: none; }
}

@media (max-width: 480px) {
  :root { --pad: 20px; }
  .masonry { grid-template-columns: 1fr; }
  .masonry[data-series="Disturbances"] { grid-template-columns: repeat(2, 1fr); }
  .painting-card.wide { grid-column: span 1; }
  #nav ul  { gap: 14px; }
}
