/* ============================================================
   MEMORIES  (/memories)
   full-width 3-column feed + modal composer.
   built on the shared neon-noir building blocks (.neon-panel,
   .np-bar, .np-body, .np-statusbar, .np-head) so it matches the
   rest of the site instead of inventing its own chrome.
   ============================================================ */

/* break out of the 1440px content cap — memories is a full-width page */
.bin-container:has(.mem-page) { max-width: none; }

.mem-page {
    width: 100%;
}

/* ---- header row: MEMORIES ............... [ + NEW ] --------- */
.mem-header {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.8rem;
}

.mem-header .np-head { margin: 0; }

/* the "+ NEW" trigger — pushed to the far right, styled like the homepage
   .btn-neon (transparent → fills with primary on hover). */
.mem-add {
    flex: none;
    margin-left: auto;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 14px;
    letter-spacing: 2px;
    line-height: 1;
    padding: 0.8rem 1.6rem;
    color: var(--c-primary);
    background: transparent;
    border: 1px solid var(--c-primary);
    transition: all 0.18s ease;
}

.mem-add:hover {
    background: var(--c-primary);
    color: var(--c-bg);
    box-shadow: 0 0 calc(18px * var(--glow, 0.7)) rgba(var(--c-primary-rgb), var(--glow, 0.7));
}

.mem-add:active { transform: translateY(1px); }

/* ---- subscribe window (floating, styled like the home desktop windows) ---- */
.mem-subwin {
    position: fixed; right: 22px; bottom: 22px; z-index: 60;
    width: 320px; max-width: calc(100vw - 32px);
    background: rgba(8, 8, 18, 0.96);
    border: 1px solid rgba(var(--c-primary-rgb), 0.5);
    box-shadow: 0 0 22px rgba(var(--c-primary-rgb), calc(var(--glow, 0.7) * 0.45));
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(14px) scale(0.98); pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.mem-subwin.show { opacity: 1; transform: none; pointer-events: auto; }
.mem-subwin.closing { opacity: 0; transform: translateY(10px) scale(0.98); pointer-events: none; }
.mem-subwin[hidden] { display: none; }
/* the little L-shaped corner accents the home windows have */
.mem-subwin::before, .mem-subwin::after { content: ""; position: absolute; width: 7px; height: 7px; border: 1px solid var(--c-secondary); opacity: 0.6; pointer-events: none; }
.mem-subwin::before { left: -1px; bottom: -1px; border-top: none; border-right: none; }
.mem-subwin::after { right: -1px; bottom: -1px; border-top: none; border-left: none; }

.mem-subwin-bar {
    display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.55rem; cursor: move; user-select: none;
    background: rgba(var(--c-primary-rgb), 0.16); border-bottom: 1px solid rgba(var(--c-primary-rgb), 0.4);
    font-family: var(--f-mono, monospace); font-size: 11px; letter-spacing: 1px; color: var(--c-primary); text-transform: uppercase;
}
.mem-subwin-bar > .pi { font-size: 13px; opacity: 0.95; }
.mem-subwin-bar .ttl { flex: 1; }
.mem-subwin-bar .x { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: none; color: var(--c-text); border: 1px solid rgba(var(--c-text-rgb), 0.3); }
.mem-subwin-bar .x .pi { font-size: 11px; }
.mem-subwin-bar .x:hover { color: var(--c-primary); border-color: var(--c-primary); }

.mem-subwin-body { padding: 0.85rem 0.9rem; display: flex; flex-direction: column; gap: 0.7rem; }
/* inside the narrow window everything stacks and is content-sized — the base
   `flex: 1 1 <Npx>` rules are for the old horizontal bar and would otherwise
   become giant flex-basis *heights* in this column layout (the "cooked" look) */
.mem-subwin .mem-sub-copy { flex: 0 0 auto; }
.mem-subwin .mem-sub-form { flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: 0.55rem; }
.mem-subwin .mem-sub-input { flex: 0 0 auto; width: 100%; }
.mem-subwin .mem-sub-status { flex: 0 0 auto; }
.mem-subwin .mem-sub-title { font-size: 13px; }

.mem-sub-copy { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 280px; min-width: 0; }

.mem-sub-title {
    font-family: var(--f-mono, monospace);
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--c-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.mem-sub-sub { font-family: var(--f-mono, monospace); font-size: 11px; color: var(--c-secondary); opacity: 0.85; }

.mem-sub-form { display: flex; align-items: stretch; gap: 0.5rem; flex: 1 1 320px; }

.mem-sub-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    background: rgba(var(--c-text-rgb), 0.06);
    border: 1px solid rgba(var(--c-primary-rgb), 0.35);
    color: var(--c-text);
    font-family: var(--f-mono, monospace);
    font-size: 13px;
    padding: 0.55rem 0.7rem;
}

.mem-sub-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 8px rgba(var(--c-primary-rgb), calc(var(--glow, 0.7) * 0.6));
}

.mem-sub-input::placeholder { color: rgba(var(--c-text-rgb), 0.4); }

/* matches the homepage windows' .netdesk .btn-neon: transparent w/ a pink
   border + text, fills pink with dark text and a glow on hover */
.mem-sub-btn {
    flex: none;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 13px;
    letter-spacing: 2px;
    padding: 0.62rem 1.2rem;
    color: var(--c-primary);
    background: transparent;
    border: 1px solid var(--c-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.18s ease;
}

.mem-sub-btn:hover { background: var(--c-primary); color: var(--c-bg); box-shadow: 0 0 calc(18px * var(--glow, 0.7)) rgba(var(--c-primary-rgb), var(--glow, 0.7)); }
.mem-sub-btn[disabled] { opacity: 0.55; cursor: wait; }

.mem-sub-status { flex: 1 1 100%; font-family: var(--f-mono, monospace); font-size: 11px; min-height: 14px; color: var(--c-secondary); }
.mem-sub-status.ok { color: var(--c-primary); }
.mem-sub-status.err { color: var(--c-secondary); opacity: 0.95; }

/* ---- 3-column masonry feed --------------------------------- */
.mem-grid {
    column-count: 3;
    column-gap: 1.3rem;
}

.mem-grid .mem-card {
    break-inside: avoid;
    margin: 0 0 1.3rem;
    width: 100%;
    display: inline-block; /* helps webkit avoid column breaks inside cards */
    animation: memIn 0.4s ease both;
}

@keyframes memIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* card title bar tweaks (extends shared .np-bar) */
.mem-card > .np-bar { justify-content: space-between; }
.mem-card .mem-card-kind { display: flex; align-items: center; gap: 0.4rem; }
.mem-card .mem-card-time {
    font-family: var(--f-mono, monospace);
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: none;
    color: var(--c-secondary);
    text-shadow: none;
    opacity: 0.85;
}

.mem-card-title {
    font-family: var(--f-head, 'Chakra Petch', sans-serif);
    font-size: 17px;
    color: var(--c-primary);
    text-shadow: 0 0 10px rgba(var(--c-primary-rgb), 0.4);
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

.mem-card-msg {
    font-family: var(--f-mono, monospace);
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--c-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    margin: 0;
}

.mem-card-media { margin-top: 0.85rem; }

.mem-card-media img {
    max-width: 100%;
    border: 1px solid rgba(var(--c-primary-rgb), 0.35);
    cursor: zoom-in;
    display: block;
    transition: box-shadow 0.18s ease;
}

.mem-card-media img:hover { box-shadow: 0 0 18px rgba(var(--c-primary-rgb), 0.45); }

/* audio / video are upgraded to the shared neon player (neon-media.js);
   just make those wrappers span the card. */
.mem-card-media .nm-audio,
.mem-card-media .nm-video { width: 100%; margin-top: 0.2rem; }
.mem-card-media .nm-video video { max-height: 460px; }

.mem-card-title.is-untitled {
    color: var(--c-secondary);
    font-style: italic;
    opacity: 0.75;
    text-shadow: none;
}

.mem-empty,
.mem-loading {
    font-family: var(--f-mono, monospace);
    color: rgba(var(--c-text-rgb), 0.55);
    text-align: center;
    padding: 3rem 1rem;
    column-span: all;
}

/* ---- modal composer ---------------------------------------- */
.mem-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(2, 2, 8, 0.78);
    backdrop-filter: blur(4px);
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem 2rem;
    overflow-y: auto;
}

.mem-modal-overlay.show { display: flex; animation: memFade 0.18s ease both; }

@keyframes memFade { from { opacity: 0; } to { opacity: 1; } }

.mem-modal {
    width: 100%;
    max-width: 600px;
    margin: 0;
    animation: memPop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes memPop {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mem-modal > .np-bar { justify-content: space-between; }

.mem-modal-close {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--c-primary);
    font-family: var(--f-mono, monospace);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
    transition: opacity .15s ease, text-shadow .15s ease;
}

.mem-modal-close:hover { opacity: 1; text-shadow: 0 0 8px var(--c-primary); }

.mem-composer-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.mem-label {
    font-family: var(--f-mono, monospace);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-secondary);
    margin-bottom: -0.4rem;
}

/* form controls (shared neon input look) */
.mem-input,
.mem-textarea,
.mem-pass {
    width: 100%;
    background: rgba(3, 3, 10, 0.85);
    border: 1px solid rgba(var(--c-primary-rgb), 0.3);
    color: var(--c-text);
    font-family: var(--f-mono, monospace);
    font-size: 15px;
    padding: 0.6rem 0.7rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.mem-textarea { resize: vertical; min-height: 130px; line-height: 1.55; }

.mem-input:focus,
.mem-textarea:focus,
.mem-pass:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 1px rgba(var(--c-primary-rgb), 0.35), 0 0 16px rgba(var(--c-primary-rgb), 0.22);
}

.mem-input::placeholder,
.mem-textarea::placeholder,
.mem-pass::placeholder { color: rgba(var(--c-text-rgb), 0.35); }

.mem-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.mem-btn {
    appearance: none;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 13px;
    letter-spacing: 1.5px;
    color: var(--c-primary);
    background: transparent;
    border: 1px solid var(--c-primary);
    padding: 0.6rem 1rem;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.mem-btn:hover {
    background: var(--c-primary);
    color: var(--c-bg);
    box-shadow: 0 0 calc(18px * var(--glow, 0.7)) rgba(var(--c-primary-rgb), var(--glow, 0.7));
}

.mem-btn:active { transform: translateY(1px); }

.mem-btn.is-recording {
    background: rgba(237, 79, 134, 0.28);
    border-color: #ff5d7d;
    box-shadow: 0 0 16px rgba(255, 93, 125, 0.55);
    animation: memPulse 1s ease-in-out infinite;
}

@keyframes memPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 93, 125, 0.4); }
    50%      { box-shadow: 0 0 22px rgba(255, 93, 125, 0.85); }
}

.mem-foot {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.mem-pass { flex: 1 1 160px; min-width: 140px; }

.mem-btn-primary {
    background: var(--c-primary);
    color: #0a0510;
    border-color: var(--c-primary);
    font-weight: 700;
}

.mem-btn-primary:hover { box-shadow: 0 0 18px rgba(var(--c-primary-rgb), 0.65); }

.mem-file-input { display: none; }

.mem-preview {
    display: none;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem;
    border: 1px dashed rgba(var(--c-primary-rgb), 0.4);
    background: rgba(3, 3, 10, 0.6);
}

.mem-preview.show { display: flex; }
.mem-preview img { max-height: 64px; max-width: 96px; border: 1px solid rgba(var(--c-primary-rgb), 0.4); }
.mem-preview video { max-height: 64px; max-width: 110px; border: 1px solid rgba(var(--c-primary-rgb), 0.4); background: #000; }
.mem-preview audio { height: 36px; max-width: 280px; }

.mem-preview-name {
    font-family: var(--f-mono, monospace);
    font-size: 12px;
    color: rgba(var(--c-text-rgb), 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.mem-preview-remove {
    margin-left: auto;
    cursor: pointer;
    color: #ff7a9c;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
}

.mem-status {
    font-family: var(--f-mono, monospace);
    font-size: 13px;
    color: var(--c-accent);
    min-height: 1.2em;
}

/* ---- pagination -------------------------------------------- */
.mem-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1.6rem;
    font-family: var(--f-mono, monospace);
    font-size: 13px;
    color: rgba(var(--c-text-rgb), 0.7);
}

.mem-pager button {
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    letter-spacing: 1.5px;
    color: var(--c-primary);
    background: transparent;
    border: 1px solid var(--c-primary);
    padding: 0.5rem 1rem;
    transition: all 0.18s ease;
}

.mem-pager button:hover:not(:disabled) { background: var(--c-primary); color: var(--c-bg); box-shadow: 0 0 calc(14px * var(--glow, 0.7)) rgba(var(--c-primary-rgb), var(--glow, 0.7)); }
.mem-pager button:disabled { opacity: 0.35; cursor: default; }

/* ---- per-card delete (admin, shown when X-Privacy unlocked) ---------- */
.mem-del {
    margin-left: auto;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ff7b7b;
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.55);
    padding: 0.2rem 0.5rem;
    transition: all 0.16s ease;
}

.mem-del:hover { background: #ff5b5b; color: var(--c-bg); border-color: #ff5b5b; box-shadow: 0 0 10px rgba(255, 91, 91, 0.55); }

/* ---- absolute timestamp line at the foot of each card --------------- */
.mem-card-stamp {
    margin-top: 0.8rem;
    padding-top: 0.55rem;
    border-top: 1px dashed rgba(var(--c-primary-rgb), 0.2);
    font-family: var(--f-mono, monospace);
    font-size: 10.5px;
    letter-spacing: 0.5px;
    color: var(--c-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mem-card-stamp-txt { flex: 1 1 auto; opacity: 0.7; }

/* admin "edit timestamp" affordance + inline date/time editor */
.mem-edit {
    flex: none;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--c-secondary);
    background: transparent;
    border: 1px solid rgba(var(--c-secondary-rgb), 0.55);
    padding: 0.2rem 0.5rem;
    transition: all 0.16s ease;
}
.mem-edit:hover { color: var(--c-primary); border-color: var(--c-primary); box-shadow: 0 0 8px rgba(var(--c-primary-rgb), 0.35); }

.mem-edit-row { display: none; flex-basis: 100%; align-items: center; gap: 0.4rem; margin-top: 0.45rem; }
.mem-edit-row.show { display: flex; }

.mem-edit-input {
    flex: 1 1 auto; min-width: 0;
    font-family: var(--f-mono, monospace);
    font-size: 12px;
    color: var(--c-text);
    background: rgba(3, 3, 10, 0.85);
    border: 1px solid rgba(var(--c-primary-rgb), 0.4);
    padding: 0.35rem 0.45rem;
    outline: none;
    color-scheme: dark;
}
.mem-edit-input:focus { border-color: var(--c-primary); box-shadow: 0 0 10px rgba(var(--c-primary-rgb), 0.25); }

.mem-edit-save {
    flex: none;
    cursor: pointer;
    font-family: var(--f-mono, monospace);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--c-primary);
    background: transparent;
    border: 1px solid var(--c-primary);
    padding: 0.35rem 0.7rem;
    transition: all 0.16s ease;
}
.mem-edit-save:hover { background: var(--c-primary); color: var(--c-bg); box-shadow: 0 0 12px rgba(var(--c-primary-rgb), 0.5); }

/* ---- lightbox ---------------------------------------------- */
.mem-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(2, 2, 8, 0.92);
    align-items: center;
    justify-content: center;
    padding: 3vh 3vw;
    cursor: zoom-out;
}

.mem-lightbox.show { display: flex; }

.mem-lightbox img {
    max-width: 94vw;
    max-height: 90vh;
    border: 1px solid rgba(var(--c-primary-rgb), 0.5);
    box-shadow: 0 0 40px rgba(var(--c-primary-rgb), 0.4);
}

/* ---- responsive columns ------------------------------------ */
@media (max-width: 1100px) {
    .mem-grid { column-count: 2; }
}

@media (max-width: 680px) {
    .mem-grid { column-count: 1; }
    .mem-add { width: 50px; height: 50px; font-size: 28px; }
    .mem-foot { flex-direction: column; align-items: stretch; }
    .mem-btn-primary { width: 100%; justify-content: center; }
}
