/* UrmeVii — memorial.css
 * Stiluri pentru pagina publica de memorial (vizualizare profil).
 * Mobile-first (doar min-width breakpoints).
 * Depinde de variables.css (incarcat anterior de layout).
 * Toate clasele prefixate cu .mem- pentru a evita coliziunile.
 * ──────────────────────────────────────────────────────────── */


/* ══════════════════════════════════════════════════════════
   1. HERO COVER
   ══════════════════════════════════════════════════════════ */

.mem-hero {
  position: relative;
  width: 100%;
  min-height: 60vh;
  min-height: 60svh;
  background-color: var(--color-primary);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* Imagine de fundal — absolute, acopera tot hero-ul */
.mem-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 0;
}

/* Gradient inchis peste imagine pentru lizibilitate text */
.mem-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 30%,
    rgba(28, 28, 26, 0.85) 100%
  );
  z-index: 1;
}

/* Continut ancorat la baza hero-ului */
.mem-hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: var(--space-8) var(--space-4) var(--space-6);
  text-align: center;
}

/* Varianta fara poza: inaltime redusa, gradient brand, centrat */
.mem-hero--no-photo {
  min-height: 40vh;
  min-height: 40svh;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-soft) 100%
  );
  align-items: center;
}

.mem-hero--no-photo::after {
  display: none;
}

/* Numele persoanei */
.mem-name {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: #fff;
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-2);
}

/* Anii de viata */
.mem-years {
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--color-accent-soft);
  margin: 0 0 var(--space-4);
}

/* Separator decorativ */
.mem-divider {
  width: 60px;
  height: 2px;
  background-color: var(--color-accent);
  border: none;
  margin: 0 auto;
}


/* ══════════════════════════════════════════════════════════
   2. MAIN BODY
   ══════════════════════════════════════════════════════════ */

.mem-body {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-4) var(--space-20);
}


/* ══════════════════════════════════════════════════════════
   3. BIOGRAPHY
   ══════════════════════════════════════════════════════════ */

.mem-bio {
  margin-bottom: var(--space-10);
}

.mem-bio__text {
  font-family: var(--font-body);
  font-size: var(--text-md);   /* 18px — peste minimul de 16px */
  line-height: var(--leading-loose);
  color: var(--color-text-light);
  white-space: pre-wrap;
  margin: 0;
}

/* Titlu de sectiune cu linie decorativa dupa text */
.mem-section-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-6);
}

.mem-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-border);
}


/* ══════════════════════════════════════════════════════════
   4. SLIDESHOW (CSS scroll-snap, fara librarii externe)
   ══════════════════════════════════════════════════════════ */

.mem-slideshow {
  margin-bottom: var(--space-10);
}

.mem-slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: var(--radius-lg);
}

@media (prefers-reduced-motion: no-preference) {
  .mem-slides { scroll-behavior: smooth; }
}

.mem-slides::-webkit-scrollbar {
  display: none;
}

.mem-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.mem-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Puncte de navigare */
.mem-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: 0;
  list-style: none;
}

.mem-dot {
  position: relative;   /* necesar pentru ::before (touch target extins) */
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

/* Touch target extins la ~44px prin pseudo-element transparent */
.mem-dot::before {
  content: '';
  position: absolute;
  inset: -18px;   /* (44px - 8px) / 2 = 18px inset negativ pe fiecare parte */
}

.mem-dot--active {
  background-color: var(--color-accent);
  transform: scale(1.3);
}


/* ══════════════════════════════════════════════════════════
   5. GALLERY GRID
   ══════════════════════════════════════════════════════════ */

.mem-gallery {
  margin-bottom: var(--space-10);
}

.mem-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.mem-gallery__item {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.mem-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-base);
}

/* Hover si focus-within (accesibil cu tastatura) */
.mem-gallery__item:hover img,
.mem-gallery__item:focus-within img {
  transform: scale(1.04);
}

/* Focus vizibil pe item in sine (tabindex) */
.mem-gallery__item:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


/* ══════════════════════════════════════════════════════════
   6. LIGHTBOX
   ══════════════════════════════════════════════════════════ */

.mem-lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.92);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}

/* JS adauga aceasta clasa pentru a deschide lightbox-ul */
.mem-lightbox--open {
  display: flex;
}

.mem-lightbox__img {
  max-width: 95vw;
  max-height: 90vh;
  max-height: 90svh;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

.mem-lightbox__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  background-color: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: var(--text-2xl);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
  line-height: 1;
}

.mem-lightbox__close:hover,
.mem-lightbox__close:focus {
  background-color: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}


/* ══════════════════════════════════════════════════════════
   7. EXTERNAL LINKS
   ══════════════════════════════════════════════════════════ */

.mem-links {
  margin-bottom: var(--space-10);
}

.mem-links__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mem-link-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
  min-height: 44px;   /* touch target minim */
}

.mem-link-card:hover,
.mem-link-card:focus {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  outline: none;
}

.mem-link-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Iconita serviciului */
.mem-link-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Variante de culoare pentru diferite servicii */
.mem-link-card__icon--youtube {
  background-color: #FF0000;
  color: #fff;
}

.mem-link-card__icon--drive {
  background-color: #1DA462;
  color: #fff;
}

.mem-link-card__icon--facebook {
  background-color: #1877F2;
  color: #fff;
}

.mem-link-card__icon--default {
  background-color: var(--color-primary-soft);
  color: var(--color-accent);
}

/* Textele cardului */
.mem-link-card__body {
  flex: 1;
  min-width: 0;   /* permite text-overflow sa functioneze in flex */
}

.mem-link-card__label {
  font-size: var(--text-base);   /* 16px — minim iOS auto-zoom safe */
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.mem-link-card__url {
  font-size: var(--text-sm);
  color: var(--color-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* Sageata spre dreapta */
.mem-link-card__arrow {
  margin-left: auto;
  color: var(--color-muted);
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════
   8. 404 PAGE
   ══════════════════════════════════════════════════════════ */

.mem-404 {
  text-align: center;
  padding: var(--space-20) var(--space-4);
}

.mem-404__icon {
  font-size: 4rem;
  display: block;
  margin-bottom: var(--space-6);
}

.mem-404__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  color: var(--color-primary);
  margin: 0 0 var(--space-4);
}

.mem-404__message {
  font-size: var(--text-base);
  color: var(--color-text-light);
  line-height: var(--leading-base);
}


/* ══════════════════════════════════════════════════════════
   9. BREAKPOINTS DESKTOP (mobile-first: doar min-width)
   ══════════════════════════════════════════════════════════ */

@media (min-width: 640px) {
  /* Hero: nume mai mare pe tableta/desktop */
  .mem-name {
    font-size: var(--text-4xl);
  }

  /* Galerie: 3 coloane */
  .mem-gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Link-uri: flex-row cu wrap (2 carduri pe rand) */
  .mem-links__grid {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mem-link-card {
    flex: 1 1 calc(50% - var(--space-3));
  }
}

@media (min-width: 1024px) {
  /* Body: padding lateral mai mare */
  .mem-body {
    padding-inline: var(--space-8);
  }

  /* Galerie: 4 coloane pe desktop */
  .mem-gallery__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ══════════════════════════════════════════════════════════
   10. PRINT
   ══════════════════════════════════════════════════════════ */

@media print {
  /* Ascunde elementele interactive la tiparire */
  .mem-slides,
  .mem-dots,
  .mem-lightbox {
    display: none !important;
  }

  /* Hero compact la tiparire */
  .mem-hero {
    min-height: auto;
  }

  /* Asigura lizibilitate text la print */
  .mem-name {
    color: #000;
  }

  .mem-years {
    color: #333;
  }
}
