:root {
  --mem-panel-bg: #ffffff;
  --mem-panel-border: rgba(224, 218, 210, 0.25);
  --mem-panel-shadow: 0 10px 24px rgba(31, 41, 55, 0.07);

  --mem-section-bg: #ffffff;
  --mem-section-border: rgba(224, 218, 210, 0.2);
  --mem-section-shadow: 0 8px 18px rgba(31, 41, 55, 0.06);
  --mem-section-title: #374151;
  --mem-section-text: #4b5563;
  --mem-section-muted: #6b7280;

  --mem-card-bg: #ffffff;
  --mem-card-border: rgba(224, 218, 210, 0.2);
  --mem-card-shadow: 0 6px 15px rgba(31, 41, 55, 0.05);

  --mem-divider-color: rgba(224, 218, 210, 0.35);

  --mem-tab-bg: transparent;
  --mem-tab-border: rgba(224, 218, 210, 0.6);
  --mem-tab-link: #4b5563;
  --mem-tab-link-hover: #374151;
  --mem-tab-link-active: #374151;
  --mem-tab-link-hover-bg: rgba(224, 218, 210, 0.15);
  --mem-tab-hint-bg: rgba(255, 255, 255, 0.9);

  --mem-link-color: #374151;
  --mem-link-hover: #1f2937;

  --mem-hero-outline-edit: #007bff;
  --mem-hero-outline-touch: #28a745;
  --mem-hero-icon-bg: rgba(0, 0, 0, 0.55);
  --mem-hero-icon-bg-hover: rgba(0, 0, 0, 0.7);
  --mem-hero-icon-color: #ffffff;
  --mem-profile-border: #ffffff;
}

/* Responsive design for smaller screens */
@media screen and (max-width: 600px) {
    .tributes {
      padding-left: 40px;
      padding-right: 40px;
    }
    
    .tributes::before {
      left: 20px;
    }

    .tributes::after {
      right: 20px;
    }
    
    .tribute-item {
      padding-left: 20px;
      padding-right: 20px;
    }
    
    .tribute-item::before {
      left: -18px;
    }

    .tribute-item::after {
      right: -18px;
    }
  }
.memorial-content {
    max-width: 1024px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: clamp(48px, 6vw, 80px);
}

.memorial-panel {
    width: 100%;
    box-sizing: border-box;
    padding: clamp(1rem, 2vw, 1.5rem);
    background: var(--mem-panel-bg);
    border: 1px solid var(--mem-panel-border);
    border-radius: 1.5rem;
    box-shadow: var(--mem-panel-shadow);
    margin-bottom: clamp(72px, 8vw, 120px);
}

@media screen and (max-width: 640px) {
    .memorial-panel {
        margin-bottom: 1.5rem;
    }
}

.memorial-panel--compact {
    padding: clamp(0.75rem, 1.5vw, 1rem);
}

.memorial-section,
.section-panel {
    margin-bottom: 2.25rem;
    background: var(--mem-section-bg);
    border: 1px solid var(--mem-section-border);
    border-radius: 1.25rem;
    padding: clamp(1.2rem, 2vw, 1.75rem);
    box-shadow: var(--mem-section-shadow);
    color: var(--mem-section-text);
}

.memorial-section:last-child {
    margin-bottom: 0;
}

.memorial-section--flat {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1.5rem;
    overflow: visible;
}

.memorial-section--flat .memorial-section__title,
.memorial-section--flat .memorial-section__subtitle {
    color: var(--mem-section-title);
}

.memorial-section + .memorial-section {
    margin-top: 1.25rem;
}

.section-panel-inner {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.memorial-section__header {
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}

.memorial-section__header::after {
    content: '';
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: -0.4rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06), transparent);
}

.memorial-section__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.25rem 0;
    color: var(--mem-section-title);
}

.memorial-section__subtitle {
    font-size: 0.95rem;
    margin: 0;
    color: var(--mem-section-muted);
}

.memorial-section__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.72rem;
    color: var(--mem-section-muted);
}

.memorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.memorial-grid--large-gap {
    gap: 1.5rem;
}

.tribute-tabs {
    width: 100%;
    max-width: 50rem;
    margin: 0 auto;
}

.memorial-horizontal-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.memorial-horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.memorial-horizontal-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
}

.tab-header.memorial-tabs {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    padding: 0 0 0.4rem;
    background: transparent;
    border-bottom: 1px solid var(--mem-tab-border);
    scrollbar-width: none;
    position: relative;
}

.tab-header.memorial-tabs::-webkit-scrollbar {
    display: none;
}

.tab-header.memorial-tabs a {
    position: relative;
    text-decoration: none;
    color: var(--mem-tab-link);
    padding: 0.75rem 0;
    flex-shrink: 0;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.tab-header.memorial-tabs a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--mem-tab-link-active);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.tab-header.memorial-tabs a:hover,
.tab-header.memorial-tabs a:focus-visible {
    color: var(--mem-tab-link-hover);
}

.tab-header.memorial-tabs a:hover::after,
.tab-header.memorial-tabs a:focus-visible::after {
    transform: scaleX(1);
    opacity: 0.35;
}

.tab-header.memorial-tabs a.active {
    color: var(--mem-tab-link-active);
    font-weight: 600;
}

.tab-header.memorial-tabs a.active::after {
    transform: scaleX(1);
    opacity: 1;
}

@media screen and (max-width: 768px) {
    .tab-header.memorial-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .tab-header.memorial-tabs::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 3.25rem;
        height: 100%;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.25s ease;
        background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.25));
        mix-blend-mode: multiply;
    }

    .tab-header.memorial-tabs::before {
        content: '';
        position: absolute;
        top: 50%;
        right: 0.6rem;
        transform: translateY(-50%) rotate(-45deg);
        width: 0.55rem;
        height: 0.55rem;
        border-right: 2px solid var(--mem-tab-link);
        border-bottom: 2px solid var(--mem-tab-link);
        opacity: 0;
        transition: opacity 0.25s ease;
        z-index: 1;
    }

    .tab-header.memorial-tabs[data-scroll-hint="true"]::after {
        opacity: 1;
    }

    .tab-header.memorial-tabs[data-scroll-hint="true"]::before {
        opacity: 0.75;
    }

    .tab-header.memorial-tabs[data-scroll-hint-dismissed="true"]::after,
    .tab-header.memorial-tabs[data-scroll-hint="false"]::after,
    .tab-header.memorial-tabs[data-scroll-hint-dismissed="true"]::before,
    .tab-header.memorial-tabs[data-scroll-hint="false"]::before {
        opacity: 0;
    }
}

.timeline-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.timeline-preview-card {
    border-radius: 1rem;
    padding: 1.25rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    background: var(--mem-card-bg);
    border: 1px solid var(--mem-card-border);
    box-shadow: var(--mem-card-shadow);
}

.timeline-preview-card:hover {
    transform: translateY(-6px);
}

.timeline-preview-card__date {
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
    color: var(--mem-section-muted);
}

.timeline-preview-card__title {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
    color: var(--mem-section-text);
}

.timeline-card {
    background: var(--mem-card-bg);
    border: 1px solid var(--mem-card-border);
    box-shadow: var(--mem-card-shadow);
}

.memorial-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-radius: 1.25rem;
    border: 1px dashed var(--mem-divider-color);
}

.memorial-empty-state svg {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    color: var(--mem-section-muted);
}

.more-link {
    color: var(--mem-link-color);
    transition: color 0.2s ease;
}

.more-link:hover {
    color: var(--mem-link-hover);
}

.reply-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    color: var(--mem-section-muted);
    transition: color 0.2s ease;
}

.reply-button:hover {
    color: var(--mem-link-hover);
}

.tab-content {
    background: transparent;
    padding-top: 1.5rem;
    margin-top: 0.5rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-shell {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

@media screen and (max-width: 768px) {
    .tab-shell {
        padding: 0 1rem;
    }
}

.header-picture {
    height: 300px;
    width: 100%;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 0;
    margin: 0;
    padding: 0;
    transition: outline-color 0.3s ease;
    cursor: default;
    user-select: none;
    z-index: 1;
    display: block;
}

.header-picture.editing {
    outline: 2px solid var(--mem-hero-outline-edit);
    cursor: move;
    transition: none;
}

.header-picture.touching {
    outline: 2px solid var(--mem-hero-outline-touch);
    cursor: grabbing;
}

.header-picture.saving {
    opacity: 0.85;
    pointer-events: none;
}

.header-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    box-shadow: none;
}

.header-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -100px;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.header-container::after {
    content: none;
}

.header-container.editing .header-image-wrapper,
.header-container.touching .header-image-wrapper {
    transition: none;
}

.profile-picture-container {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: -115px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.profile-picture {
    width: 20rem;
    height: 20rem;
    border-radius: 50%;
    border: 5px solid var(--mem-profile-border);
    box-shadow: 0 12px 45px rgba(15, 18, 25, 0.25);
    object-fit: cover;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-picture:hover {
    transform: scale(1.05);
}

.icon-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.icon-controls i {
    background-color: var(--mem-hero-icon-bg);
    color: var(--mem-hero-icon-color);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.icon-controls i:hover {
    background-color: var(--mem-hero-icon-bg-hover);
    transform: scale(1.05);
}

.icon-controls i.hidden {
    display: none;
}

.memorial-hero {
    position: relative;
    text-align: center;
    margin-top: -3rem;
    padding: clamp(3.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 5vw, 3.5rem);
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: hidden;
}

.memorial-hero::before {
    content: none;
}

.memorial-hero > * {
    position: relative;
    z-index: 1;
}

@media (max-width: 640px) {
    .memorial-hero {
        margin-top: -2rem;
        padding: 3rem 1.25rem 2.5rem;
    }
}

.memorial-hero__eyebrow {
    font-size: 0.95rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--mem-section-muted);
    margin-bottom: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.memorial-hero__eyebrow::before,
.memorial-hero__eyebrow::after {
    content: '';
    display: block;
    height: 1px;
    width: 32px;
    background: var(--mem-divider-color);
    opacity: 0.6;
}

.memorial-hero__name {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 0.25rem;
    color: var(--mem-section-title);
}

.memorial-hero__dates {
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--mem-section-muted);
    font-size: 0.95rem;
}

.hero-meta {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    color: var(--mem-section-muted);
}

.hero-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.hero-meta__item i {
    color: var(--mem-section-muted);
}

.hero-actions {
    margin-top: 1.75rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.btn-custom--ghost {
    background: transparent;
    color: var(--mem-section-title);
    border: 1px solid var(--mem-panel-border);
    box-shadow: none;
}

.btn-custom--ghost:hover {
    background: var(--mem-tab-link-hover-bg, rgba(255, 255, 255, 0.08));
}

.btn-custom .btn-icon {
    display: inline-flex;
    margin-right: 0.5rem;
}

.reply-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--mem-section-muted);
    transition: color 0.2s ease;
}

.reply-button:hover {
    color: var(--mem-link-hover);
}

.like-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--mem-section-muted);
    transition: color 0.2s ease;
}

.like-button:hover {
    color: var(--mem-link-hover);
}

.tribute-card {
    border-radius: 1.25rem;
    border: 1px solid var(--mem-card-border);
    background: var(--mem-card-bg);
    box-shadow: var(--mem-card-shadow);
    padding: clamp(1.25rem, 2vw, 1.75rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tribute-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tribute-card__identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.tribute-avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.05rem;
    border: 2px solid var(--mem-panel-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--mem-section-title);
}

.tribute-card__media {
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--mem-panel-border);
    background: rgba(0,0,0,0.03);
}

.tribute-card__media img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

.tribute-card__body {
    font-size: 1rem;
    color: var(--mem-section-text);
    line-height: 1.7;
}

.tribute-card__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid var(--mem-panel-border);
    padding-top: 0.75rem;
}

.tribute-like-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--mem-section-muted);
}

.tributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tributes-section > h2 {
    color: var(--mem-section-title);
}

.reply-form {
    margin-top: 1rem;
}

.reply-form form {
    background: var(--mem-section-bg);
    border: 1px solid var(--mem-section-border);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: var(--mem-section-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reply-form input,
.reply-form textarea {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--mem-panel-border);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.65rem 0.85rem;
    color: var(--mem-section-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reply-form input:focus,
.reply-form textarea:focus {
    border-color: var(--mem-link-hover);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
    outline: none;
}

.reply-form input::placeholder,
.reply-form textarea::placeholder {
    color: var(--mem-section-muted);
    opacity: 0.8;
}

.reply-form .reply-button,
.reply-form button[type="submit"] {
    width: auto;
}

.reply-form .flex.justify-end {
    justify-content: flex-end;
    gap: 0.75rem;
}

.reply-form .flex.justify-end button {
    border-radius: 0.75rem;
}

.memorial-toast-stack {
    position: fixed;
    top: clamp(16px, 4vw, 32px);
    right: clamp(16px, 6vw, 48px);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    z-index: 2000;
    pointer-events: none;
}

@media screen and (max-width: 640px) {
    .memorial-toast-stack {
        top: auto;
        bottom: 1.25rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(92vw, 360px);
    }
}

.memorial-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 260px;
    max-width: 320px;
    padding: 0.95rem 1.1rem 0.95rem 1rem;
    border-radius: 1rem;
    background: var(--mem-card-bg);
    border: 1px solid var(--mem-panel-border);
    box-shadow: var(--mem-panel-shadow);
    color: var(--mem-section-text);
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(10px);
    animation: toastSlideIn 0.35s ease forwards;
    pointer-events: auto;
}

.memorial-toast__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.memorial-toast__body {
    flex: 1;
}

.memorial-toast__message {
    margin: 0;
    font-size: 0.95rem;
}

.memorial-toast__close {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.5;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.memorial-toast__close:hover {
    opacity: 1;
}

.memorial-toast--success {
    border-color: rgba(34, 197, 94, 0.25);
}

.memorial-toast--success .memorial-toast__icon {
    background: rgba(34, 197, 94, 0.15);
    color: #34d399;
}

.memorial-toast--error {
    border-color: rgba(239, 68, 68, 0.25);
}

.memorial-toast--error .memorial-toast__icon {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.memorial-toast--info {
    border-color: rgba(59, 130, 246, 0.25);
}

.memorial-toast--info .memorial-toast__icon {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.memorial-toast--warning {
    border-color: rgba(251, 191, 36, 0.3);
}

.memorial-toast--warning .memorial-toast__icon {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.memorial-toast--closing {
    animation: toastFadeOut 0.25s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

@media (max-width: 48rem) {
    .tab-header.memorial-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .tab-header.memorial-tabs a {
        padding: 0.5rem 0.75rem;
        flex-shrink: 0;
        min-width: auto;
        font-size: 0.95rem;
    }
}
  
.btn-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.35rem;
  border-radius: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  text-decoration: none;
}

.btn-custom:hover {
  transform: translateY(-1px);
}

.btn-custom:disabled,
.btn-custom[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media screen and (max-width: 768px) {
  /* Reduce overall content margins on mobile */
  .memorial-content {
    padding: 10px;
    padding-bottom: 2rem;
  }

  .memorial-panel {
    padding: 0.5rem;
    border-radius: 1rem;
  }

  .profile-picture-container {
    width: 260px;
    height: 260px;
    margin: -140px auto 24px;
  }

  .profile-picture {
    width: 260px;
    height: 260px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  /* Bio section mobile fixes */
  .bio-section p,
  .bio-content p {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  /* Section spacing on mobile - tighter */
  .memorial-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
  }

  .memorial-section__title {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
  }

  .memorial-section__header {
    margin-bottom: 0.5rem;
  }

  .memorial-section__header::after {
    bottom: -0.25rem;
  }

  /* Hero section mobile adjustments */
  .memorial-hero {
    padding: 2rem 0.75rem 1.5rem;
    margin-top: -1.5rem;
  }

  .memorial-hero__name {
    font-size: 1.75rem;
  }

  .memorial-hero__dates {
    font-size: 0.85rem;
  }

  .hero-meta {
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  .hero-meta__item {
    font-size: 0.85rem;
  }

  .hero-actions {
    margin-top: 1rem;
  }

  /* Tab spacing on mobile - tighter */
  .tab-shell {
    padding: 0 0.25rem;
  }

  .tab-content {
    padding-top: 1rem;
  }

  /* Tribute cards mobile */
  .tribute-card {
    padding: 0.75rem;
  }

  .tribute-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.85rem;
  }

  /* Grid gaps tighter */
  .memorial-grid {
    gap: 0.75rem;
  }

  .memorial-grid--large-gap {
    gap: 1rem;
  }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
  .memorial-content {
    padding: 6px;
  }

  .memorial-panel {
    padding: 0.35rem;
    border-radius: 0.75rem;
  }

  .memorial-section {
    padding: 0.6rem;
    margin-bottom: 0.75rem;
  }

  .memorial-hero {
    padding: 1.5rem 0.5rem 1rem;
  }

  .memorial-hero__name {
    font-size: 1.5rem;
  }

  .memorial-hero__eyebrow {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .btn-custom {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero-actions .btn-custom {
    width: 100%;
  }

  .tab-shell {
    padding: 0;
  }
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
/* Beautiful app-like fixed bottom nav for mobile only */

.mobile-bottom-nav {
  display: none;
}

@media screen and (max-width: 768px) {
  /* Hide the regular tab header on mobile */
  .tab-header.memorial-tabs {
    display: none !important;
  }

  /* Show bottom nav on mobile */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -8px 32px 0 rgba(0, 0, 0, 0.12), 0 -4px 16px 0 rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    padding: 0.35rem 0.5rem;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-evenly;
    align-items: stretch;
    gap: 0.25rem;
  }

  .mobile-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex: 1;
    padding: 0.3rem 0.2rem;
    border-radius: 0.65rem;
    text-decoration: none !important;
    color: var(--mem-section-muted);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    min-height: 44px;
    text-align: center;
    background: transparent;
    border: none;
  }

  .mobile-bottom-nav__item:hover,
  .mobile-bottom-nav__item:focus,
  .mobile-bottom-nav__item:visited {
    text-decoration: none !important;
  }

  .mobile-bottom-nav__item i {
    font-size: 1.25rem;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
  }

  .mobile-bottom-nav__item span {
    display: block;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none !important;
  }

  .mobile-bottom-nav__item:hover,
  .mobile-bottom-nav__item:active {
    color: var(--mem-tab-link-active);
  }

  .mobile-bottom-nav__item:hover i,
  .mobile-bottom-nav__item:active i {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateY(-1px);
  }

  .mobile-bottom-nav__item.active {
    color: var(--mem-section-title);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 
                0 2px 8px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }

  .mobile-bottom-nav__item.active i {
    background: transparent;
    transform: scale(1.05);
  }

  /* Add padding to bottom of content to prevent overlap with nav */
  .memorial-panel {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
  }

  .tab-content {
    padding-bottom: 1rem;
  }
}

/* Dark mode support for bottom nav */
[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(30, 35, 43, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 -20px 50px -12px rgba(0, 0, 0, 0.5), 0 -8px 24px -6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobile-bottom-nav__item {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .mobile-bottom-nav__item i {
  background: transparent;
}

[data-theme="dark"] .mobile-bottom-nav__item:hover i,
[data-theme="dark"] .mobile-bottom-nav__item:active i {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateY(-1px);
}

[data-theme="dark"] .mobile-bottom-nav__item.active {
  color: var(--mem-section-title);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
              0 2px 8px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .mobile-bottom-nav__item.active i {
  background: transparent;
  transform: scale(1.05);
}

.gallery-grid a,
.gallery-grid img {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-grid img {
    border-radius: 0.75rem;
    object-fit: cover;
    animation: galleryFadeIn 0.45s ease forwards;
    opacity: 0;
    transform: scale(0.98);
}

@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.timeline-container {
    position: relative;
    max-width: 1024px;
    margin: 0 auto;
    padding: 3rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: var(--mem-divider-color);
    z-index: 0;
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 1.5rem;
    box-sizing: border-box;
}

.timeline-item--left {
    padding-right: 3rem;
    text-align: right;
}

.timeline-item--right {
    margin-left: 50%;
    padding-left: 3rem;
}

.timeline-card {
    display: inline-block;
    background: var(--mem-card-bg);
    border: 1px solid var(--mem-card-border);
    box-shadow: var(--mem-card-shadow);
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.timeline-card::before {
    content: '';
    position: absolute;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--mem-section-bg);
    border: 2px solid var(--mem-divider-color);
    box-shadow: 0 0 0 4px var(--mem-panel-bg), 0 4px 10px rgba(0, 0, 0, 0.12);
    z-index: 2;
}

.timeline-item--left .timeline-card::before {
    right: -3.5rem;
}

.timeline-item--right .timeline-card::before {
    left: -3.5rem;
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mem-section-muted);
    margin-bottom: 0.35rem;
}

.timeline-text {
    margin: 0;
    color: var(--mem-section-text);
}

@media screen and (max-width: 768px) {
    .timeline-container {
        padding: 2rem 0;
    }

    .timeline-line {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    .timeline-item,
    .timeline-item--right,
    .timeline-item--left {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 2rem 1rem 1rem;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .timeline-card {
        position: relative;
        max-width: 280px;
        text-align: center;
        margin-top: 1rem;
    }

    .timeline-card::before {
        left: 50% !important;
        right: auto !important;
        top: -20px !important;
        transform: translateX(-50%) !important;
    }
}

.template-default #content,
.template-black #content {
    padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

@media screen and (max-width: 640px) {
    .template-default #content,
    .template-black #content {
        padding-bottom: 0;
    }
}

.timeline-container--preview {
    padding: 1.5rem 0;
}

.timeline-item--preview {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.timeline-container--preview .timeline-card {
    padding: 1.25rem;
}

/* ===== MOBILE TIMELINE FIX ===== */
/* Proper z-index layering to prevent line/dot from appearing over content */

.timeline-container {
    isolation: isolate;
}

.timeline-line {
    z-index: 0 !important;
}

.timeline-item {
    position: relative;
    z-index: 1;
}

.timeline-card {
    position: relative;
    z-index: 2;
}

.timeline-card::before {
    z-index: 3;
}

@media screen and (max-width: 768px) {
    /* Preview timeline on mobile - centered layout */
    .timeline-container--preview {
        padding: 1rem 0;
    }

    .timeline-container--preview .timeline-line {
        left: 50%;
        transform: translateX(-50%);
    }

    .timeline-container--preview .timeline-item,
    .timeline-container--preview .timeline-item--right,
    .timeline-container--preview .timeline-item--left {
        width: 100%;
        margin-left: 0;
        padding: 1.75rem 1rem 0.75rem;
        text-align: center;
        display: flex;
        justify-content: center;
    }

    .timeline-container--preview .timeline-card {
        display: block;
        max-width: 260px;
        width: 100%;
        background: var(--mem-card-bg);
        border: 1px solid var(--mem-card-border);
        box-shadow: var(--mem-card-shadow);
        text-align: center;
        position: relative;
    }

    .timeline-container--preview .timeline-card::before {
        left: 50%;
        right: auto;
        top: -1.25rem;
        transform: translateX(-50%);
        width: 12px;
        height: 12px;
    }

    /* Ensure text is always visible above the timeline line */
    .timeline-container--preview .timeline-date,
    .timeline-container--preview .timeline-text {
        position: relative;
        z-index: 5;
    }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
    .timeline-container--preview .timeline-line {
        left: 50%;
        transform: translateX(-50%);
    }

    .timeline-container--preview .timeline-item,
    .timeline-container--preview .timeline-item--right,
    .timeline-container--preview .timeline-item--left {
        padding: 1.5rem 0.5rem 0.5rem;
    }

    .timeline-container--preview .timeline-card {
        padding: 0.85rem;
        max-width: 240px;
    }

    .timeline-container--preview .timeline-card::before {
        left: 50%;
        top: -1rem;
        transform: translateX(-50%);
        width: 10px;
        height: 10px;
    }
}

/* Fix: Consistent form styling for tribute form - 2026-02-03 */
.add-tribute-section input,
.add-tribute-section textarea {
  background-color: #ffffff !important;
  color: #1f2937;
}

/* Fix: Remove underlines from mobile bottom nav spans */
.mobile-bottom-nav__item span {
  text-decoration: none !important;
}
