/* =======================================================
   @file    css/artifacts.css
   @version 2.3.0
   @step    6
   @date    2026-03-14
   =======================================================
   Press & Artifacts v3.0 — Passepartout Museum Style
   UX round 2: modal fullscreen, calligraphic headings,
   cross-category navigation, hidden collapsed sections

   v2.1.0 — Phase 1.2: All cards get 3-line text clamp
   v2.2.0 — Phase 2: Modal vertical layout, scroll fix,
            fixed close button
   ======================================================= */

/* -------------------------------------------------------
   0. CSS CUSTOM PROPERTIES
   ------------------------------------------------------- */
:root {
  --passepartout-bg-start: #f5e6c8;
  --passepartout-bg-end:   #e8d5b5;
  --passepartout-border:   #c4a882;
  --passepartout-shadow:   rgba(139, 109, 63, 0.15);
  --artifact-gold:         #8b6d3f;
  --artifact-gold-light:   #b8976a;
  --artifact-text-dark:    #3a2e1e;
  --artifact-text-muted:   #7a6b55;
  --artifact-bg-page:      #faf6f0;
  --artifact-featured-border: #c9a84c;
  --artifact-featured-bg:  #fdf8ef;
  --artifact-modal-bg:     rgba(0, 0, 0, 0.75);
  --artifact-card-radius:  4px;
  --artifact-transition:   0.3s ease;
}

/* -------------------------------------------------------
   1. GRID LAYOUT
   ------------------------------------------------------- */
.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  padding: 20px 0;
}

/* -------------------------------------------------------
   2. CARD — Base (Passepartout)
   ------------------------------------------------------- */
.artifact-card {
  background: linear-gradient(135deg,
    var(--passepartout-bg-start) 0%,
    var(--passepartout-bg-end) 100%);
  border: 2px solid var(--passepartout-border);
  border-radius: var(--artifact-card-radius);
  box-shadow:
    inset 0 0 20px var(--passepartout-shadow),
    0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow var(--artifact-transition),
              transform var(--artifact-transition);
  display: flex;
  flex-direction: column;
}
.artifact-card:hover {
  box-shadow:
    inset 0 0 20px var(--passepartout-shadow),
    0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Image wrapper */
.artifact-card__img-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--passepartout-border);
  background: #fff;
  margin-bottom: 10px;
}
.artifact-card__img-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

/* Meta line: title + year */
.artifact-card__meta {
  font-size: 1.05em;
  color: var(--artifact-text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}
.artifact-card__meta strong {
  color: var(--artifact-text-dark);
  font-weight: 600;
}

/* Type + City subtitle */
.artifact-card__sub {
  font-size: 0.95em;
  color: var(--artifact-text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

/* -------------------------------------------------------
   3. CARD TEXT — Clipped to 3 lines (SEO: full text in HTML)
   ------------------------------------------------------- */
.artifact-card__text {
  max-height: 4.5em;
  overflow: hidden;
  position: relative;
  line-height: 1.5;
  font-size: 1.12em;
  color: var(--artifact-text-dark);
  transition: max-height var(--artifact-transition);
}

/* Gradient fade-out hint */
.artifact-card__text::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5em;
  background: linear-gradient(transparent, var(--passepartout-bg-end));
  pointer-events: none;
  transition: opacity var(--artifact-transition);
}

/* Expanded state (JS toggle only — click "Read more") */
.artifact-card__text.expanded {
  max-height: none;
}
.artifact-card__text.expanded::after {
  display: none;
}

/* Read more link — shown for ALL cards with text */
.artifact-card__readmore {
  display: block;
  font-size: 1em;
  color: var(--artifact-gold);
  cursor: pointer;
  margin-top: 4px;
  text-decoration: none;
  font-weight: 500;
}
.artifact-card__readmore:hover {
  color: var(--artifact-gold-light);
  text-decoration: underline;
}

/* -------------------------------------------------------
   4. FEATURED CARD — Gold accent
   ------------------------------------------------------- */
.artifact-card--featured {
  border-color: var(--artifact-featured-border);
  background: linear-gradient(135deg,
    var(--artifact-featured-bg) 0%,
    #f5ecd6 100%);
  box-shadow:
    inset 0 0 20px rgba(201, 168, 76, 0.12),
    0 2px 12px rgba(139, 109, 63, 0.18);
}

/* Featured badge */
.artifact-card__badge {
  display: none;
}
.artifact-card--featured .artifact-card__badge {
  display: inline-block;
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--artifact-featured-border);
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 2;
}

/* -------------------------------------------------------
   5. DRAFT CARD — Image + meta only, no text
   ------------------------------------------------------- */
.artifact-card--draft .artifact-card__text,
.artifact-card--draft .artifact-card__readmore {
  display: none;
}

/* -------------------------------------------------------
   6. FILTER TABS — Sticky, centered, prominent
   ------------------------------------------------------- */
.artifact-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  padding: 12px 0;
  list-style: none;
  position: sticky;
  top: var(--header-h, 139px);
  z-index: 100;
  background: var(--artifact-bg-page);
  border-bottom: 1px solid rgba(196, 168, 130, 0.3);
}

/* Override parent overflow:hidden that kills sticky */
#biography-article .content-wrapper {
  overflow: visible;
}
#biography-article .content-wrapper .content {
  overflow: visible;
}
.artifact-filter-tabs li {
  display: inline-block;
}
.artifact-filter-tabs button {
  background: transparent;
  border: 1px solid var(--passepartout-border);
  border-radius: 3px;
  color: var(--artifact-text-muted);
  font-size: 1.05em;
  padding: 8px 20px;
  cursor: pointer;
  transition: all var(--artifact-transition);
  font-family: inherit;
}
.artifact-filter-tabs button:hover {
  border-color: var(--artifact-gold);
  color: var(--artifact-gold);
}
.artifact-filter-tabs button.active {
  background: var(--artifact-gold);
  border-color: var(--artifact-gold);
  color: #fff;
  font-weight: 600;
}

/* -------------------------------------------------------
   7. LOAD MORE BUTTON
   ------------------------------------------------------- */
.artifact-load-more {
  display: block;
  margin: 30px auto;
  padding: 10px 32px;
  background: transparent;
  border: 2px solid var(--artifact-gold);
  border-radius: 3px;
  color: var(--artifact-gold);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--artifact-transition);
  font-family: inherit;
}
.artifact-load-more:hover {
  background: var(--artifact-gold);
  color: #fff;
}

/* -------------------------------------------------------
   8. DETAIL VIEW — Modal (DESKTOP)
   v2.2.0: Vertical layout (image top, text below),
   scroll inside modal overlay, fixed close button
   ------------------------------------------------------- */
.artifact-detail {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--artifact-modal-bg);
  z-index: 9999;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.artifact-detail.open {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 20px 80px;
}

.artifact-detail__inner {
  background: var(--artifact-bg-page);
  border-radius: 6px;
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 36px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

/* Close button — FIXED, always visible */
.artifact-detail__close {
  position: fixed;
  top: 16px;
  right: 24px;
  background: rgba(250, 246, 240, 0.95);
  border: 1px solid var(--passepartout-border);
  font-size: 1.8em;
  color: var(--artifact-text-muted);
  cursor: pointer;
  line-height: 1;
  z-index: 10002;
  padding: 4px 8px;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.artifact-detail__close:hover {
  color: var(--artifact-text-dark);
  background: rgba(250, 246, 240, 1);
  box-shadow: 0 2px 14px rgba(0,0,0,0.3);
}

/* Modal image — FULL WIDTH on top */
.artifact-detail__image {
  flex: none;
  max-width: 100%;
  width: 100%;
}
.artifact-detail__image .passepartout {
  background: linear-gradient(135deg,
    var(--passepartout-bg-start) 0%,
    var(--passepartout-bg-end) 100%);
  border: 2px solid var(--passepartout-border);
  box-shadow: inset 0 0 20px var(--passepartout-shadow);
  padding: 12px;
  max-width: 700px;
  margin: 0 auto;
}
.artifact-detail__image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--passepartout-border);
  cursor: zoom-in;
}

/* Modal content — BELOW image */
.artifact-detail__content {
  flex: none;
  width: 100%;
}

/* Modal title */
.artifact-detail__content h3 {
  font-size: 1.6em;
  text-align: center;
  margin-bottom: 16px;
  color: var(--artifact-text-dark);
  line-height: 1.3;
  padding: 0 20px;
}

/* Modal meta */
.artifact-detail__meta {
  font-size: 1.05em;
  color: var(--artifact-text-muted);
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--passepartout-border);
  line-height: 1.6;
  text-align: center;
}

/* Modal text display */
#artifact-text-display {
  font-size: 1.15em;
  line-height: 1.75;
  color: var(--artifact-text-dark);
  max-width: 750px;
  margin: 0 auto;
}

/* -------------------------------------------------------
   9. LANGUAGE TABS — HIDDEN (global lang used)
   ------------------------------------------------------- */
.artifact-lang-tabs {
  display: none !important;
}

/* Lang panels — hidden (global lang in #artifact-text-display) */
.artifact-lang-panel {
  display: none !important;
}

/* -------------------------------------------------------
   10. NAVIGATION — Gallery-style side arrows
   ------------------------------------------------------- */
.artifact-detail__nav {
  display: none;
}
.artifact-detail.open .artifact-detail__nav {
  display: contents;
}

/* Both arrow buttons: fixed side position */
.artifact-detail__nav button {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;
  background: rgba(250, 246, 240, 0.45);
  border: none;
  color: var(--artifact-gold);
  font-size: 2.2em;
  cursor: pointer;
  padding: 16px 10px;
  transition: all var(--artifact-transition);
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.artifact-detail__nav button:hover {
  background: rgba(250, 246, 240, 0.85);
  color: var(--artifact-text-dark);
}
.artifact-detail__nav button:disabled {
  opacity: 0;
  cursor: default;
  pointer-events: none;
}

/* Prev = left edge */
#artifact-nav-prev {
  left: 8px;
}
/* Next = right edge */
#artifact-nav-next {
  right: 8px;
}

/* Category indicator in nav (hidden with new layout) */
.artifact-detail__nav-category {
  display: none;
}

/* -------------------------------------------------------
   11. PAGE HEADER / SECTION TITLE
   ------------------------------------------------------- */
/* Intro paragraph — match biography p.text sizing */
.artifact-intro {
  font-size: 1.3em;
  line-height: 1.6;
  color: var(--artifact-text-dark);
  text-align: center;
  margin-bottom: 24px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Hide h1 + intro + heritage when category is active (JS adds class) */
.artifacts-header-hidden {
  display: none !important;
}

/* -------------------------------------------------------
   11b. HERITAGE STORY — Tower + Family Origins
   ------------------------------------------------------- */
.artifact-heritage {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 860px;
  margin: 0 auto 28px;
  padding: 24px 28px;
  background: linear-gradient(135deg, rgba(245, 230, 200, 0.35) 0%, rgba(232, 213, 181, 0.2) 100%);
  border: 1px solid rgba(196, 168, 130, 0.35);
  border-radius: 6px;
}

.artifact-heritage__tower {
  flex: 0 0 280px;
  margin: 0;
}
.artifact-heritage__tower img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--passepartout-border);
  border-radius: 3px;
  box-shadow:
    inset 0 0 12px var(--passepartout-shadow),
    0 2px 8px rgba(0, 0, 0, 0.1);
}
.artifact-heritage__tower figcaption {
  font-size: 0.95em;
  color: var(--artifact-text-muted);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
  line-height: 1.4;
}

.artifact-heritage__text {
  flex: 1;
  font-size: 1.2em;
  line-height: 1.75;
  color: var(--artifact-text-dark);
  font-family: 'EB Garamond', 'Palatino Linotype', 'Book Antiqua', serif;
}

/* Section headings — clickable, calligraphic when active */
.artifact-section h2 {
  cursor: pointer;
  transition: all var(--artifact-transition);
  padding: 4px 12px;
  border-radius: 4px;
  text-align: center;
}
.artifact-section h2:hover {
  text-shadow: 0 1px 6px rgba(139, 109, 63, 0.25);
  color: var(--artifact-gold);
}

/* A1: Collapsed sections — COMPLETELY HIDDEN */
.artifact-section.collapsed {
  display: none;
}

/* A2: Active category heading — calligraphic font like h1 */
.artifact-section.active-category h2 {
  font-family: 'Cormorant Garamond', 'Palatino Linotype', 'Book Antiqua', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 2.8em;
  color: var(--artifact-text-dark);
  margin: 0.3em 0 0.5em;
  letter-spacing: 0.02em;
}

.artifact-section-title {
  text-align: center;
  margin-bottom: 8px;
  color: var(--artifact-text-dark);
  font-size: 1.5em;
  font-weight: 600;
}
.artifact-section-subtitle {
  text-align: center;
  color: var(--artifact-text-muted);
  font-size: 0.95em;
  margin-bottom: 24px;
}

/* -------------------------------------------------------
   12. RESPONSIVE — Mobile first breakpoints
   ------------------------------------------------------- */

/* A5: MOBILE MODAL — fullscreen */
@media (max-width: 768px) {
  .artifact-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 12px 0;
  }

  .artifact-detail.open {
    padding: 0;
    align-items: flex-start;
  }

  .artifact-detail__inner {
    padding: 16px;
    gap: 16px;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
  }

  .artifact-detail__image .passepartout {
    padding: 8px;
    max-width: 100%;
  }

  .artifact-detail__close {
    top: 8px;
    right: 8px;
    font-size: 2em;
    width: 44px;
    height: 44px;
  }

  .artifact-detail__content h3 {
    font-size: 1.4em;
    margin-top: 8px;
    padding: 0 10px;
  }

  #artifact-text-display,
  .artifact-lang-panel {
    font-size: 1.15em;
    line-height: 1.7;
  }

  .artifact-detail__meta {
    font-size: 1em;
  }

  /* Mobile arrows — BIG, easy to tap */
  .artifact-detail__nav button {
    font-size: 4em;
    padding: 20px 10px;
    background: rgba(250, 246, 240, 0.25);
  }
  #artifact-nav-prev { left: 4px; }
  #artifact-nav-next { right: 4px; }

  /* Hide header when modal open (JS adds class to body) */
  body.artifact-modal-open #header-cap {
    transform: translateY(-100%);
    pointer-events: none;
  }

  .artifact-filter-tabs {
    gap: 6px;
    padding: 10px 0;
  }
  .artifact-filter-tabs button {
    font-size: 0.92em;
    padding: 6px 14px;
  }

  .artifact-lang-tabs button {
    padding: 8px 16px;
    font-size: 0.95em;
  }

  /* Calligraphic heading smaller on mobile */
  .artifact-section.active-category h2 {
    font-size: 2em;
  }

  /* Heritage: stack vertically on mobile — BIG */
  .artifact-heritage {
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    gap: 20px;
  }
  .artifact-heritage__tower {
    flex: none;
    width: 90%;
    max-width: 380px;
  }
  .artifact-heritage__tower figcaption {
    font-size: 1.1em;
    margin-top: 10px;
  }
  .artifact-heritage__text {
    font-size: 1.25em;
    line-height: 1.8;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .artifact-card {
    padding: 10px;
  }

  .artifact-section-title {
    font-size: 1.25em;
  }

  .artifact-section.active-category h2 {
    font-size: 1.6em;
  }
}

@media (min-width: 1200px) {
  .artifact-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* -------------------------------------------------------
   13. UTILITY — Hidden cards for lazy load
   ------------------------------------------------------- */
.artifact-card.hidden {
  display: none;
}

/* Loading spinner for AJAX */
.artifact-detail__loading {
  text-align: center;
  padding: 20px;
  color: var(--artifact-text-muted);
  font-style: italic;
}

/* ============================================
   V03: IMAGE PROTECTION — Artifacts
   Transparent ::after overlay intercepts
   right-click on artifact card images.
   Card click (.artifact-card) still works —
   overlay bubbles clicks up to card wrapper.
   Modal img: user-drag/select only (no
   pointer-events:none — PhotoSwipe zoom OK).
   ============================================ */
.artifact-card__img-wrap::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
}
.artifact-card__img-wrap img {
  -webkit-user-drag: none;
     -khtml-user-drag: none;
       -moz-user-drag: none;
         -o-user-drag: none;
            user-drag: none;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  pointer-events: none;
}
/* Modal image — allow zoom click but block drag/select */
#artifact-modal-img,
.passepartout img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}
