/* === Kssmatyas v3 — Industrial Editorial === */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --paper: #f5f3ee;
  --paper-warm: #ebe7dd;
  --ink: #15140f;
  --ink-soft: #4a473f;
  --ink-mute: #8c867a;
  --rule: #d8d3c4;
  --rule-soft: #e6e1d2;
  --accent: #b8754a;

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, sans-serif;

  --sidebar: 240px;
  --pad: clamp(1.25rem, 3.5vw, 2.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; }
::selection { background: var(--ink); color: var(--paper); }

/* === Sidebar === */
.side {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar);
  height: 100dvh;
  background: var(--paper);
  border-right: 1px solid var(--rule-soft);
  padding: 2rem 1.5rem 1.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.5s var(--ease);
}
.side::-webkit-scrollbar { width: 3px; }
.side::-webkit-scrollbar-thumb { background: var(--rule); }

.brand {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 2.25rem;
  display: block;
}
.brand-dot { color: var(--accent); font-style: italic; }

.nav {
  list-style: none;
  margin-bottom: auto;
  border-top: 1px solid var(--rule-soft);
  padding-top: 1.25rem;
}
.nav > li { margin-bottom: 0.05rem; }
.nav > li > a, .nav > li > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  text-align: left;
  transition: color 0.25s var(--ease), padding-left 0.3s var(--ease);
  position: relative;
}
.nav > li > a:hover, .nav > li > button:hover { color: var(--ink); }
.nav > li > a.active {
  color: var(--ink);
  padding-left: 0.85rem;
}
.nav > li > a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 0.45rem; height: 1px;
  background: var(--accent);
  transform: translateY(-50%);
}

.nav .group { font-family: var(--serif); font-style: italic; font-size: 1.05rem; font-weight: 400; }
.nav .chev {
  display: inline-block;
  font-size: 0.65rem;
  transition: transform 0.3s var(--ease);
  color: var(--ink-mute);
  font-style: normal;
}
.nav .group.open .chev { transform: rotate(180deg); }

.nav .sub {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
  padding-left: 0.85rem;
  border-left: 1px solid var(--rule-soft);
  margin-left: 0.3rem;
}
.nav .sub.open { max-height: 400px; }
.nav .sub li a {
  display: block;
  padding: 0.3rem 0;
  font-size: 0.8rem;
  color: var(--ink-mute);
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: color 0.2s var(--ease);
}
.nav .sub li a:hover { color: var(--ink); }
.nav .sub li a.active { color: var(--accent); font-weight: 500; }

.side-foot {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
}
.side-foot a {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.side-foot a:hover { opacity: 1; transform: translateY(-2px); }
.side-foot img { width: 22px; height: 22px; object-fit: contain; }

/* === Mobile topbar === */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  padding: 0.85rem var(--pad);
  background: rgba(245, 243, 238, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
  align-items: center;
  justify-content: space-between;
}
.topbar .brand { font-size: 1.5rem; margin: 0; }
.menu-btn {
  width: 44px; height: 44px;
  display: flex;
  align-items: center; justify-content: center;
  position: relative;
}
.menu-btn span {
  position: absolute;
  width: 22px; height: 1px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-btn span:nth-child(1) { transform: translateY(-5px); }
.menu-btn span:nth-child(3) { transform: translateY(5px); }
.menu-btn.open span:nth-child(1) { transform: rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: rotate(-45deg); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(21, 20, 15, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
  z-index: 45;
}
.scrim.show { opacity: 1; pointer-events: auto; }

@media (max-width: 900px) {
  .topbar { display: flex; }
  .side {
    transform: translateX(-100%);
    box-shadow: 0 0 60px rgba(0,0,0,0.15);
    width: 280px;
  }
  .side.open { transform: translateX(0); }
}

/* === Main === */
.main {
  margin-left: var(--sidebar);
  min-height: 100dvh;
}
@media (max-width: 900px) {
  .main { margin-left: 0; padding-top: 56px; }
}

/* === Home Hero === */
.hero {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}
@media (max-width: 900px) {
  .hero { height: 52dvh; min-height: 360px; }
}

.hero-slides { position: absolute; inset: 0; }
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 2s var(--ease);
}
.hero-slide.active {
  opacity: 1;
  animation: kenburns 9s linear forwards;
}
@keyframes kenburns {
  0%   { transform: scale(1.0)  translate(0, 0); }
  100% { transform: scale(1.12) translate(-1.5%, -1%); }
}

.hero-dots {
  position: absolute;
  bottom: clamp(1.5rem, 4vw, 3rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 0.45rem;
}
.hero-dots span {
  width: 22px; height: 2px;
  background: rgba(245, 243, 238, 0.35);
  transition: background 0.4s var(--ease), width 0.4s var(--ease);
  cursor: pointer;
}
.hero-dots span.on { background: var(--paper); width: 36px; }

/* === Mobile home nav cards === */
.home-nav { display: none; }
@media (max-width: 900px) {
  .home-nav {
    display: block;
    padding: 2rem var(--pad) 3rem;
    background: var(--paper);
  }
  .home-nav-title {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-mute);
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
  }
  .home-nav-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }
  .home-nav-row a {
    padding: 1rem 1.1rem;
    border: 1px solid var(--rule);
    background: var(--paper);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
  }
  .home-nav-row a:hover, .home-nav-row a:active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
  }
  .home-nav-row a::after {
    content: '→';
    font-family: var(--serif);
    opacity: 0.5;
    transition: transform 0.25s var(--ease);
  }
  .home-nav-row a:hover::after { transform: translateX(3px); opacity: 1; }
  .home-nav .group-label {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--accent);
    margin: 1.5rem 0 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rule-soft);
  }
  .home-nav .group-label:first-child { margin-top: 0; }
}

/* === Page sections === */
.page {
  padding: clamp(2.5rem, 6vh, 4.5rem) var(--pad);
  max-width: 1280px;
}
.page-head {
  margin-bottom: clamp(1.75rem, 4vh, 2.75rem);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.page-title em { font-style: italic; color: var(--accent); }
.page-sub {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

/* === Gallery tabs (grouped) === */
.tabs {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.tabs-all {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--rule-soft);
}
.tab-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.55rem 0;
}
@media (max-width: 640px) {
  .tab-row { grid-template-columns: 1fr; gap: 0.5rem; }
}
.tab-group-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.tab-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.tab {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.95rem;
  border-radius: 2px;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: var(--paper);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); border-color: var(--ink-soft); }
.tab.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* === Masonry === */
.grid {
  column-count: 3;
  column-gap: 0.85rem;
}
@media (max-width: 1100px) { .grid { column-count: 2; } }
@media (max-width: 520px)  { .grid { column-count: 1; } }

.grid .item {
  break-inside: avoid;
  margin-bottom: 0.85rem;
  background: var(--paper-warm);
  overflow: hidden;
  cursor: zoom-in;
  display: block;
  position: relative;
}
.grid .item img {
  width: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.25s linear;
}
.grid .item img.loaded { opacity: 1; }
.grid .item:hover img.loaded {
  transform: scale(1.025);
  filter: brightness(1.04);
  transition: opacity 0.25s linear, transform 0.5s var(--ease), filter 0.3s var(--ease);
}

/* === Lightbox === */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(245, 243, 238, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
  padding: 2rem 1rem;
}
.lb.open { opacity: 1; pointer-events: auto; }
.lb img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 10px 50px rgba(21,20,15,0.18);
}
.lb-btn {
  position: absolute;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.lb-btn:hover { background: var(--paper-warm); }
.lb-close { top: 1.5rem; right: 1.5rem; }
.lb-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) scale(1.05); }
.lb-next:hover { transform: translateY(-50%) scale(1.05); }
.lb-count {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
}
@media (max-width: 520px) {
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
  .lb-btn { width: 42px; height: 42px; }
}

/* === About === */
.about-intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: clamp(2.5rem, 6vh, 4.5rem) var(--pad) clamp(2rem, 5vh, 3.5rem);
  max-width: 920px;
}
.about-intro p {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.1vw, 1.75rem);
  line-height: 1.45;
  color: var(--ink);
  font-weight: 400;
  max-width: 42ch;
}
.about-intro .signature {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* === About carousel (horizontal natural aspect) === */
.carousel-wrap {
  padding: 0 var(--pad) clamp(2rem, 5vh, 3.5rem);
  position: relative;
  max-width: 1280px;
}
.carousel {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img {
  flex: 0 0 auto;
  height: clamp(280px, 56vh, 560px);
  width: auto;
  max-width: none;
  scroll-snap-align: start;
  cursor: zoom-in;
  background: var(--paper-warm);
}

/* === Exhibitions === */
.exh {
  padding: clamp(3rem, 7vh, 5rem) var(--pad);
  max-width: 1280px;
  border-top: 1px solid var(--rule-soft);
}
.exh-item {
  padding: clamp(1.5rem, 4vh, 2.5rem) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.exh-item:last-of-type { border-bottom: none; }
.exh-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  margin-bottom: 1.5rem;
}
.exh-year {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  min-width: 80px;
}
.exh-title {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.6vw, 2.05rem);
  font-weight: 400;
  margin-bottom: 0.2rem;
  line-height: 1.15;
}
.exh-title a {
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s, color 0.2s;
}
.exh-title a:hover { border-color: var(--ink); color: var(--accent); }
.exh-desc {
  font-size: 0.82rem;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.exh-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.exh-strip::-webkit-scrollbar { display: none; }
.exh-strip img {
  flex: 0 0 auto;
  height: clamp(220px, 42vh, 360px);
  width: auto;
  max-width: none;
  scroll-snap-align: start;
  cursor: zoom-in;
  background: var(--paper-warm);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.exh-strip img:hover { opacity: 0.92; transform: translateY(-2px); }
@media (max-width: 640px) {
  .exh-head { grid-template-columns: 1fr; gap: 0.3rem; }
  .exh-year { font-size: 1.6rem; min-width: 0; }
}

/* === Contact === */
.contact {
  padding: clamp(4rem, 10vh, 7rem) var(--pad);
  max-width: 1280px;
  border-top: 1px solid var(--rule-soft);
  text-align: center;
}
.contact .label {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.contact-mail {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.85rem, 5vw, 3.2rem);
  font-weight: 400;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  display: inline-block;
  padding-bottom: 0.25rem;
  transition: color 0.3s, border-color 0.3s;
  margin-bottom: 2.5rem;
}
.contact-mail:hover { color: var(--accent); border-color: var(--accent); }
.contact-line {
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.contact-line a {
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s, color 0.2s;
}
.contact-line a:hover { color: var(--ink); border-color: var(--ink); }

/* === Videos === */
.videos {
  padding: clamp(2rem, 5vh, 4rem) var(--pad);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  max-width: 1280px;
}
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  background: var(--paper-warm);
  overflow: hidden;
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* === Reveal === */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-slide.active { animation: none; transform: scale(1.04); }
}
