/* ==========================================
   SOFTLYSIS JOURNAL
   All new styles are scoped below the hero.
   ========================================== */

.sj-shell {
    --sj-bg: #101715;
    --sj-panel: #19221f;
    --sj-ink: #f2f3e9;
    --sj-muted: #a4b2a8;
    --sj-line: rgba(233, 241, 230, .16);
    --sj-accent: #e6f292;

    background: var(--sj-bg);
    color: var(--sj-ink);
    padding: 76px 0;
    scroll-margin-top: 100px;
}

html[data-theme="light"] .sj-shell {
    --sj-bg: #f5f5ee;
    --sj-panel: #ffffff;
    --sj-ink: #172b24;
    --sj-muted: #63736a;
    --sj-line: rgba(23, 43, 36, .16);
}

.sj-shell *,
.sj-shell *::before,
.sj-shell *::after {
    box-sizing: border-box;
}

.sj-shell a {
    color: inherit;
    text-decoration: none;
}

.sj-container {
    width: min(1240px, calc(100% - 64px));
    margin-inline: auto;
}

/* Masthead */
.sj-masthead {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 40px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--sj-line);
}

.sj-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--sj-muted);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.5;
    letter-spacing: .15em;
}

.sj-kicker > span {
    width: 7px;
    height: 7px;
    background: var(--sj-ink);
    border-radius: 50%;
}

.sj-masthead h2 {
    margin: 22px 0 0;
    color: var(--sj-ink);
    font-size: clamp(48px, 7vw, 94px);
    font-weight: 600;
    line-height: .99;
    letter-spacing: -.07em;
}

.sj-masthead em,
.sj-newsletter em {
    font-family: Georgia, serif;
    font-weight: 400;
    letter-spacing: -.055em;
}

.sj-intro {
    max-width: 290px;
    padding-bottom: 4px;
}

.sj-intro p {
    margin: 0 0 25px;
    color: var(--sj-muted);
    font-size: 15px;
    line-height: 1.8;
}

.sj-intro > span {
    display: block;
    padding-top: 12px;
    border-top: 1px solid var(--sj-line);
    font-size: 11px;
}

/* Main layout */
.sj-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 48px;
    padding-top: 38px;
}

.sj-main {
    min-width: 0;
}

/* Sidebar */
.sj-rail-inner {
    position: sticky;
    top: 110px;
}

.sj-rail-label {
    display: block;
    margin-bottom: 20px;
    color: var(--sj-muted);
    font-size: 9px;
    letter-spacing: .12em;
    font-weight: 750;
}

.sj-topics {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sj-topics a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    border-radius: 4px;
    color: var(--sj-muted);
    font-size: 12px;
    line-height: 1.5;
}

.sj-topics a > span {
    flex-shrink: 0;
    font-size: 18px;
}

.sj-topics a:hover {
    color: var(--sj-ink);
    background: var(--sj-panel);
}

.sj-topics a.is-active {
    color: #172b24;
    background: var(--sj-accent);
    font-weight: 750;
}

.sj-rail-note {
    margin-top: 52px;
    padding-top: 28px;
    border-top: 1px solid var(--sj-line);
}

.sj-note-icon {
    font-size: 46px;
    line-height: 1;
}

.sj-rail-note p {
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.7;
}

.sj-rail-note a {
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--sj-line);
    font-size: 10px;
    font-weight: 750;
}

/* Spotlight */
.sj-section-line {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--sj-muted);
    font-size: 9px;
    letter-spacing: .12em;
}

.sj-section-line span:last-child {
    letter-spacing: 0;
}

.sj-lead {
    overflow: hidden;
    border-radius: 10px;
    background: var(--sj-panel);
}

.sj-lead-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 8;
    overflow: hidden;
    background: #253d32;
}

.sj-lead-media > img,
.sj-story-media > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.sj-lead-media:hover > img,
.sj-story-media:hover > img {
    transform: scale(1.035);
}

.sj-media-label {
    position: absolute;
    top: 22px;
    left: 22px;
    padding: 9px 12px;
    border-radius: 3px;
    background: #f7f8ef;
    color: #172b24;
    font-size: 9px;
    letter-spacing: .12em;
    font-weight: 800;
}

.sj-media-arrow {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--sj-accent);
    color: #172b24;
    font-size: 26px;
}

.sj-lead-body {
    padding: 30px 34px;
}

.sj-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    color: var(--sj-muted);
    font-size: 10px;
    line-height: 1.5;
}

.sj-meta span:first-child {
    color: var(--sj-ink);
    font-weight: 750;
}

.sj-meta span + span::before {
    content: "·";
    margin-right: 12px;
}

.sj-lead h3 {
    margin: 15px 0;
    color: var(--sj-ink);
    font-size: clamp(25px, 3.1vw, 40px);
    line-height: 1.12;
    font-weight: 600;
    letter-spacing: -.04em;
    overflow-wrap: anywhere;
}

.sj-lead-body > p {
    max-width: 700px;
    margin: 0 0 24px;
    color: var(--sj-muted);
    font-size: 14px;
    line-height: 1.8;
}

.sj-story-end {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid var(--sj-line);
}

.sj-story-end time {
    color: var(--sj-muted);
    font-size: 10px;
}

.sj-story-end a {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 750;
}

.sj-story-end a > span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--sj-line);
    border-radius: 50%;
    font-size: 16px;
}

.sj-story-end a:hover > span {
    background: var(--sj-accent);
    border-color: var(--sj-accent);
    color: #172b24;
}

/* Reading room */
.sj-stories {
    margin-top: 54px;
}

.sj-stories-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 26px;
}

.sj-stories-heading h2 {
    margin: 10px 0 0;
    color: var(--sj-ink);
    font-size: clamp(28px, 3vw, 40px);
    letter-spacing: -.045em;
    line-height: 1.1;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sj-stories-heading > span {
    flex-shrink: 0;
    color: var(--sj-muted);
    font-size: 10px;
}

.sj-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 28px;
}

.sj-story {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sj-story-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 11;
    overflow: hidden;
    border-radius: 7px;
    background: var(--sj-panel);
}

.sj-story-number {
    position: absolute;
    top: 12px;
    left: 12px;
    display: grid;
    place-items: center;
    min-width: 32px;
    height: 28px;
    padding: 0 7px;
    border-radius: 3px;
    background: #f7f8ef;
    color: #172b24;
    font-size: 10px;
    font-weight: 750;
}

.sj-story-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 19px;
}

.sj-story h3 {
    margin: 12px 0;
    color: var(--sj-ink);
    font-size: 23px;
    line-height: 1.25;
    letter-spacing: -.03em;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sj-story-body > p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 22px;
    color: var(--sj-muted);
    font-size: 12px;
    line-height: 1.85;
}

.sj-story-body .sj-story-end {
    margin-top: auto;
}

.sj-story h3 a:hover,
.sj-lead h3 a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

/* Artwork when no image is uploaded */
.sj-art {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 9%;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at 80% 15%,
            #728c63 0%,
            transparent 50%
        ),
        linear-gradient(125deg, #1c3d31, #243e37);
    color: #e6f292;
}

.sj-art > span {
    max-width: 80%;
    font-family: Georgia, serif;
    font-style: italic;
    font-size: clamp(32px, 5vw, 74px);
    line-height: .95;
    letter-spacing: -.05em;
    overflow-wrap: anywhere;
}

.sj-art > b {
    font-size: clamp(40px, 8vw, 120px);
    font-weight: 400;
}

.sj-art-small {
    background: linear-gradient(135deg, #d8e1ce, #a7bfa7);
    color: #254b3a;
}

.sj-art-small > span {
    font-size: clamp(26px, 3vw, 42px);
}

.sj-art-small > b {
    font-size: 60px;
}

.sj-story:nth-child(3n+2) .sj-art-small {
    background: linear-gradient(135deg, #eee1c4, #c7b38c);
    color: #5d482b;
}

.sj-story:nth-child(3n) .sj-art-small {
    background: linear-gradient(135deg, #d3dce7, #95a9be);
    color: #344e69;
}

/* Pagination */
.sj-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 38px;
    padding-top: 24px;
    border-top: 1px solid var(--sj-line);
    font-size: 11px;
}

.sj-pagination a {
    padding: 9px 0;
    font-weight: 750;
}

.sj-pagination a:hover {
    text-decoration: underline;
}

.sj-disabled {
    color: var(--sj-muted);
    opacity: .5;
}

.sj-page-count {
    font-size: 16px;
    font-weight: 750;
}

.sj-page-count > span {
    color: var(--sj-muted);
    font-size: 12px;
    font-weight: 400;
}

/* Empty state */
.sj-empty {
    padding: 48px 28px;
    border: 1px dashed var(--sj-line);
    border-radius: 8px;
    text-align: center;
}

.sj-empty > span {
    font-size: 44px;
}

.sj-empty h3 {
    margin: 14px 0;
    color: var(--sj-ink);
    font-size: 26px;
}

.sj-empty p {
    color: var(--sj-muted);
    font-size: 14px;
    line-height: 1.8;
}

.sj-empty a {
    display: inline-block;
    margin-top: 12px;
    text-decoration: underline;
}

/* Newsletter */
.sj-newsletter {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 60px;
    margin-top: 80px;
    padding: 50px;
    border-radius: 10px;
    background: #e6f292;
    color: #172b24;
}

.sj-newsletter .sj-kicker {
    color: #425a39;
    font-size: 9px;
}

.sj-newsletter h2 {
    margin: 18px 0;
    color: #172b24;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.04;
    font-weight: 600;
    letter-spacing: -.055em;
}

.sj-newsletter-copy > p {
    max-width: 350px;
    margin: 0;
    color: #425a39;
    font-size: 12px;
    line-height: 1.8;
}

.sj-newsletter-action {
    min-width: 0;
}

.sj-newsletter-mark {
    display: block;
    margin-bottom: 24px;
    text-align: right;
    font-size: 80px;
    line-height: 1;
}

.sj-newsletter label {
    display: block;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 750;
}

.sj-email-field {
    display: flex;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #657646;
}

.sj-email-field input {
    display: block;
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 10px 0;
    border: 0;
    outline: 0;
    border-radius: 0;
    background: transparent;
    color: #172b24;
    font: inherit;
    font-size: 14px;
}

.sj-email-field input::placeholder {
    color: #425a39;
    opacity: 1;
}

.sj-email-field button {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #172b24;
    color: #e6f292;
    font-size: 23px;
    cursor: pointer;
}

.sj-newsletter small {
    display: block;
    margin-top: 12px;
    color: #425a39;
    font-size: 9px;
}

.sj-shell :is(a, button, input):focus-visible {
    outline: 3px solid #52aea8;
    outline-offset: 4px;
}

/* Responsive */
@media (max-width: 1050px) {
    .sj-layout {
        grid-template-columns: 160px minmax(0, 1fr);
        gap: 28px;
    }

    .sj-lead-body {
        padding: 25px;
    }

    .sj-newsletter {
        gap: 32px;
        padding: 36px;
    }
}

@media (max-width: 800px) {
    .sj-shell {
        padding: 48px 0;
    }

    .sj-container {
        width: calc(100% - 36px);
    }

    .sj-masthead {
        align-items: start;
        gap: 24px;
    }

    .sj-intro {
        max-width: 235px;
    }

    .sj-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .sj-rail-inner {
        position: static;
    }

    .sj-rail-label {
        margin-bottom: 12px;
    }

    .sj-topics {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .sj-topics a {
        flex-shrink: 0;
        white-space: nowrap;
        border: 1px solid var(--sj-line);
    }

    .sj-rail-note {
        display: none;
    }

    .sj-grid {
        gap: 30px 22px;
    }

    .sj-lead-media {
        aspect-ratio: 16 / 9;
    }

    .sj-newsletter {
        grid-template-columns: 1fr;
        gap: 28px;
        margin-top: 54px;
    }

    .sj-newsletter-mark {
        display: none;
    }
}

@media (max-width: 540px) {
    .sj-masthead {
        flex-direction: column;
        padding-bottom: 30px;
    }

    .sj-masthead h2 {
        font-size: 62px;
    }

    .sj-intro {
        max-width: none;
    }

    .sj-intro p {
        margin-bottom: 16px;
        font-size: 13px;
    }

    .sj-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .sj-lead-body {
        padding: 23px 20px;
    }

    .sj-lead h3 {
        font-size: 27px;
    }

    .sj-lead-body > p {
        font-size: 12px;
    }

    .sj-lead-media {
        aspect-ratio: 4 / 3;
    }

    .sj-media-label {
        top: 15px;
        left: 15px;
        font-size: 8px;
    }

    .sj-media-arrow {
        right: 15px;
        bottom: 15px;
        width: 38px;
        height: 38px;
    }

    .sj-stories-heading {
        align-items: start;
    }

    .sj-stories-heading h2 {
        font-size: 30px;
    }

    .sj-stories-heading > span {
        padding-top: 3px;
        font-size: 9px;
    }

    .sj-section-line {
        font-size: 8px;
    }

    .sj-story h3 {
        font-size: 24px;
    }

    .sj-art-small > span {
        font-size: 40px;
    }

    .sj-newsletter {
        padding: 30px 23px;
    }

    .sj-newsletter h2 {
        font-size: 38px;
    }

    .sj-pagination {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sj-lead-media > img,
    .sj-story-media > img {
        transition: none;
    }

    .sj-lead-media:hover > img,
    .sj-story-media:hover > img {
        transform: none;
    }
}

/* Prevent blog layout from expanding beyond the screen */
.sj-layout > *,
.sj-lead,
.sj-story {
    min-width: 0;
}

.sj-lead-media,
.sj-story-media {
    width: 100%;
    max-width: 100%;
}

/* Keep images inside their responsive containers */
.sj-lead-media > img,
.sj-story-media > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 800px) {
    .sj-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sj-topics {
        max-width: 100%;
    }
}