/* ── Reset & Base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
.tws-page { background: #f4f4f9; min-height: 100vh; font-family: inherit; }


/* ── Hero ─────────────────────────────────────────────────────────────────── */
.tws-hero {
    position: relative;
    overflow: hidden;
    min-height: 480px;
    background: linear-gradient(135deg,#1a1228 0%,#3d2a1a 100%);
    background-size: cover;
    background-position: center top;
}
.tws-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0.25) 100%);
}
.tws-hero-ann {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
}
.tws-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 32px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    z-index: 2;
}

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.tws-avatar {
    width: 115px;
    height: 115px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.35);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.tws-avatar-initials {
    background: #5b4b8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 500;
    color: #fff;
}

/* ── Hero text ────────────────────────────────────────────────────────────── */
.tws-hero-info { flex: 1; }
.tws-hero-label {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    margin-bottom: 5px;
    letter-spacing: 0.3px;
}
.tws-hero-name {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff !important;
    margin-bottom: 6px;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.tws-hero-lifespan {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
    font-weight: 400;
}
.tws-hero-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tws-chip {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.12);
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
}
.tws-chip svg { opacity: 0.8; flex-shrink: 0; }

/* ── Anniversary badges ───────────────────────────────────────────────────── */
.tws-ann {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
}
.tws-ann-today    { background: #5b4b8a; color: #fff; }
.tws-ann-upcoming { background: #EEEDFE; color: #534AB7; }
.tws-ann-ago      { background: #E1F5EE; color: #0F6E56; }
.tws-ann-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Action bar ───────────────────────────────────────────────────────────── */
.tws-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: #fff;
    border-bottom: 0.5px solid #e8e4f4;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 10px rgba(0,0,0,0.07);
}
.tws-action-left  { display: flex; align-items: center; gap: 12px; }
.tws-action-right { display: flex; align-items: center; gap: 8px; }

/* ── Buttons — clean minimal single colour ────────────────────────────────── */
.tws-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 20px;
    border-radius: 20px;
    border: 1.5px solid #e0dced;
    background: #fff;
    color: #5b4b8a;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1;
}
.tws-btn svg { flex-shrink: 0; }
.tws-btn:hover { background: #f4f2fc; border-color: #c0b8e8; color: #5b4b8a; }

.tws-btn-candle {
    background: #5b4b8a;
    border-color: #5b4b8a;
    color: #fff;
}
.tws-btn-candle:hover { background: #4a3a72; border-color: #4a3a72; color: #fff; }
.tws-btn-candle.lit   { background: #b07d2a; border-color: #b07d2a; color: #fff; }

.tws-btn-primary {
    background: #5b4b8a;
    border-color: #5b4b8a;
    color: #fff;
}
.tws-btn-primary:hover { background: #4a3a72; }

.tws-btn-share { color: #5b4b8a; }
.tws-btn-edit  { color: #5b4b8a; }

.tws-candle-count {
    font-size: 13px;
    color: #999;
    font-weight: 400;
}

/* — Candle users modal */
.tws-candle-count-inline {
    cursor: pointer;
    text-decoration: none;
}
.tws-candle-count-inline:hover strong {
    text-decoration: underline;
}
.tws-who-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.tws-who-modal.hidden { display: none; }
.tws-who-inner {
    background: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0 0 32px;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
}
.tws-who-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 0.5px solid #ece9f5;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.tws-who-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1228;
    margin: 0;
}
.tws-who-close {
    background: #f0ecfb;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5b4b8a;
    font-size: 16px;
    line-height: 1;
}
.tws-who-list {
    padding: 8px 0;
}
.tws-who-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
}
.tws-who-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.tws-who-item-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #5b4b8a;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tws-who-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1228;
}
.tws-who-empty {
    padding: 24px 20px;
    color: #aaa;
    font-size: 14px;
    text-align: center;
}

/* ── Share panel ──────────────────────────────────────────────────────────── */
.tws-share-wrap { position: relative; }
.tws-share-panel {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    background: #fff;
    border: 0.5px solid #e0dced;
    border-radius: 14px;
    min-width: 210px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    overflow: hidden;
    z-index: 200;
}
.tws-share-panel.open { display: block; }
.tws-share-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.tws-share-item:hover { background: #f8f7fc; }
.tws-share-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.tws-share-divider { height: 0.5px; background: #e8e4f4; margin: 4px 0; }

/* ── Body ─────────────────────────────────────────────────────────────────── */
/* Align body content width to match hero text column */
.tws-body {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
   }

@media (max-width: 768px) {
    .tws-body {
        padding-left: 16px;
        padding-right: 16px;
          }
}


/* ── Meta cards ───────────────────────────────────────────────────────────── */
.tws-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.tws-meta-card {
    background: #fff;
    border: 0.5px solid #e8e4f4;
    border-radius: 12px;
    padding: 14px 16px;
}
.tws-meta-label {
    font-size: 11px;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 500;
}
.tws-meta-value {
    font-size: 14px;
    color: #2a2040;
    font-weight: 500;
}

/* ── Candle box ───────────────────────────────────────────────────────────── */
//* Candle box */
/* iOS Safari candle box card fix */
.tws-candle-box {
    background: #ffffff;
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
    border: 1px solid #ece9f5;
    border-radius: 12px;
    -webkit-border-radius: 12px;
    padding: 14px 16px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-flex-wrap: nowrap;
    flex-wrap: nowrap;
    margin-bottom: 16px;
    position: relative;
    z-index: 0;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Tribute section title top spacing */
.tws-section-title {
    margin-top: 8px;
}

.tws-candle-box-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Stacked avatars */
.tws-candle-avatars {
    display: flex;
    align-items: center;
}
.tws-candle-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid #fff;
    margin-left: -10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    flex-shrink: 0;
}
.tws-candle-avatars .tws-candle-avatar:first-child {
    margin-left: 0;
}
.tws-candle-overflow {
    background: #e8e4f4;
    color: #5b4b8a;
    font-size: 11px;
    font-weight: 700;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

/* Flame + count */
.tws-candle-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.tws-candle-count-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    font-weight: 400;
    color: #2a2040;
}
.tws-flame-icon {
    color: #5b4b8a;
    flex-shrink: 0;
}
.tws-candle-label {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

/* Hide old large count */
.tws-candle-count { display: none; }

/* ── Content sections ─────────────────────────────────────────────────────── */
.tws-section { margin-bottom: 32px; }
.tws-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1228;
    padding-bottom: 12px;
    border-bottom: 0.5px solid #e8e4f4;
    margin-bottom: 18px;
}
.tws-content {
    font-size: 15px;
    color: #444;
    line-height: 1.85;
}
.tws-content p { margin-bottom: 14px; }
.tws-content p:last-child { margin-bottom: 0; }

/* ── Condolences ──────────────────────────────────────────────────────────── */
.tws-cond-form {
    background: #f8f7fc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 0.5px solid #e8e4f4;
}
.tws-cond-input {
    width: 100%;
    border: 0.5px solid #e0dced;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    background: #fff;
    color: #333;
    resize: none;
    outline: none;
    line-height: 1.6;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.tws-cond-input:focus { border-color: #5b4b8a; }
.tws-cond-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.tws-cond-hint  { font-size: 12px; color: #c0b8d0; }
.tws-login-prompt {
    background: #f8f7fc;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    border: 0.5px solid #e8e4f4;
}
.tws-login-prompt p { font-size: 13px; color: #888; margin-bottom: 14px; }
.tws-cond-list  { display: flex; flex-direction: column; gap: 10px; }
.tws-cond-card  {
    background: #fff;
    border: 0.5px solid #e8e4f4;
    border-radius: 12px;
    padding: 14px 16px;
}
.tws-cond-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.tws-cond-av   { width: 32px !important; height: 32px !important; border-radius: 50% !important; }
.tws-cond-name { font-size: 13px; font-weight: 500; color: #333; }
.tws-cond-time { font-size: 11px; color: #bbb; margin-left: auto; }
.tws-cond-text { font-size: 13px; color: #555; line-height: 1.65; }
.tws-cond-empty { font-size: 13px; color: #bbb; font-style: italic; text-align: center; padding: 20px 0; }

/* ── Related tributes ─────────────────────────────────────────────────────── */
.tws-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.tws-rel-card {
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    display: block;
    position: relative;
    transition: transform 0.2s;
}
.tws-rel-card:hover { transform: translateY(-2px); }
.tws-rel-img        { width: 100%; height: 120px; object-fit: cover; display: block; }
.tws-rel-placeholder { height: 120px; background: linear-gradient(135deg,#1a1228,#2d1f3d); }
.tws-rel-overlay    { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.88), transparent 60%); }
.tws-rel-content    { position: absolute; bottom: 28px; left: 0; right: 0; padding: 0 12px; }
.tws-rel-label      { font-size: 10px; color: rgba(255,255,255,0.5); margin-bottom: 2px; }
.tws-rel-name       { font-size: 13px; font-weight: 500; color: #fff; line-height: 1.3; }
.tws-rel-footer     { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 6px 12px; background: rgba(0,0,0,0.45); }
.tws-rel-footer span { font-size: 11px; color: rgba(255,255,255,0.55); }



/* ── Addon Relation on hero section tributes ─────────────────────────────────────────────────────── */
.tws-hero-author {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    padding: 5px 10px 5px 6px;
    border-radius: 20px;
}

.tws-hero-posted-by {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.tws-hero-author img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.tws-hero-author-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.tws-rel-card {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;          /* keeps the image corners rounded */
}

/* Fixed thumbnail height — the whole card becomes this tall */
.tws-rel-img {
    width: 100%;
    height: 220px;             /* ← adjust to taste */
    object-fit: cover;         /* fills the box, crops overflow, no distortion */
    display: block;
}

.tws-rel-placeholder {
    background: #2a2340;        /* fallback colour when a post has no image */
}

/* Gradient overlay — transparent at top, dark at the bottom */
.tws-rel-overlay {
    position: absolute;
    inset: 0;                  /* covers the whole card */
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.98) 0%,
        rgba(0,0,0,0.55) 30%,
        rgba(0,0,0,0) 60%
    );
    pointer-events: none;      /* clicks pass through to the card link */
}

/* Text sits above the gradient, pinned to the bottom */
.tws-rel-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5px;              /* leaves room for the footer row below */
    padding: 0 16px;
    z-index: 2;
    color: #fff;
}

.tws-rel-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    padding: 0 16px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tws-hero         { height: 320px; }
    .tws-hero-content { padding: 20px 16px; gap: 14px; }
    .tws-hero-name    { font-size: 22px; }
    .tws-avatar       { width: 91px; height: 91px; }
    .tws-action-bar   { padding: 10px 16px; }
    .tws-meta-grid    { grid-template-columns: repeat(2, 1fr); }
    .tws-body         { padding: 20px 14px 60px; }
    .tws-related-grid { grid-template-columns: repeat(2, 1fr); }
    .tws-btn          { padding: 8px 14px; font-size: 12px; }
}
@media (max-width: 480px) {
    .tws-hero         { height: 280px; }
    .tws-hero-content { flex-direction: column; align-items: flex-start; gap: 10px; padding-bottom: 16px; }
    .tws-avatar       { width: 82px; height: 82px; }
    .tws-hero-name    { font-size: 20px; }
    .tws-meta-grid    { grid-template-columns: 1fr 1fr; }
    .tws-related-grid { grid-template-columns: 1fr 1fr; }
    .tws-action-bar   { flex-wrap: wrap; gap: 8px; }
    .tws-action-right { flex-wrap: wrap; }
    .tws-candle-count { display: none; }
    .tws-hero-chips{ margin-bottom: 60px;  display: flex;
    gap: 8px;
    flex-wrap: wrap; }
    .container, .container-fluid {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}
}
