/* ==========================================================================
   Journals - member entries in The Library.

   Loaded on the Journals pages and on the Stories index (for the shared
   Stories | Journals tab strip). Always loaded AFTER css/story.css, whose
   .story-grid / .story-card / .story-badge / .setting-btn rules it reuses
   rather than copies, so a journal card and a story card are the same family.

   Only what is genuinely different lives here: the wide cover, the tag chips,
   the tab strip, the entry's reading column, the editor (toolbar, picture tray,
   preview) and the visitors' copy at /explore/journals, which loads this file
   too.

   Plain CSS on purpose. public/build/ is a prebuilt Tailwind bundle (see the
   note at the top of story.css), so a utility class that is not already in it
   does nothing in production.
   ========================================================================== */

/* ---------- The Stories | Journals tab strip ---------------------------- */

.jn-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 245, 255, 0.14);
}

.jn-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: rgba(200, 216, 248, 0.62);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.jn-tab:hover {
    color: #00f5ff;
    background: rgba(0, 245, 255, 0.05);
}

.jn-tab.is-active {
    color: #00f5ff;
    background: rgba(0, 245, 255, 0.08);
    border-color: rgba(0, 245, 255, 0.28);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.4);
}

/* ---------- Cards ------------------------------------------------------- */

.jn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 1.25rem;
}

/* A journal cover is a banner, not a book jacket. */
.jn-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 25% 30%, rgba(255, 45, 120, 0.10), transparent 60%),
        linear-gradient(160deg, #0b0b22 0%, #14142f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(0, 245, 255, 0.14);
    text-decoration: none;
}

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

.jn-cover-fallback {
    font-size: 2.4rem;
    color: rgba(255, 45, 120, 0.55);
}

.jn-byline {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: rgba(200, 216, 248, 0.62);
    line-height: 1.6;
}

/* ---------- Tags -------------------------------------------------------- */

.jn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.jn-tag {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border: 1px solid rgba(0, 245, 255, 0.28);
    border-radius: 999px;
    background: rgba(0, 245, 255, 0.05);
    color: rgba(0, 245, 255, 0.88);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    line-height: 1.5;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.jn-tag:hover {
    border-color: #00f5ff;
    background: rgba(0, 245, 255, 0.13);
    color: #fff;
}

.jn-tag.is-active {
    border-color: #ff2d78;
    background: rgba(255, 45, 120, 0.12);
    color: #ff2d78;
}

.jn-tag-count {
    opacity: 0.55;
    margin-left: 0.2rem;
}

/* ---------- Search ------------------------------------------------------ */

.jn-search {
    display: flex;
    gap: 0.4rem;
    flex: 1 1 14rem;
    min-width: 12rem;
}

.jn-search input[type='search'] {
    flex: 1;
    min-width: 0;
}

/* ---------- The entry ---------------------------------------------------- */

.jn-banner {
    aspect-ratio: 16 / 9;
    max-height: 24rem;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid rgba(0, 245, 255, 0.18);
    background: #0b0b22;
}

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

/* The text itself: a calm column. Neon-on-black is for the chrome around it. */
.jn-body {
    max-width: 44rem;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.9;
    color: rgba(226, 232, 240, 0.92);
    overflow-wrap: anywhere;
}

.jn-notice {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    font-family: 'Share Tech Mono', monospace;
    line-height: 1.6;
}

.jn-notice-draft  { border: 1px solid rgba(255, 215, 0, 0.35); color: #ffd700; }
.jn-notice-hidden { border: 1px solid rgba(255, 45, 120, 0.45); color: #ff2d78; background: rgba(255, 45, 120, 0.07); }

.jn-warning {
    margin-top: 0.9rem;
    padding: 0.6rem 0.8rem;
    border-left: 2px solid #ff2d78;
    background: rgba(255, 45, 120, 0.07);
    font-size: 0.82rem;
    color: rgba(200, 216, 248, 0.78);
}

.jn-status {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.jn-status-draft     { color: #ffd700; }
.jn-status-published { color: #39ff14; }
.jn-status-hidden    { color: #ff2d78; }

/* ---------- The editor --------------------------------------------------- */

.jn-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.35rem 0 0.4rem;
}

.jn-tool {
    min-width: 2rem;
    padding: 0.25rem 0.55rem;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.22);
    border-radius: 3px;
    color: rgba(200, 216, 248, 0.85);
    font-size: 0.78rem;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.jn-tool:hover,
.jn-tool:focus-visible {
    border-color: #00f5ff;
    color: #00f5ff;
    background: rgba(0, 245, 255, 0.12);
    outline: none;
}

.jn-hint {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: rgba(200, 216, 248, 0.55);
    line-height: 1.6;
    margin-top: 0.3rem;
}

.jn-error {
    color: #ff2d78;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ---------- "My journal" rows --------------------------------------------- */

.jn-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-top: 1px solid rgba(0, 245, 255, 0.08);
}

.jn-row:first-child { border-top: none; }

.jn-row-thumb {
    flex: 0 0 5.5rem;
    aspect-ratio: 16 / 9;
    border-radius: 3px;
    overflow: hidden;
    background: #0b0b22;
    border: 1px solid rgba(0, 245, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jn-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 560px) {
    .jn-row { flex-wrap: wrap; }
    .jn-row-thumb { flex-basis: 100%; }
    .jn-tab { padding: 0.5rem 0.8rem; }
}

/* ---------- Pictures inside the text (Package 3) -------------------------- */

/*
   [attach=N] renders as the forum's <a class="bb-attach"><img></a>. The forum
   shows it as a small thumbnail (gothic_theme.css); an entry is for reading, so
   here the picture sits in the text at reading size, and a click opens it full
   size in the lightbox (js/public-lightbox.js).
*/
.jn-body .bb-attach {
    display: inline-block;
    max-width: 100%;
    margin: 0.6rem 0;
    line-height: 0;
    vertical-align: top;
}

.jn-body .bb-attach img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 36rem;
    object-fit: contain;
    border: 1px solid rgba(0, 245, 255, 0.18);
    border-radius: 3px;
}

.jn-body .bb-attach:hover img {
    border-color: #00f5ff;
    box-shadow: 0 0 14px rgba(0, 245, 255, 0.25);
}

/* The editor's tray of uploaded pictures. */
.jn-pictures {
    margin-top: 0.6rem;
    padding: 0.7rem 0.8rem;
    border: 1px dashed rgba(0, 245, 255, 0.22);
    border-radius: 4px;
}

.jn-pictures-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.jn-pictures-list:empty { display: none; }

.jn-picture {
    position: relative;
    width: 8.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.35rem;
    border: 1px solid rgba(0, 245, 255, 0.18);
    border-radius: 3px;
    background: rgba(0, 245, 255, 0.03);
}

.jn-picture img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.jn-picture-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.66rem;
    color: rgba(200, 216, 248, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jn-picture-actions {
    display: flex;
    gap: 0.3rem;
}

.jn-picture-actions button {
    flex: 1;
    padding: 0.15rem 0.3rem;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.22);
    border-radius: 3px;
    color: rgba(200, 216, 248, 0.85);
    font-size: 0.7rem;
    cursor: pointer;
}

.jn-picture-actions button:hover { border-color: #00f5ff; color: #00f5ff; }

.jn-picture-actions .jn-picture-remove { flex: 0 0 1.8rem; }
.jn-picture-actions .jn-picture-remove:hover { border-color: #ff2d78; color: #ff2d78; }

.jn-picture.is-uploading {
    align-items: center;
    justify-content: center;
    min-height: 6.5rem;
    color: rgba(0, 245, 255, 0.7);
}

.jn-pictures .jn-hint { margin-top: 0.5rem; }

/* Preview: the text shown the way readers will see it, in place of the box. */
.jn-tool-gap { flex: 1 1 auto; }

.jn-tool[aria-pressed='true'] {
    border-color: #ff2d78;
    color: #ff2d78;
    background: rgba(255, 45, 120, 0.08);
}

.jn-tool:disabled {
    opacity: 0.35;
    cursor: default;
}

.jn-preview {
    max-width: none;
    min-height: 12rem;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(255, 45, 120, 0.3);
    border-radius: 4px;
    background: rgba(255, 45, 120, 0.03);
}

.jn-preview-empty {
    color: rgba(200, 216, 248, 0.5);
    font-style: italic;
}

/* The "Let visitors read this" option. */
.jn-public-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: rgba(200, 216, 248, 0.78);
    cursor: pointer;
}

.jn-public-option input { margin-top: 0.25rem; }

.jn-public-option .fa-globe { color: #00f5ff; opacity: 0.85; }

.jn-public-blocked { display: block; color: #ffd700; }

/*
   The editor shows and hides these with the hidden attribute. A class that sets
   display (as .jn-public-blocked does above, and as a stylesheet elsewhere may on
   a textarea) beats the browser's own [hidden] rule, so it is restated here.
*/
#journal-body[hidden],
#journal-preview[hidden],
.jn-public-blocked[hidden],
.jn-pictures-error[hidden] { display: none !important; }

/* "Public" marker on an entry and in My Journal. */
.jn-status-public { color: #00f5ff; text-decoration: none; }

/* ---------- The public copy (/explore/journals) --------------------------- */

.jn-public-join {
    margin-top: 1.5rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(0, 245, 255, 0.22);
    border-left: 3px solid #00f5ff;
    background: rgba(0, 245, 255, 0.04);
    font-size: 0.88rem;
    line-height: 1.6;
    color: rgba(200, 216, 248, 0.82);
}

.jn-public-join strong { color: #e8f0ff; }

.jn-public-join-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
