/* arXte — "La lente del perito" (Loupe Component)
   Dark cabinet authentication room with 2.6x magnification loupe,
   four spectral light filters, hidden expert notes, and four guarantees.
   Prefix: lp-
*/

.lp-root {
  position: relative;
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  padding: clamp(32px, 5vw, 64px) clamp(20px, 4vw, 48px) clamp(48px, 6vw, 80px);
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse 65% 50% at 50% 12%, rgba(217, 191, 134, 0.09) 0%, rgba(18, 17, 16, 0.95) 70%, var(--night) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 6px);
  color: var(--paper);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Header Area */
.lp-header {
  max-width: 1100px;
  margin: 0 auto clamp(28px, 4vw, 44px);
  text-align: center;
}

.lp-eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--gold-light);
  letter-spacing: 0.2em;
}

.lp-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: var(--fs-h2);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: #f7f2e8;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
}

.lp-subtitle {
  font-family: var(--font-text);
  font-style: italic;
  font-size: var(--fs-body);
  color: rgba(242, 236, 224, 0.72);
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Main Layout: Stage + Marginalia */
.lp-layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(32px, 4.5vw, 64px);
  align-items: start;
}

/* Left / Main Workspace */
.lp-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* Painting Selector Bar */
.lp-art-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 20px;
  padding: 8px 24px;
  border-top: 1px solid rgba(217, 191, 134, 0.2);
  border-bottom: 1px solid rgba(217, 191, 134, 0.2);
}

.lp-art-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: var(--fs-label);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.16em;
  color: rgba(242, 236, 224, 0.6);
  cursor: pointer;
  position: relative;
  transition: color 0.25s var(--ease-out);
  font-family: var(--font-ui);
}

.lp-art-btn:hover {
  color: var(--paper);
}

.lp-art-btn.lp-active-art {
  color: var(--gold-light);
  font-weight: 600;
}

.lp-art-btn.lp-active-art::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 12px;
  right: 12px;
  height: 1px;
  background-color: var(--gold);
}

.lp-art-btn:focus-visible {
  outline: 1px solid var(--gold-light);
  outline-offset: 3px;
}

.lp-art-sep {
  color: rgba(217, 191, 134, 0.25);
  font-size: 11px;
}

/* Spectral Light Modes (Radio Group) */
.lp-light-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 24px;
  background: rgba(27, 25, 22, 0.8);
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid rgba(217, 191, 134, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.lp-light-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  color: rgba(242, 236, 224, 0.55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 2px;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
  font-family: var(--font-ui);
}

.lp-light-btn:hover {
  color: var(--paper);
}

.lp-light-btn.lp-active-light {
  color: #121110;
  background: var(--gold-light);
  font-weight: 600;
}

.lp-light-btn:focus-visible {
  outline: 1px solid var(--gold-light);
  outline-offset: 2px;
}

.lp-light-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background-color 0.2s;
}

.lp-light-btn.lp-active-light .lp-light-dot {
  background-color: #121110;
}

/* Painting Inspection Stage */
.lp-stage {
  position: relative;
  margin: 0 auto;
  display: inline-block;
  cursor: crosshair;
}

.lp-frame-outer {
  position: relative;
  padding: 10px;
  background: linear-gradient(135deg, #1f1b16 0%, #0d0c0a 100%);
  border: 1px solid #362c1e;
  box-shadow:
    0 0 0 1px #0a0908 inset,
    0 0 0 2px rgba(217, 191, 134, 0.3) inset,
    0 24px 60px -10px rgba(0, 0, 0, 0.85),
    0 4px 16px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
}

.lp-frame-inner {
  position: relative;
  overflow: hidden;
  background: #080706;
  border: 1px solid rgba(217, 191, 134, 0.25);
}

.lp-stage-canvas {
  position: relative;
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 65vh;
  margin: 0 auto;
  outline: none;
  /* a vertical swipe scrolls the page; the loupe follows a horizontal drag or a press-and-hold (loupe.js) */
  touch-action: pan-y pinch-zoom;
  -webkit-touch-callout: none;
}

.lp-stage-canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.lp-base-image {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: brightness(0.55) contrast(1.02);
  transition: filter 0.3s var(--ease-out);
  pointer-events: none;
}

/* The Loupe Optics & Bezel */
.lp-loupe {
  position: absolute;
  top: 0;
  left: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  pointer-events: none;
  overflow: visible;
  z-index: 40;
  transform: translate3d(0, 0, 0);
  will-change: transform, left, top;
}

/* Glass Viewport inside the ring */
.lp-glass-portal {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 2px #4a3818,
    0 0 0 6px #d9bf86,
    0 0 0 9px #8a6a35,
    0 0 0 11px #151310,
    0 20px 45px rgba(0, 0, 0, 0.75);
}

/* Magnified Canvas Layer */
.lp-magnified-layer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-repeat: no-repeat;
  transition: filter 0.25s var(--ease-out);
}

/* Optical Calibration Tick Marks (SVG overlay on bezel) */
.lp-bezel-ticks {
  position: absolute;
  inset: -11px;
  width: calc(100% + 22px);
  height: calc(100% + 22px);
  pointer-events: none;
  z-index: 5;
}

/* Curved Lens Reflection / Glare */
.lp-lens-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.04) 40%,
    transparent 60%,
    rgba(217, 191, 134, 0.12) 100%
  );
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: screen;
}

/* UV Faint Violet Glow Overlay */
.lp-lens-uv-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(140, 60, 255, 0.2) 0%,
    rgba(80, 0, 180, 0.35) 75%,
    rgba(40, 0, 100, 0.5) 100%
  );
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  z-index: 7;
}

.lp-lens-uv-glow.lp-uv-active {
  opacity: 1;
}

/* Crosshair Reticle Center Mark */
.lp-reticle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0.3;
}

.lp-reticle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(50% - 12px);
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
}

.lp-reticle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(50% - 12px);
  height: 24px;
  width: 1px;
  background: rgba(255, 255, 255, 0.6);
}

/* Leader Lines Layer */
.lp-leader-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
  overflow: visible;
}

.lp-leader-line {
  stroke: var(--gold-light);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  transition: opacity 0.3s var(--ease-out);
}

.lp-leader-dot {
  fill: var(--gold-light);
}

/* The ring pulses only while a note is open (class set by loupe.js), a few times, then rests.
   It scales a fixed r=4 circle (4 → 16) instead of animating `r`, which forced a layout every frame. */
.lp-leader-pulse {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
}

.lp-leader-pulse.is-active {
  animation: lp-ring-pulse 2s ease-out 3 forwards;
}

@keyframes lp-ring-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* Active Expert Note Callout Card */
.lp-note-callout {
  position: absolute;
  background: rgba(27, 25, 22, 0.94);
  border: 1px solid var(--gold);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 16px 36px -8px rgba(0, 0, 0, 0.85);
  padding: 12px 16px;
  border-radius: 2px;
  max-width: 280px;
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.lp-note-callout.lp-note-visible {
  opacity: 1;
  transform: translateY(0);
}

.lp-note-badge {
  font-size: 0.68rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  color: var(--gold-light);
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-ui);
}

.lp-note-hand {
  font-family: var(--font-hand);
  font-size: 1.45rem;
  line-height: 1.15;
  color: #f7e6bf;
  margin: 0 0 6px;
  display: block;
}

.lp-note-detail {
  font-family: var(--font-text);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.35;
  color: rgba(242, 236, 224, 0.7);
  margin: 0;
  display: block;
}

/* Painting Info Plaque Below Stage */
.lp-plaque {
  margin-top: 18px;
  width: 100%;
  max-width: 600px;
  padding: 12px 20px;
  background: rgba(27, 25, 22, 0.6);
  border: 1px solid rgba(217, 191, 134, 0.18);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.lp-plaque-meta h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.15rem;
  font-weight: 400;
  margin: 0 0 3px;
  color: #f5f0e4;
}

.lp-plaque-meta p {
  font-family: var(--font-text);
  font-size: 0.82rem;
  color: rgba(242, 236, 224, 0.6);
  margin: 0;
}

/* Discovery Status & Verified Stamp */
.lp-status-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-counter-label {
  font-size: var(--fs-label);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.15em;
  color: var(--gold-light);
  white-space: nowrap;
  font-family: var(--font-ui);
}

.lp-verified-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(142, 27, 27, 0.35);
  border: 1px solid #8e1b1b;
  border-radius: 2px;
  color: #ffcccc;
  font-size: 0.72rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.16em;
  font-weight: 600;
  /* glows a few times when the stamp appears, then rests (an infinite box-shadow loop repaints every frame) */
  animation: lp-stamp-glow 2s ease-in-out 3;
  font-family: var(--font-ui);
}

@keyframes lp-stamp-glow {
  0%, 100% { border-color: #8e1b1b; box-shadow: 0 0 6px rgba(142, 27, 27, 0.3); }
  50% { border-color: var(--gold); box-shadow: 0 0 12px rgba(217, 191, 134, 0.4); }
}

.lp-verified-stamp .lp-seal-glyph {
  color: var(--gold-light);
  font-size: 0.85rem;
}

/* Right Column: Marginalia Guarantees */
.lp-marginalia {
  border-left: 1px solid rgba(217, 191, 134, 0.2);
  padding-left: clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.lp-guarantee-heading {
  margin: 0 0 6px;
  font-size: var(--fs-label);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  font-family: var(--font-ui);
}

.lp-guarantee-item {
  font-family: var(--font-text);
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(242, 236, 224, 0.82);
  position: relative;
}

.lp-guarantee-item sup {
  color: var(--gold-light);
  font-weight: 600;
  font-size: 0.82rem;
  margin-right: 4px;
}

.lp-guarantee-item strong {
  font-weight: 600;
  color: #f7f2e8;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.lp-registry-box {
  margin-top: 12px;
  padding: 14px;
  background: rgba(27, 25, 22, 0.5);
  border: 1px solid rgba(217, 191, 134, 0.15);
  border-radius: 2px;
}

.lp-registry-title {
  font-size: 0.72rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.15em;
  color: var(--gold-light);
  margin: 0 0 8px;
  font-family: var(--font-ui);
}

.lp-registry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lp-registry-item {
  font-family: var(--font-text);
  font-size: 0.8rem;
  color: rgba(242, 236, 224, 0.55);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lp-registry-item.lp-found {
  color: var(--paper-2);
}

.lp-registry-item.lp-found .lp-reg-check {
  color: var(--gold-light);
}

.lp-reg-check {
  color: rgba(242, 236, 224, 0.25);
  font-size: 0.75rem;
}

/* Mobile Adjustments (down to 375px) */
@media (max-width: 900px) {
  .lp-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .lp-marginalia {
    border-left: none;
    border-top: 1px solid rgba(217, 191, 134, 0.2);
    padding-left: 0;
    padding-top: 28px;
  }

  .lp-loupe {
    width: 150px;
    height: 150px;
  }

  .lp-note-callout {
    max-width: 230px;
    padding: 10px 12px;
  }

  .lp-note-hand {
    font-size: 1.25rem;
  }
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  .lp-magnified-layer,
  .lp-base-image,
  .lp-note-callout,
  .lp-lens-uv-glow,
  .lp-verified-stamp,
  .lp-leader-pulse.is-active {
    transition: none !important;
    animation: none !important;
  }
}
