/* ============================================================
   Daniela Mereuță — Catalogue of Selected Works
   Layout is fixed to A4 (210mm × 297mm). Pages are rendered as
   individual .page elements; the same DOM is used for on-screen
   viewing, browser Print and html2canvas → jsPDF export.
   ============================================================ */

:root {
  --cream: #f3eee3;
  --cream-soft: #e9e2d1;
  --ink: #211c17;
  --ink-soft: #3a342c;
  --ink-fade: #4a4239;
  --muted: #7a7064;
  --muted-dim: #9a8f7f;
  --red: #8a2f24;
  --red-soft: #CE948A;
  --green: #1f7a4d;
  --green-dim: #8a8f7f;
  --dark: #211c17;
  --dark-soft: #cabfae;
  --dark-mute: #9a8f7f;
  --page-w: 210mm;
  --page-h: 297mm;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1c1916;
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* -------- Toolbar (screen only) -------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(28, 25, 22, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(243, 238, 227, 0.08);
  padding: 12px 18px;
}
.toolbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.toolbar-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--dark-mute);
}
.toolbar-actions { display: flex; gap: 10px; }
.toolbar button,
.toolbar .btn-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 1px solid rgba(243, 238, 227, 0.22);
  background: transparent;
  color: var(--cream);
  padding: 9px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.toolbar button:hover,
.toolbar .btn-link:hover { background: rgba(243, 238, 227, 0.06); border-color: rgba(243, 238, 227, 0.4); }
.toolbar button.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.toolbar button.primary:hover { background: #a53829; border-color: #a53829; }
.toolbar button:disabled { opacity: .55; cursor: wait; }

.pdf-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  background: rgba(33, 28, 23, 0.94);
  color: var(--cream);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 18px;
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  border: 1px solid rgba(243, 238, 227, 0.18);
}

/* -------- Catalog container -------- */
.catalog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 30px 20px 60px;
  min-height: calc(100vh - 60px);
}
.catalog .loading {
  color: #999;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 100px;
}

/* -------- Page (A4) -------- */
.page {
  width: var(--page-w);
  height: var(--page-h);
  background: var(--cream);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  page-break-after: always;
  break-after: page;
}
.page.dark {
  background: var(--dark);
  color: var(--cream);
}

/* Header/footer bars used across pages */
.page-hdr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.page.dark .page-hdr { color: var(--dark-mute); }
.rule {
  height: 1px;
  background: rgba(33, 28, 23, 0.22);
  margin-top: 6mm;
}
.page.dark .rule { background: rgba(243, 238, 227, 0.2); }
.page-ftr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid rgba(33, 28, 23, 0.16);
  padding-top: 5mm;
}
.page.dark .page-ftr {
  color: var(--dark-mute);
  border-top-color: rgba(243, 238, 227, 0.2);
}

/* ============================================================
   COVER PAGE
   ============================================================ */
.page-cover { padding: 0; }
.page-cover .cover-top {
  padding: 17mm 19mm 0;
}
.page-cover .cover-body {
  padding: 0 19mm;
  margin-top: 24mm;
  flex: 1;
}
.cover-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--red);
}
.cover-name {
  margin: 12px 0 0;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 92px;
  line-height: 0.92;
  letter-spacing: -1px;
}
.cover-tag {
  margin: 16px 0 0;
  max-width: 120mm;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink-fade);
}
.cover-tag p { margin: 0 0 0.6em; }
.cover-tag p:last-child { margin-bottom: 0; }
.page-cover .cover-meta {
  padding: 0 19mm;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7mm;
}
.page-cover .cover-image {
  width: 100%;
  height: 128mm;
  overflow: hidden;
}
.page-cover .cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: grayscale(100%) contrast(1.02);
  display: block;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.page-about { padding: 18mm 19mm 14mm; }
.about-quote {
  margin: 11mm 0 0;
  max-width: 150mm;
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  line-height: 1.3;
  font-weight: 400;
  color: #2a241d;
}
.about-body {
  margin-top: 10mm;
  columns: 2;
  column-gap: 12mm;
  font-family: 'EB Garamond', serif;
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  text-align: justify;
}
.about-body p { margin: 0 0 1em; break-inside: avoid; }
.about-image {
  margin-top: 8mm;
  width: 100%;
  height: 96mm;
  overflow: hidden;
}
.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  filter: grayscale(100%);
  display: block;
}
.about-contact {
  margin-top: 6mm;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 6mm;
  font-family: 'IBM Plex Mono', monospace;
  border-top: 1px solid rgba(33, 28, 23, 0.22);
  padding-top: 5mm;
}
.about-contact .val { white-space: nowrap; }
.about-contact .lbl {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}
.about-contact .val {
  font-size: 11px;
  margin-top: 4px;
  color: #2a241d;
  word-break: break-word;
}

/* ============================================================
   SECTION DIVIDER PAGE
   ============================================================ */
.page-section {
  padding: 18mm 19mm 16mm;
}
.section-body {
  margin-top: 10mm;
}
.section-title {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 68px;
  letter-spacing: -0.5px;
}
.section-desc {
  margin: 10px 0 0;
  max-width: 130mm;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.45;
  color: var(--dark-soft);
}
.section-image {
  margin-top: 8mm;
  width: 100%;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   PLATE PAGE (1 or 2 artworks stacked)
   ============================================================ */
.page-plate {
  padding: 16mm 18mm 14mm;
  font-family: 'EB Garamond', Georgia, serif;
}
.plate-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 6mm;
}
.plate-divider {
  height: 1px;
  background: rgba(33, 28, 23, 0.16);
  margin: 4mm 0;
}

.art-row {
  flex: 1;
  display: flex;
  gap: 11mm;
  align-items: center;
  min-height: 0;
}
.art-row.image-right { flex-direction: row-reverse; }
.art-figure {
  width: 88mm;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.art-figure img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(33, 28, 23, 0.1);
  display: block;
}
.art-info {
  flex: 1;
  min-width: 0;
}
.art-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.art-availability {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.art-availability.available { color: var(--green); }
.art-availability.sold { color: var(--red); }
.art-availability.reserved { color: #b8862b; }
.art-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted-dim);
}
.art-title {
  margin: 9px 0 0;
  font-family: 'Courier New', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
}
.art-meta {
  margin: 8px 0 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}
.art-desc {
  margin: 11px 0 0;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-fade);
}
.art-price {
  margin-top: 13px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--ink);
}
.art-price.contact {
  font-style: italic;
  font-family: 'EB Garamond', serif;
  font-size: 13px;
  color: var(--red);
  letter-spacing: 0;
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.page-contact {
  padding: 18mm 19mm 16mm;
}
.contact-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.contact-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--red);
}
.contact-heading {
  margin: 8mm 0 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 76px;
  line-height: 0.95;
  letter-spacing: -1px;
}
.contact-intro {
  margin: 8px 0 0;
  max-width: 130mm;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
  color: var(--dark-soft);
}
.contact-grid {
  margin-top: 16mm;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10mm;
  font-family: 'IBM Plex Mono', monospace;
}
.contact-grid .lbl {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red-soft);
}
.contact-grid .val {
  font-size: 16px;
  margin-top: 6px;
  line-height: 1.4;
  word-break: break-word;
}
.contact-grid a { color: inherit; text-decoration: none; }
.contact-grid a:hover { text-decoration: underline; }

/* ============================================================
   LIGHTBOX (screen only) — opened by clicking an artwork image
   ============================================================ */
.art-figure img { cursor: zoom-in; }
body.lb-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(20, 17, 14, 0.96);
  color: var(--cream);
}
.lightbox[hidden] { display: none; }

.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 72px 12px;
  position: relative;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.lightbox button {
  font: inherit;
  color: var(--cream);
  background: none;
  border: 0;
  cursor: pointer;
}
.lightbox .lb-close {
  position: absolute;
  top: 10px;
  right: 16px;
  z-index: 1;
  font-size: 36px;
  line-height: 1;
  padding: 4px 10px;
  opacity: 0.75;
}
.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  line-height: 1;
  padding: 8px 18px;
  opacity: 0.6;
}
.lb-prev { left: 4px; }
.lb-next { right: 4px; }
.lb-close:hover, .lb-nav:hover { opacity: 1; }
.lb-nav[hidden] { display: none; }

.lb-caption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px 6px;
  text-align: center;
}
.lb-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 500;
}
.lb-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--dark-mute);
}

.lb-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px 16px;
  justify-content: safe center;
}
.lb-thumbs[hidden] { display: none; }
.lightbox .lb-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  opacity: 0.45;
  outline: 1px solid transparent;
  transition: opacity 0.15s;
}
.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lb-thumb:hover { opacity: 0.8; }
.lb-thumb.active { opacity: 1; outline-color: var(--cream); }

@media (max-width: 600px) {
  .lb-stage { padding: 52px 8px 8px; }
  .lightbox .lb-nav { font-size: 40px; padding: 8px 6px; }
  .lb-title { font-size: 20px; }
  .lightbox .lb-thumb { width: 48px; height: 48px; }
}

/* ============================================================
   PRINT & PDF-EXPORT MODES
   ============================================================ */
@page {
  size: A4;
  margin: 0;
}
@media print {
  body { background: #fff; }
  .toolbar, .pdf-status, .no-print { display: none !important; }
  .catalog { padding: 0; gap: 0; }
  .page {
    box-shadow: none;
    margin: 0;
    page-break-after: always;
    break-after: page;
  }
  .page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

/* html2canvas snapshot mode — hides shadow and neighbouring content */
body.pdf-exporting .toolbar,
body.pdf-exporting .pdf-status,
body.pdf-exporting .no-print { visibility: hidden; }
body.pdf-exporting .page { box-shadow: none; }

/* ============================================================
   Small-screen viewing — scale the fixed-mm pages down.
   The A4 dimensions remain intact for print/PDF fidelity.
   ============================================================ */
@media (max-width: 900px) {
  .catalog { padding: 20px 0; gap: 16px; }
  .page {
    transform: scale(0.5);
    transform-origin: top center;
    margin-bottom: calc(var(--page-h) * -0.5);
  }
  .page:last-child { margin-bottom: 0; }
  .toolbar-title { display: none; }
}
@media (max-width: 480px) {
  .page {
    transform: scale(0.4);
    margin-bottom: calc(var(--page-h) * -0.6);
  }
}
