/* =========================================================
   MEAD HALL PROFILE
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;

    background-image:
        linear-gradient(
            rgba(0, 0, 0, 0.20),
            rgba(0, 0, 0, 0.40)
        ),
        url("../../main-page-background/back-ground-00.png");

    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    color: #e8dcc7;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
}


/* =========================================================
   HEADER
========================================================= */

.site-header {
    min-height: 74px;
    padding: 12px 5%;

    display: flex;
    align-items: center;
    gap: 35px;

    position: sticky;
    top: 0;
    z-index: 100;

    background: rgba(5, 5, 5, 0.92);
    border-bottom: 1px solid rgba(181, 138, 76, 0.35);

    backdrop-filter: blur(8px);
}

.logo {
    color: #d0a45f;

    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 3px;

    text-decoration: none;

    white-space: nowrap;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 24px;

    flex: 1;
}

.site-header nav a {
    color: #a99f90;
    text-decoration: none;
    font-size: 0.9rem;

    transition: color 0.2s ease;
}

.site-header nav a:hover {
    color: #e1c28d;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 14px;

    color: #d7c29f;
}

#header-display-name {
    font-weight: bold;
}

#logout-button {
    padding: 8px 14px;

    background: transparent;

    color: #b99a69;

    border: 1px solid #6d573b;
    border-radius: 4px;

    font-family: inherit;

    cursor: pointer;
}

#logout-button:hover {
    color: #f0dfc1;
    border-color: #b58a4c;
}


/* =========================================================
   PROFILE PAGE
========================================================= */

.profile-page {
    width: min(1200px, 94%);
    margin: 0 auto;
    padding: 45px 0 80px;
}


/* =========================================================
   PROFILE BANNER
========================================================= */

.profile-banner {
    min-height: 240px;
    padding: 38px;

    display: flex;
    align-items: flex-end;
    gap: 28px;

    position: relative;

    background:
        linear-gradient(
            90deg,
            rgba(8, 8, 8, 0.94),
            rgba(20, 14, 8, 0.78)
        );

    border: 1px solid rgba(181, 138, 76, 0.48);
    border-radius: 6px;

    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.65),
        inset 0 0 60px rgba(135, 83, 29, 0.08);
}

.profile-banner::before {
    content: "ᚠ  ᚢ  ᚦ  ᚨ  ᚱ  ᚲ";

    position: absolute;
    top: 24px;
    right: 30px;

    color: rgba(181, 138, 76, 0.16);

    font-size: clamp(1rem, 3vw, 2rem);
    letter-spacing: 12px;

    pointer-events: none;
}

.profile-avatar {
    width: 130px;
    height: 130px;

    flex-shrink: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            #3b2b1b,
            #17120d 65%
        );

    border: 3px solid #9b743e;

    box-shadow:
        0 0 0 5px rgba(0, 0, 0, 0.55),
        0 8px 25px rgba(0, 0, 0, 0.6);
}

#avatar-letter {
    color: #e4c58f;

    font-size: 3.5rem;
    font-weight: bold;
}

.profile-identity {
    flex: 1;
}

.profile-rune,
.small-rune {
    color: #a97e43;

    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 3px;
}

.profile-identity h1 {
    margin-top: 4px;

    color: #f0e4ce;

    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.05;
}

#profile-username {
    margin-top: 7px;

    color: #b99a69;
    font-size: 1rem;
}

#profile-joined {
    margin-top: 8px;

    color: #81796d;
    font-size: 0.85rem;
}

#edit-profile-button {
    padding: 11px 18px;

    background: rgba(0, 0, 0, 0.35);

    color: #d0ad75;

    border: 1px solid #80623d;
    border-radius: 4px;

    font-family: inherit;
    font-weight: bold;

    cursor: pointer;
}

#edit-profile-button:hover {
    border-color: #c29757;
    color: #f2dfba;
}


/* =========================================================
   PROFILE GRID
========================================================= */

.profile-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);

    gap: 24px;

    margin-top: 24px;
}

.profile-sidebar,
.profile-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}


/* =========================================================
   PANELS
========================================================= */

.profile-panel {
    padding: 25px;

    background: rgba(8, 8, 8, 0.91);

    border: 1px solid rgba(181, 138, 76, 0.34);
    border-radius: 5px;

    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);

    backdrop-filter: blur(7px);
}

.profile-panel h2 {
    color: #e6d5b8;
    font-size: 1.25rem;
}

.empty-text {
    margin-top: 14px;

    color: #81796d;
    font-size: 0.9rem;
}

#edit-bio-button {
    margin-top: 18px;
    padding: 8px 13px;

    background: transparent;

    color: #b99a69;

    border: 1px solid #5e4b34;
    border-radius: 4px;

    font-family: inherit;

    cursor: pointer;
}

#edit-bio-button:hover {
    border-color: #a77a3c;
}


/* =========================================================
   CONNECTIONS
========================================================= */

.profile-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 13px 0;

    border-bottom: 1px solid rgba(181, 138, 76, 0.13);
}

.profile-stat:last-child {
    border-bottom: none;
}

.profile-stat strong {
    color: #d4b47f;
    font-size: 1.1rem;
}

.profile-stat span {
    color: #8e8578;
    font-size: 0.85rem;
}


/* =========================================================
   PANEL HEADINGS
========================================================= */

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 24px;
}


/* =========================================================
   SAGA CHARACTER
========================================================= */

.no-character {
    padding: 42px 20px;

    text-align: center;

    border: 1px dashed rgba(181, 138, 76, 0.32);
    border-radius: 5px;

    background: rgba(0, 0, 0, 0.22);
}
.character-summary { display: flex; align-items: center; gap: 22px; padding: 20px; border: 1px solid #775934; border-radius: 5px; background: #14100d; }
.character-summary[hidden] { display: none; }
.character-summary img { width: 120px; height: 120px; object-fit: cover; object-position: center 20%; border-radius: 8px; border: 2px solid #9d783d; }
.character-summary h3 { color: #e8d5b2; }
.character-summary p { margin: 7px 0; white-space: pre-wrap; }
.character-summary a { color: #d9ad6c; }
@media(max-width:480px){.character-summary { flex-direction: column; align-items: start; }}

.character-symbol {
    margin-bottom: 12px;

    color: #b58a4c;
    font-size: 3rem;
}

.no-character h3 {
    color: #e0cfb2;
    font-size: 1.35rem;
}

.no-character p {
    max-width: 550px;
    margin: 12px auto 24px;

    color: #8e8578;
}

#create-character-button,
#new-saga-button {
    padding: 11px 18px;

    background:
        linear-gradient(
            180deg,
            #8d632e,
            #62421f
        );

    color: #fff1d7;

    border: 1px solid #c29757;
    border-radius: 4px;

    font-family: inherit;
    font-weight: bold;

    cursor: pointer;
}

#create-character-button:hover,
#new-saga-button:hover {
    filter: brightness(1.15);
}

/* =========================================================
   POEMS
========================================================= */

.poem-card {
    position: relative;

    padding: 38px 55px 34px;

    background:
        radial-gradient(
            circle at center,
            rgba(40, 29, 20, 0.82),
            rgba(10, 8, 7, 0.96)
        );

    border:
        1px solid rgba(181, 138, 76, 0.42);

    text-align: center;

    overflow: hidden;
}


/* Decorative top ornament */

.poem-card::before {
    content: "❦";

    display: block;

    margin-bottom: 12px;

    color: #b58a4c;

    font-size: 1.7rem;

    opacity: 0.8;
}


/* POEM label */

.poem-card .saga-type {
    display: block;

    color: #c79b5c;

    font-size: 0.72rem;

    letter-spacing: 5px;

    text-transform: uppercase;
}


/* Poem title */

.poem-card h3 {
    margin-top: 18px;

    color: #ead8b9;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 1.8rem;

    font-style: italic;

    font-weight: normal;

    letter-spacing: 1px;
}


/* Published date */

.poem-card .saga-date {
    margin-top: 8px;

    color: #766c60;

    font-size: 0.75rem;
}


/* Actual poem */

.poem-card .saga-preview {
    max-width: 620px;

    margin:
        30px
        auto
        25px;

    color: #d5c5ac;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 1.08rem;

    font-style: italic;

    line-height: 2;

    letter-spacing: 0.3px;

    white-space: pre-wrap;
}


/* Little ornament underneath poem */

.poem-card .saga-preview::after {
    content: "✦  ❦  ✦";

    display: block;

    margin-top: 28px;

    color: #8d6b3d;

    font-size: 0.8rem;

    letter-spacing: 7px;
}


/* Keep buttons centered */

.poem-card .saga-card-actions {
    justify-content: center;

    margin-top: 24px;
}


/* Published / Draft badge */

.poem-card .saga-status {
    position: absolute;

    top: 20px;
    right: 20px;
}

/* =====================================================
   JOURNAL CARD DETAILS
===================================================== */

.journal-card-details {
    margin: 14px 0 18px;
    padding: 14px 16px;

    border-top: 1px solid rgba(184, 134, 63, 0.35);
    border-bottom: 1px solid rgba(184, 134, 63, 0.35);

    font-family: Georgia, "Times New Roman", serif;
}

.journal-card-datetime {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;

    margin-bottom: 10px;

    font-size: 0.9rem;
    color: #b89b72;
}

.journal-card-feeling,
.journal-card-subject {
    margin-top: 6px;

    font-size: 0.95rem;
    color: #d8c7ad;
}

.journal-card-feeling strong,
.journal-card-subject strong {
    margin-right: 6px;

    color: #b8863f;
    letter-spacing: 0.04em;
}


/* =========================================================
   STORIES
========================================================= */

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

.saga-card {
    padding: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(26, 20, 13, 0.72),
            rgba(7, 7, 7, 0.82)
        );

    border: 1px solid rgba(181, 138, 76, 0.30);
    border-radius: 5px;
}

.saga-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 15px;

    margin-bottom: 10px;
}

.saga-type {
    color: #a97e43;

    font-size: 0.7rem;
    font-weight: bold;

    letter-spacing: 2px;

    text-transform: uppercase;
}

.saga-status {
    padding: 4px 9px;

    border-radius: 20px;

    color: #a99f90;

    border: 1px solid #554736;

    font-size: 0.7rem;

    text-transform: uppercase;
}

.saga-status.published {
    color: #c8d9b3;

    border-color:
        rgba(90, 140, 70, 0.55);
}

.saga-status.draft {
    color: #d6bc91;

    border-color:
        rgba(181, 138, 76, 0.45);
}

.saga-card h3 {
    color: #ead8b9;

    font-size: 1.35rem;
}

.saga-date {
    margin-top: 3px;

    color: #6f675d;

    font-size: 0.78rem;
}

.saga-preview {
    margin: 16px 0;

    color: #aaa092;

    line-height: 1.7;
}

.saga-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;

    margin-top: 17px;
}

.edit-saga-button,
.delete-saga-button {
    padding: 9px 14px;

    background: transparent;

    border-radius: 4px;

    font-family: inherit;

    cursor: pointer;
}

.edit-saga-button {
    color: #c8b185;

    border: 1px solid #66583f;
}

.edit-saga-button:hover {
    color: #f0dab0;

    border-color: #a88955;
}

.delete-saga-button {
    color: #b97970;

    border: 1px solid #68403b;
}

.delete-saga-button:hover {
    color: #e6a49b;

    border-color: #a65e55;
}

.delete-saga-button:disabled {
    opacity: 0.45;

    cursor: not-allowed;
}

.read-saga-button {
    padding: 9px 14px;

    background: transparent;

    color: #c29b63;

    border: 1px solid #685239;
    border-radius: 4px;

    font-family: inherit;

    cursor: pointer;
}

.read-saga-button:hover {
    color: #f0d9b2;

    border-color: #b58a4c;
}

.empty-feed {
    padding: 40px 20px;

    text-align: center;

    background: rgba(0, 0, 0, 0.20);

    border: 1px dashed rgba(181, 138, 76, 0.25);
    border-radius: 5px;
}

.empty-feed p {
    color: #c8b18b;
    font-size: 1.05rem;
}

.empty-feed span {
    display: block;
    margin-top: 6px;

    color: #746d63;
    font-size: 0.85rem;
}


/* =========================================================
   MESSAGE
========================================================= */

.profile-message {
    display: none;

    position: fixed;
    bottom: 25px;
    left: 50%;

    transform: translateX(-50%);

    padding: 13px 20px;

    background: rgba(10, 10, 10, 0.95);

    color: #dfc69c;

    border: 1px solid #80623d;
    border-radius: 4px;

    z-index: 500;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 850px) {

    .site-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .site-header nav {
        order: 3;
        width: 100%;

        overflow-x: auto;
    }

    .profile-banner {
        align-items: center;
        flex-direction: column;

        text-align: center;
    }

    #edit-profile-button {
        width: 100%;
    }

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

@media (max-width: 500px) {

    .profile-page {
        width: 96%;
        padding-top: 20px;
    }

    .profile-banner {
        padding: 28px 20px;
    }

    .profile-avatar {
        width: 105px;
        height: 105px;
    }

    .profile-panel {
        padding: 20px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    #new-saga-button {
        width: 100%;
    }
}

/* =========================================================
   EDIT PROFILE MODAL
========================================================= */

.edit-profile-overlay {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 1000;

    justify-content: center;
    align-items: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.78);

    backdrop-filter: blur(5px);
}

.edit-profile-overlay.open {
    display: flex;
}

.edit-profile-modal {
    position: relative;

    width: min(560px, 100%);

    padding: 35px;

    background:
        linear-gradient(
            145deg,
            rgba(20, 16, 11, 0.98),
            rgba(7, 7, 7, 0.98)
        );

    border: 1px solid #8b673b;
    border-radius: 6px;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.85),
        inset 0 0 40px rgba(181, 138, 76, 0.07);
}

.edit-profile-modal h2 {
    margin: 5px 0 25px;

    color: #f0e4ce;

    font-size: 2rem;
}

.close-edit-profile {
    position: absolute;

    top: 13px;
    right: 17px;

    background: transparent;
    border: none;

    color: #8f806d;

    font-size: 2rem;

    cursor: pointer;
}

.close-edit-profile:hover {
    color: #e0c18c;
}

.edit-form-group {
    margin-bottom: 22px;
}

.edit-form-group label {
    display: block;

    margin-bottom: 7px;

    color: #d7c29f;

    font-weight: bold;
}

.edit-form-group input,
.edit-form-group textarea {
    width: 100%;

    padding: 13px 14px;

    background: rgba(0, 0, 0, 0.45);

    color: #eee2cf;

    border: 1px solid #554736;
    border-radius: 4px;

    font: inherit;

    outline: none;
}

.edit-form-group textarea {
    resize: vertical;

    min-height: 130px;
}

.edit-form-group input:focus,
.edit-form-group textarea:focus {
    border-color: #b58a4c;

    box-shadow:
        0 0 0 3px rgba(181, 138, 76, 0.10);
}

.bio-label-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

#bio-character-count {
    color: #786f63;

    font-size: 0.8rem;
}

.edit-profile-actions {
    display: flex;
    justify-content: flex-end;

    gap: 12px;

    margin-top: 25px;
}

.cancel-edit-button,
.save-profile-button {
    padding: 11px 18px;

    border-radius: 4px;

    font-family: inherit;
    font-weight: bold;

    cursor: pointer;
}

.cancel-edit-button {
    background: transparent;

    color: #aaa092;

    border: 1px solid #554b3e;
}

.save-profile-button {
    background:
        linear-gradient(
            180deg,
            #8d632e,
            #62421f
        );

    color: #fff1d7;

    border: 1px solid #c29757;
}

.save-profile-button:hover {
    filter: brightness(1.15);
}

.save-profile-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.edit-profile-message {
    display: none;

    padding: 10px;

    border-radius: 4px;

    text-align: center;
}

.edit-profile-message.error {
    display: block;

    color: #e6b0a9;

    background: rgba(120, 25, 25, 0.25);

    border: 1px solid rgba(190, 70, 60, 0.45);
}

.edit-profile-message.success {
    display: block;

    color: #c8d9b3;

    background: rgba(45, 90, 35, 0.25);

    border: 1px solid rgba(90, 140, 70, 0.45);
}


.saga-card-photo { display: block; width: min(100%, 260px); height: 160px; margin: 14px 0; border-radius: 6px; object-fit: cover; }
.profile-library-button { display: inline-block; padding: 10px 14px; border: 1px solid #b58a4c; border-radius: 5px; background: #6b491f; color: #fff1d2; text-decoration: none; white-space: nowrap; }
.profile-library-button:hover { background: #8b602b; }
.library-post { padding: 18px; border: 1px solid #745333; border-radius: 7px; background: #15100d; }
.library-post-link { display: flex; align-items: center; gap: 24px; color: #efd9b1; text-decoration: none; }
.library-post-link:hover .library-cupboard,.library-post-link:focus-visible .library-cupboard { box-shadow: 0 0 0 3px #d1a765,0 10px 18px #0009; }
.library-cupboard { display: grid; gap: 7px; flex: 0 0 150px; width: 150px; padding: 12px; border: 9px ridge #86512b; border-radius: 6px; background: #28130f; box-shadow: 0 10px 18px #0009; }
.library-cupboard-shelf { display: flex; align-items: end; justify-content: space-around; height: 43px; border-bottom: 7px solid #a16036; background: #432015; }
.library-cupboard-shelf span { width: 14px; height: 30px; border-radius: 2px 3px 0 0; background: #894436; box-shadow: inset 3px 0 #d39a54; }
.library-cupboard-shelf span:nth-child(2n) { height: 35px; background: #4f6d59; }
.library-cupboard-shelf span:nth-child(3n) { height: 27px; background: #685277; }
.library-post-caption { display: grid; gap: 10px; font-size: 1.1rem; }
.library-post-caption strong { font-size: 1.5rem; }
.library-post-caption span { color: #caa976; text-decoration: underline; }
.library-post-remove { margin-top: 15px; padding: 7px 10px; border: 1px solid #8c683d; border-radius: 4px; background: #382619; color: #f3ddba; cursor: pointer; }
@media(max-width:480px){.library-post-link { flex-direction: column; align-items: start; }}
@media(max-width:900px){.profile-banner { flex-wrap: wrap; }.profile-library-button { text-align: center; }}
@media(max-width:768px){.profile-library-button { width: 100%; }}

.saga-card-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-width: 520px; margin: 14px 0; }
.saga-card-gallery .saga-card-photo { width: 100%; height: 120px; margin: 0; }

.profile-avatar { overflow: hidden; }
#profile-avatar-image { width: 100%; height: 100%; object-fit: cover; }
#profile-avatar-image[hidden], #avatar-letter[hidden], #edit-profile-photo-preview[hidden], #edit-profile-photo-letter[hidden] { display: none; }
.edit-photo-preview { width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin: 0 0 12px; border: 2px solid #9b743e; border-radius: 50%; background: #23190f; color: #e4c58f; font-size: 2.2rem; }
.edit-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-form-group input[type="file"] { padding: 10px; font-size: .9rem; }
.photo-help { margin: 7px 0 0; color: #a99a85; font-size: .85rem; }
.profile-stat a { color: #bfa57d; text-decoration: none; }
.profile-stat a:hover { color: #eed6ab; text-decoration: underline; }
