/* ==================== Infographic / Keepsake Styles ==================== */

/* Container */
.infographic {
  max-width: 800px;
  margin: 0 auto;
  background: var(--ig-bg, #FFF8F0);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: #1A1A1A;
}

/* ==================== AI Image Mode ==================== */

.ig-image-mode {
  background: #000;
  max-width: 900px;
}

.ig-image-wrap {
  position: relative;
  width: 100%;
  line-height: 0;
}

.ig-image {
  width: 100%;
  height: auto;
  display: block;
}

.ig-overlay {
  padding: 28px 36px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.95) 100%);
  color: #fff;
}

.ig-overlay-headline {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.ig-overlay-sub {
  font-size: 1rem;
  font-style: italic;
  margin: 0 0 6px;
  opacity: 0.8;
}

.ig-overlay-name {
  font-size: 0.95rem;
  margin: 0;
  opacity: 0.6;
  letter-spacing: 1px;
}

.ig-overlay-mood {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 16px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.5;
}

.ig-image-mode .ig-footer {
  background: rgba(0,0,0,0.95);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.ig-image-mode .ig-footer-brand {
  color: rgba(255,255,255,0.5);
}

.ig-image-mode .ig-footer-tagline {
  color: rgba(255,255,255,0.3);
}

/* Legacy mode label */
.ig-legacy-rels {
  text-align: left;
  margin: 20px 0;
}

.ig-legacy-rel {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 1rem;
  color: #4A3728;
}

/* Header with gradient */
.ig-header {
  position: relative;
  padding: 48px 32px 36px;
  text-align: center;
  color: #fff;
  overflow: hidden;
}

.ig-header-glow {
  position: absolute;
  top: -50%;
  left: -25%;
  width: 150%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.ig-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.8);
  object-fit: cover;
  margin: 0 auto 16px;
  display: block;
  position: relative;
  z-index: 1;
}

.ig-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.ig-name {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 4px;
  position: relative;
  z-index: 1;
}

.ig-nickname {
  font-size: 1.1rem;
  font-style: italic;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.ig-lifespan {
  font-size: 0.95rem;
  margin-top: 8px;
  opacity: 0.85;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

/* Headline */
.ig-headline-section {
  padding: 32px 40px 24px;
  text-align: center;
}

.ig-headline {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ig-primary, #D84315);
  margin: 0 0 8px;
  line-height: 1.3;
}

.ig-subheadline {
  font-size: 1rem;
  color: #6D5D4E;
  margin: 0;
}

/* Section titles */
.ig-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

/* Relationships */
.ig-relationships {
  padding: 24px 40px;
}

.ig-rel-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ig-rel-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
}

.ig-rel-symbol {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

.ig-rel-content {
  flex: 1;
  min-width: 0;
}

.ig-rel-type {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6D5D4E;
  margin-bottom: 2px;
}

.ig-rel-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1A1A1A;
}

.ig-rel-phrase {
  font-size: 0.95rem;
  font-style: italic;
  color: #4A3728;
  margin-top: 4px;
  line-height: 1.4;
}

/* Story excerpt */
.ig-story {
  padding: 24px 40px;
}

.ig-story-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.ig-story-quote {
  margin: 0;
  padding: 16px 20px;
  border-left: 4px solid var(--ig-accent, #F9A825);
  background: rgba(255,255,255,0.5);
  border-radius: 0 12px 12px 0;
  font-size: 1.05rem;
  font-style: italic;
  color: #4A3728;
  line-height: 1.6;
}

/* Timeline */
.ig-timeline {
  padding: 24px 40px 32px;
}

.ig-tl-track {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding-top: 16px;
}

.ig-tl-track::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--ig-tl-color, #F9A825);
  opacity: 0.4;
}

.ig-tl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.ig-tl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-bottom: 8px;
  border: 2px solid rgba(255,255,255,0.8);
}

.ig-tl-year {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1A1A1A;
}

.ig-tl-label {
  font-size: 0.8rem;
  color: #6D5D4E;
  text-align: center;
  margin-top: 2px;
}

/* Decorative symbols */
.ig-symbols {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 40px 32px;
  opacity: 0.5;
}

.ig-sym-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer */
.ig-footer {
  padding: 20px 40px;
  text-align: center;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.02);
}

.ig-footer-brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ig-primary, #D84315);
  opacity: 0.7;
}

.ig-footer-tagline {
  font-size: 0.8rem;
  color: #6D5D4E;
  margin-top: 2px;
}

/* ==================== Keepsakes List View ==================== */

.keepsakes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.keepsakes-header h1 {
  margin: 0;
}

.keepsakes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.keepsake-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(0,0,0,0.06);
}

.keepsake-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.keepsake-card-header {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #f0ebe4;
}

.keepsake-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.keepsake-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keepsake-card-body {
  padding: 16px;
}

.keepsake-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.keepsake-card-person {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.keepsake-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.keepsake-card-palette {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.keepsake-card-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ==================== Keepsake Detail View ==================== */

.keepsake-view {
  padding: 0;
}

.keepsake-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.keepsake-toolbar-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.keepsake-toolbar-right {
  display: flex;
  gap: 8px;
}

.keepsake-content {
  padding: 32px 24px;
  min-height: 60vh;
}

/* Loading state */
.keepsake-generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 24px;
  text-align: center;
}

.keepsake-generating-icon {
  font-size: 3rem;
  animation: keepsake-pulse 2s ease-in-out infinite;
}

@keyframes keepsake-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

.keepsake-generating-text {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.keepsake-generating-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Empty state */
.keepsakes-empty {
  text-align: center;
  padding: 80px 24px;
}

.keepsakes-empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.keepsakes-empty p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin: 8px 0;
}

/* Focus mode (Memory Object) */
.keepsake-focus .sidebar {
  display: none !important;
}

.keepsake-focus .main-content {
  margin-left: 0 !important;
}

.keepsake-focus .keepsake-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255,248,240,0.95);
  backdrop-filter: blur(8px);
}

.keepsake-focus .keepsake-content {
  padding-top: 80px;
}

.keepsake-focus .infographic {
  animation: ig-fade-in 1s ease-out;
}

@keyframes ig-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Print ==================== */

@media print {
  .sidebar, .keepsake-toolbar, .mp-chat-widget, nav {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .keepsake-content {
    padding: 0 !important;
  }

  .infographic {
    box-shadow: none;
    border-radius: 0;
    max-width: 100%;
    page-break-inside: avoid;
  }

  .ig-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
  .ig-header {
    padding: 32px 20px 28px;
  }

  .ig-avatar {
    width: 96px;
    height: 96px;
  }

  .ig-name {
    font-size: 1.6rem;
  }

  .ig-headline {
    font-size: 1.3rem;
  }

  .ig-headline-section,
  .ig-relationships,
  .ig-story,
  .ig-timeline,
  .ig-symbols,
  .ig-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .ig-tl-track {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
  }

  .ig-tl-track::before {
    display: none;
  }

  .ig-tl-item {
    flex: 0 0 auto;
  }

  .keepsakes-grid {
    grid-template-columns: 1fr;
  }

  .keepsake-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
