/* ===========================
   FONT DECLARATIONS
   =========================== */
@font-face {
  font-family: 'Sabon';
  src: url('./fonts/Sabon.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Sabon';
  src: url('./fonts/SabonBold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: 'Sabon';
  src: url('./fonts/SabonItalic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: 'Sabon';
  src: url('./fonts/SabonBoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
}

/* ===========================
   CSS RESET & BASE
   =========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Sabon', serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

em {
  font-style: italic;
}

/* ===========================
   LIGHT & DARK MODE
   =========================== */
body.light-mode {
  background-color: #FFFFFF;
  color: #010000;
}

body.dark-mode {
  background-color: #342F2F;
  color: #FFFFFF;
}

/* ===========================
   SPLASH SCREEN
   =========================== */

.splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  transition: opacity 1.0s ease;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash__logo {
  position: relative;
  width: 20vw;
  max-width: 300px;
}

/* IMPORTANT: remove transition so animation works properly */
.splash__img {
  width: 100%;
  height: auto;
  position: absolute;
  top: 0;
  left: 0;
  transition: none;
}

/* Top half */
.splash__img--top {
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 45%,
    95% 48%, 90% 44%, 85% 50%, 80% 46%,
    75% 52%, 70% 47%, 65% 51%, 60% 45%,
    55% 50%, 50% 46%, 45% 52%, 40% 47%,
    35% 51%, 30% 45%, 25% 49%, 20% 46%,
    15% 52%, 10% 48%, 5% 51%, 0% 47%
  );
}

/* Bottom half */
.splash__img--bottom {
  clip-path: polygon(
    0% 47%, 5% 51%, 10% 48%, 15% 52%,
    20% 46%, 25% 49%, 30% 45%, 35% 51%,
    40% 47%, 45% 52%, 50% 46%, 55% 50%,
    60% 45%, 65% 51%, 70% 47%, 75% 52%,
    80% 46%, 85% 50%, 90% 44%, 95% 48%,
    100% 45%, 100% 100%, 0% 100%
  );
}

/* ===========================
   TEAR ANIMATION (TIGHT + VISIBLE)
   =========================== */

@keyframes tearWobbleTop {
  0%   { transform: translateY(0) rotate(0deg); }
  15%  { transform: translateY(-8px) rotate(-3deg); }
  35%  { transform: translateY(-18px) rotate(2deg); }
  55%  { transform: translateY(-26px) rotate(-1.5deg); }
  75%  { transform: translateY(-32px) rotate(1deg); }
  100% { transform: translateY(-24px) rotate(-2deg); }
}

@keyframes tearWobbleBottom {
  0%   { transform: translateY(0) rotate(0deg); }
  15%  { transform: translateY(8px) rotate(3deg); }
  35%  { transform: translateY(18px) rotate(-2deg); }
  55%  { transform: translateY(26px) rotate(1.5deg); }
  75%  { transform: translateY(32px) rotate(-1deg); }
  100% { transform: translateY(24px) rotate(3deg); }
}

.splash__img--top.tearing {
  animation: tearWobbleTop 0.23s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

.splash__img--bottom.tearing {
  animation: tearWobbleBottom 0.28s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

/* ===========================
   STRUCTURE FIXES
   =========================== */

.splash__logo img {
  display: block;
}

.splash__logo {
  aspect-ratio: auto;
}

.splash__img:first-child {
  position: relative;
}
/* ===========================
   12-COLUMN GRID SYSTEM
   =========================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  max-width: 1440px;
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===========================
   SIDEBAR (Column 2 of 12, Fixed)
   =========================== */

.sidebar {
  grid-column: 2 / 6;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 80px;
  height: 100vh;
  position: relative;
  overflow: visible;
}

/* Artist Logo — fixed top-left corner */
.artist-logo {
  position: fixed;
  top: 3vh;
  left: 3vh;
  z-index: 100;
  display: block;
  text-decoration: none;
  cursor: pointer;
}

.artist-logo__img {
  width: 140px;
  height: auto;
  display: block;
}

/* Light mode: show dark logo, hide light logo */
body.light-mode .artist-logo__img--dark {
  display: block;
}
body.light-mode .artist-logo__img--light {
  display: none;
}

/* Dark mode: show light logo, hide dark logo */
body.dark-mode .artist-logo__img--dark {
  display: none;
}
body.dark-mode .artist-logo__img--light {
  display: block;
}

/* Artist Name */
.artist-name {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.artist-name__text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  text-decoration: none;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.artist-name__text:hover {
  opacity: 0.7;
}

.back-button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  display: none;
  transition: opacity 0.2s ease;
}

.back-button:hover {
  opacity: 0.7;
}

.back-button.visible {
  display: block;
  position: fixed;
  left: calc(3vh + 140px);
  top: calc(50% - 2em);
  transform: translateY(calc(-50% - 40px));
  z-index: 100;
}

/* Navigation */
.main-nav {
  position: fixed;
  left: calc(3vh + 140px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

.nav-link {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 0.7;
}

.nav-link.active {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ===========================
   WORKS SUBMENU
   =========================== */
.works-submenu {
  grid-column: 4 / 7;
  grid-row: 1;

  display: grid;
  grid-template-rows: 5vh auto;  /* ← key line */

  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;

  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.works-submenu::-webkit-scrollbar {
  display: none;
}

.works-submenu {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.works-submenu.visible {
  visibility: visible;
  opacity: 1;
}

.works-submenu__list {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding-top: 0;   /* remove offset */
  grid-row: 2;      /* put content in second row */
}

.works-submenu__item {
  font-family: 'Sabon', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.15;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: pre-line;
  transition: opacity 0.4s ease;
}
.works-submenu__item em {
  font-style: italic;
}

.works-submenu.dimmed .works-submenu__item {
  opacity: 0.25;
}

.works-submenu.dimmed .works-submenu__item.active {
  opacity: 1;
}

/* ===========================
   CONTENT (Columns 6-12, Scrollable)
   =========================== */
.content {
  grid-column: 7 / 13;
  grid-row: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 5vh;
  padding-bottom: 60px;
  height: 100vh;
  scroll-padding-top: 5vh;
}

/* Custom scrollbar */
.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

body.dark-mode .content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

/* ===========================
   PAGE HEADER (mobile-only full-width slot)
   =========================== */
.page-header {
  display: none; /* hidden on desktop */
}

/* ===========================
   HOME PAGE (Blank)
   =========================== */
.home-blank {
  /* Just empty space */
}

/* ===========================
   WORKS PAGE (Show Listings)
   =========================== */
.works-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto;
  gap: 20px;
  width: 100%;
}

.show-item {
  grid-column: 1 / -1;
  margin-bottom: 80px;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

/* animation-delay set dynamically via inline style in app.js */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.show-item__image {
  width: 100%;
  max-width: 720px;
  height: auto;
  cursor: pointer;
  display: block;
}

.show-item__image--portrait {
  max-width: 450px; /* 1.5x bigger than before */
}

.show-item:not(:first-child) .show-item__image--landscape {
  margin-top: 80px;
}

.show-item__title {
  margin-top: 20px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.4;
  white-space: pre-line;
}

/* ===========================
   GALLERY VIEW (Individual Show)
   =========================== */
.gallery-view {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 20px;
  row-gap: 0;
  width: 100%;
  grid-template-rows: 5vh auto;
}

.gallery-grid {
  grid-column: 1 / 6;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 320px));
  gap: 20px;
}

.exhibition-text-link {
  grid-column: 1 / 6;
  grid-row: 1;
  align-self: start;
}


.gallery-item {
  width: 100%;
  height: auto;
  cursor: pointer;
}

/* ===========================
   EXHIBITION TEXT LINK
   =========================== */

.exhibition-text-link a {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.exhibition-text-link a:hover {
  opacity: 1;
}

/* ===========================
   TEXT VIEW
   =========================== */
.text-view {
  max-width: 540px;
  display: grid;
  grid-template-rows: 5vh auto;
  row-gap: 0;
}

.text-pdf-link {
  align-self: start;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.text-pdf-link:hover {
  opacity: 1;
}

.text-body p {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  margin-bottom: 1.4em;
}

/* ===========================
   INFO PAGE
   =========================== */
.info-view {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-top: 5vh;
}

.info-bio p {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.6;
  margin-bottom: 1.2em;
}

.info-bio a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.info-section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  margin-top: 0;
}

.info-table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 32px;
}

.info-table tr td {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.7;
  vertical-align: top;
  padding: 0;
}

.info-year {
  width: 110px;
  white-space: nowrap;
  padding-right: 20px !important;
}

/* ===========================
   SINGLE IMAGE VIEW
   =========================== */
.single-image-view {
  padding-top: 5vh;
  display: flex;
  align-items: flex-start;
  gap: 20px;            /* ← pixels between arrow and image — adjust this */
}

/* Image: no flex-grow, no forced width — sizes from its own aspect ratio */
.single-image {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 80px); /* leave room for both arrows + gaps */
  max-height: 75vh;              /* ← scales with screen height — adjust this */
  width: auto;
  height: auto;
}

/* Prev/next navigation arrows */
.gallery-arrow {
  flex-shrink: 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: inherit;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease;
}

.gallery-arrow:hover {
  opacity: 0.7;
}

.gallery-arrow--hidden {
  visibility: hidden;
  pointer-events: none;
}

/* ===========================
   PLACEHOLDER PAGES
   =========================== */
.placeholder {
  padding: 40px 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  opacity: 0.5;
}

/* ===========================
   FADE TRANSITIONS
   =========================== */
.content.fade-out {
  opacity: 0;
  transition: opacity 0.08s ease;
}

.content.fade-in {
  opacity: 1;
  transition: opacity 0.12s ease;
}

/* ===========================
   LOGO SHAKE EFFECT
   =========================== */
@keyframes shake {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-4px, 2px); }
  20%  { transform: translate(3px, -3px); }
  30%  { transform: translate(-2px, 4px); }
  40%  { transform: translate(4px, -1px); }
  50%  { transform: translate(-3px, -2px); }
  60%  { transform: translate(2px, 3px); }
  70%  { transform: translate(-4px, -1px); }
  80%  { transform: translate(1px, 2px); }
  90%  { transform: translate(-1px, -2px); }
  100% { transform: translate(0, 0); }
}

body.shaking .grid-container {
  animation: shake 0.4s ease-in-out;
}

/* ===========================
   MOBILE LAYOUT
   =========================== */
@media (max-width: 768px) {

  /* Splash logo — bigger */
  .splash__logo {
    width: 50vw;
    max-width: none;
  }

  /* Grid — nav bar / exhibition text / submenu+gallery */
  .grid-container {
    grid-template-columns: 2fr 5fr;
    grid-template-rows: auto auto 1fr;
    height: 100vh;
    padding: 0 16px;
  }

  /* Exhibition text — full-width row, right-aligned, sits just above gallery */
  .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    grid-column: 1 / -1;
    grid-row: 2;
    padding-bottom: 6px;
  }

  .page-header a {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: inherit;
    text-decoration: none;
    opacity: 0.5;
  }

  /* Sidebar — horizontal top bar spanning both columns */
  .sidebar {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    height: auto;
    gap: 20px;
    padding: 16px 0;
  }

  .artist-logo {
    position: static;
  }

  .artist-logo__img {
    width: 60px;
  }

  .main-nav {
    position: static;
    transform: none;
    top: auto;
    left: auto;
    flex-direction: row;
    gap: 16px;
  }

  .back-button.visible {
    position: static;
    transform: none;
    top: auto;
    left: auto;
    width: auto;
    order: -1; /* appear before logo in flex row */
  }

  .nav-link {
    font-size: 14px;
  }

  .back-button {
    font-size: 14px;
  }

  /* Submenu — left column, row 3 */
  .works-submenu {
    grid-column: 1;
    grid-row: 3;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: block; /* removes the 5vh spacer row from desktop grid */
  }

  .works-submenu__list {
    padding-top: 20px; /* matches content padding-top on mobile */
    gap: 4px;
  }

  .works-submenu__item {
    font-size: 11px;
    line-height: 1.1;
  }

  /* Content — right column, row 3; full width when no submenu (info/home) */
  .content {
    grid-column: 2;
    grid-row: 3;
    height: auto;
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .no-submenu .content {
    grid-column: 1 / -1;
  }

  .show-item__image {
    max-width: 100%;
  }

  .show-item__image--portrait {
    max-width: 95%;
  }

  .show-item:not(:first-child) .show-item__image--landscape {
    margin-top: 40px;
  }

  /* Back button — left of logo */
  .artist-name {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  /* Gallery view — remove 5vh top row so gallery aligns with submenu */
  .gallery-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  /* Exhibition text hidden inside gallery-view — shown in .page-header instead */
  .gallery-view .exhibition-text-link {
    display: none;
  }

  /* Gallery grid — 3 columns, no top margin (exhibition text is above in page-header) */
  .gallery-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 0;
  }

  /* Single image fullscreen on mobile */
  .image-fullscreen .works-submenu {
    display: none;
  }

  .image-fullscreen .content {
    grid-column: 1 / -1;
  }

  .image-fullscreen .single-image-view {
    justify-content: center;
    padding-top: 16px;
    gap: 8px;
  }

  .image-fullscreen .single-image {
    max-width: calc(100vw - 60px);
    max-height: 85vh;
  }
}
