/* ========================================================================
   SC TradeMasters — Article & DevNotes Styling
   Ship's Log / Mission Briefing aesthetic — wide-format cockpit layout
   ======================================================================== */

/* ── Reading Progress Bar ────────────────────────────────────────────── */
.sctm-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--m-amber) 0%, var(--m-amber-hover) 100%);
    box-shadow: 0 0 12px rgba(255, 200, 87, 0.4);
    z-index: 9999;
    transition: width 80ms linear;
}

/* ── Article Hero / Header — Full Bleed ──────────────────────────────── */
.sctm-article-hero {
    position: relative;
    width: 100%;
    padding: 72px 0 0;
}

.sctm-article-hero__viewport {
    position: relative;
    width: 100%;
    max-height: 56vh;
    overflow: hidden;
}

.sctm-article-hero__viewport::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(12, 12, 12, 0.15) 0%,
        transparent 20%,
        transparent 40%,
        rgba(12, 12, 12, 0.5) 70%,
        var(--m-void) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.sctm-article-hero__viewport::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 200, 87, 0.05);
    z-index: 2;
    pointer-events: none;
}

.sctm-article-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sctm-article-hero__hud-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: rgba(255, 200, 87, 0.2);
    border-style: solid;
    border-width: 0;
    z-index: 3;
    pointer-events: none;
}
.sctm-article-hero__hud-corner--tl { top: 12px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.sctm-article-hero__hud-corner--tr { top: 12px; right: 12px; border-top-width: 1px; border-right-width: 1px; }
.sctm-article-hero__hud-corner--bl { bottom: 12px; left: 12px; border-bottom-width: 1px; border-left-width: 1px; }
.sctm-article-hero__hud-corner--br { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }

/* ── Article Layout — Sidebar + Content Grid ─────────────────────────── */
.sctm-article-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0 48px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px clamp(24px, 4vw, 64px) 0;
}

.sctm-article-hero ~ .sctm-article-layout {
    padding-top: 0;
}

/* ── Sidebar — Telemetry Rail ────────────────────────────────────────── */
.sctm-article-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    padding: 32px 0;
    height: fit-content;
}

.sctm-article-sidebar__section {
    margin-bottom: 32px;
}

.sctm-article-sidebar__label {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--m-amber);
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 8px;
}

.sctm-article-sidebar__value {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--m-text-secondary);
    line-height: 1.5;
}

.sctm-article-sidebar__divider {
    height: 1px;
    background: var(--m-glass-border);
    margin: 0 0 32px;
}

.sctm-article-sidebar__tags {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sctm-article-sidebar__tag {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--m-text-muted);
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.sctm-article-sidebar__tag::before {
    content: '▹ ';
    color: var(--m-amber);
    opacity: 0.4;
}

.sctm-article-sidebar__tag:hover {
    color: var(--m-amber);
}

.sctm-article-sidebar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--m-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sctm-article-sidebar__back:hover {
    color: var(--m-amber);
}

/* Sidebar progress indicator */
.sctm-article-sidebar__progress-track {
    width: 100%;
    height: 2px;
    background: var(--m-glass-border);
    margin-top: 8px;
    overflow: hidden;
}

.sctm-article-sidebar__progress-fill {
    width: 0%;
    height: 100%;
    background: var(--m-amber);
    transition: width 80ms linear;
}

/* ── Article Main Content Area ───────────────────────────────────────── */
.sctm-article-main {
    min-width: 0;
    padding: 32px 0 80px;
}

/* ── Article Meta ────────────────────────────────────────────────────── */
.sctm-article-meta {
    max-width: 840px;
    margin: 0 0 40px;
    padding: 0;
}

.sctm-article-meta__title {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(32px, 4.5vw, 52px);
    font-weight: 700;
    color: var(--m-text);
    line-height: 1.1;
    letter-spacing: -1px;
    margin: 0 0 16px;
}

.sctm-article-meta__excerpt {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    color: var(--m-text-secondary);
    line-height: 1.65;
    margin: 0 0 24px;
    max-width: 720px;
}

.sctm-article-meta__telemetry {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 0;
    border-top: 1px solid var(--m-glass-border);
    border-bottom: 1px solid var(--m-glass-border);
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--m-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sctm-article-meta__telemetry-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sctm-article-meta__telemetry-label {
    color: var(--m-amber);
    opacity: 0.5;
}

.sctm-article-meta__telemetry-value {
    color: var(--m-text-secondary);
}

/* ── Article Body ────────────────────────────────────────────────────── */
.sctm-article-body {
    max-width: 840px;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    line-height: 1.85;
    color: var(--m-text-secondary);
}

/* — Headings — */
.sctm-article-body h1 {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(28px, 3.5vw, 36px);
    font-weight: 700;
    color: var(--m-text);
    margin: 64px 0 20px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sctm-article-body h2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 600;
    color: var(--m-text);
    margin: 56px 0 16px;
    padding-left: 16px;
    border-left: 2px solid var(--m-amber);
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.sctm-article-body h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(20px, 2.5vw, 24px);
    font-weight: 600;
    color: var(--m-text);
    margin: 44px 0 12px;
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.sctm-article-body h4 {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-amber);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 36px 0 12px;
}

/* — Paragraphs — */
.sctm-article-body p {
    margin: 0 0 28px;
}

/* — Strong / Emphasis — */
.sctm-article-body strong {
    color: var(--m-text);
    font-weight: 600;
}

.sctm-article-body em {
    color: var(--m-text);
    font-style: italic;
}

/* — Links — */
.sctm-article-body a {
    color: var(--m-amber);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 200, 87, 0.25);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.sctm-article-body a:hover {
    color: var(--m-amber-hover);
    border-bottom-color: var(--m-amber);
}

/* — Images: Wide Breakout — */
.sctm-article-body img {
    display: block;
    width: calc(100% + 80px);
    margin-left: -40px;
    margin-top: 48px;
    margin-bottom: 48px;
    border: 1px solid var(--m-glass-border);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    transition: border-color 0.3s ease;
}

.sctm-article-body img:hover {
    border-color: rgba(255, 200, 87, 0.15);
}

.sctm-article-body p:has(> img) {
    position: relative;
}

/* — Blockquotes: Comm Transmission — Wide — */
.sctm-article-body blockquote {
    position: relative;
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-top: 44px;
    margin-bottom: 44px;
    padding: 24px 28px;
    background: var(--m-glass-bg);
    border-left: 2px solid var(--m-amber);
    font-size: 17px;
    color: var(--m-text);
    line-height: 1.7;
}

.sctm-article-body blockquote::before {
    content: '// TRANSMISSION';
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--m-amber);
    opacity: 0.4;
    margin-bottom: 12px;
}

.sctm-article-body blockquote p {
    margin: 0 0 8px;
}

.sctm-article-body blockquote p:last-child {
    margin-bottom: 0;
}

/* — Code: Inline — */
.sctm-article-body code {
    font-family: 'Fira Code', monospace;
    font-size: 0.82em;
    padding: 2px 8px;
    background: rgba(255, 200, 87, 0.06);
    border: 1px solid rgba(255, 200, 87, 0.1);
    color: var(--m-amber);
}

/* — Code: Block / Terminal Display — Wide — */
.sctm-article-body pre {
    position: relative;
    width: calc(100% + 80px);
    margin-left: -40px;
    margin-top: 40px;
    margin-bottom: 40px;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--m-glass-border);
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.sctm-article-body pre::before {
    content: 'TERMINAL';
    display: block;
    padding: 8px 20px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--m-amber);
    opacity: 0.4;
    background: rgba(255, 200, 87, 0.03);
    border-bottom: 1px solid var(--m-glass-border);
}

.sctm-article-body pre code {
    display: block;
    padding: 20px 24px;
    background: transparent;
    border: none;
    color: var(--m-text-secondary);
    font-size: 14px;
    line-height: 1.7;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* — Lists — */
.sctm-article-body ul,
.sctm-article-body ol {
    margin: 0 0 28px;
    padding-left: 0;
    list-style: none;
}

.sctm-article-body ul li,
.sctm-article-body ol li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 14px;
    line-height: 1.75;
}

.sctm-article-body ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--m-amber);
    font-size: 14px;
}

.sctm-article-body ol {
    counter-reset: article-counter;
}

.sctm-article-body ol li {
    counter-increment: article-counter;
}

.sctm-article-body ol li::before {
    content: counter(article-counter, decimal-leading-zero);
    position: absolute;
    left: 0;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--m-amber);
    opacity: 0.6;
}

/* — Horizontal Rule: Scan Divider — */
.sctm-article-body hr {
    border: none;
    height: 1px;
    margin: 64px -40px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--m-glass-border) 10%,
        rgba(255, 200, 87, 0.12) 50%,
        var(--m-glass-border) 90%,
        transparent 100%
    );
    position: relative;
}

.sctm-article-body hr::after {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: var(--m-amber);
    opacity: 0.3;
    background: var(--m-void);
    padding: 0 16px;
}

/* — Tables — Wide — */
.sctm-article-body table {
    width: calc(100% + 80px);
    margin: 40px 0 40px -40px;
    border-collapse: collapse;
    font-size: 14px;
}

.sctm-article-body thead th {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--m-amber);
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--m-amber);
    opacity: 0.7;
}

.sctm-article-body tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--m-glass-border);
    color: var(--m-text-secondary);
}

.sctm-article-body tbody tr:hover td {
    background: var(--m-glass-bg);
}

/* ── Article Tags (inline, below body) ───────────────────────────────── */
.sctm-article-tags {
    max-width: 840px;
    margin: 0;
    padding: 0 0 48px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.sctm-article-tags__label {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--m-text-dim);
    text-transform: uppercase;
    margin-right: 8px;
}

.sctm-article-tag {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    background: var(--m-amber-dim);
    color: var(--m-amber);
    padding: 4px 12px;
    text-decoration: none;
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
    transition: background 0.2s ease;
}

.sctm-article-tag:hover {
    background: rgba(255, 200, 87, 0.2);
}

/* ── Article Card (Mission Briefing) ─────────────────────────────────── */
.sctm-briefing-card {
    position: relative;
    display: block;
    padding: 24px;
    margin-bottom: 2px;
    background: var(--m-glass-bg);
    border: 1px solid var(--m-glass-border);
    text-decoration: none;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transition: background 0.25s ease, border-color 0.25s ease;
}

.sctm-briefing-card:hover {
    background: var(--m-glass-hover);
    border-color: rgba(255, 200, 87, 0.12);
}

.sctm-briefing-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sctm-briefing-card__date {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--m-text-muted);
    letter-spacing: 0.5px;
}

.sctm-briefing-card__type {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}

.sctm-briefing-card__type--post {
    background: var(--m-amber-dim);
    color: var(--m-amber);
}

.sctm-briefing-card__type--backlink {
    background: var(--m-violet-dim);
    color: var(--m-violet);
}

.sctm-briefing-card__title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--m-text);
    line-height: 1.25;
    margin: 0 0 8px;
    transition: color 0.2s ease;
}

.sctm-briefing-card:hover .sctm-briefing-card__title {
    color: var(--m-amber);
}

.sctm-briefing-card__excerpt {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--m-text-muted);
    line-height: 1.6;
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sctm-briefing-card__footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sctm-briefing-card__tag {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: var(--m-text-dim);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 8px;
}

.sctm-briefing-card__read-time {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: var(--m-text-dim);
    margin-left: auto;
    letter-spacing: 0.5px;
}

.sctm-briefing-card__external {
    font-size: 11px;
    color: var(--m-text-dim);
    margin-left: auto;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sctm-briefing-card:hover .sctm-briefing-card__external {
    color: var(--m-amber);
    transform: translateX(2px);
}

/* ── Briefing Card — Image Variant ────────────────────────────────────── */
.sctm-briefing-card--has-image {
    background-size: cover;
    background-position: center;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
}

.sctm-briefing-card--has-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(12, 12, 12, 0.1) 0%,
        rgba(12, 12, 12, 0.4) 35%,
        rgba(12, 12, 12, 0.85) 65%,
        rgba(12, 12, 12, 0.95) 100%
    );
    z-index: 0;
    transition: background 0.3s ease;
}

.sctm-briefing-card--has-image:hover::before {
    background: linear-gradient(
        180deg,
        rgba(255, 200, 87, 0.05) 0%,
        rgba(12, 12, 12, 0.35) 35%,
        rgba(12, 12, 12, 0.8) 65%,
        rgba(12, 12, 12, 0.93) 100%
    );
}

.sctm-briefing-card--has-image > * {
    position: relative;
    z-index: 1;
}

.sctm-briefing-card--has-image .sctm-briefing-card__header {
    margin-top: auto;
}

/* ── DevNotes Listing (Blog Home / Mission Board) ────────────────────── */
.sctm-devnotes {
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px clamp(24px, 4vw, 64px) 80px;
}

.sctm-devnotes__header {
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--m-glass-border);
}

.sctm-devnotes__label {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--m-amber);
    text-transform: uppercase;
    margin-bottom: 12px;
    opacity: 0.6;
}

.sctm-devnotes__title {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--m-text);
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin: 0 0 8px;
}

.sctm-devnotes__subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--m-text-muted);
    margin: 0;
}

.sctm-devnotes__count {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--m-text-dim);
    margin-top: 16px;
}

.sctm-devnotes__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2px;
}

/* ── Home Page DevNotes Section ──────────────────────────────────────── */
.sctm-devnotes-preview {
    max-width: var(--m-page-width);
    margin: 0 auto;
}

.sctm-devnotes-preview__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2px;
}

.sctm-devnotes-preview__more {
    text-align: center;
    margin-top: 32px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

/* Tablet — collapse sidebar, single column */
@media (max-width: 1024px) {
    .sctm-article-layout {
        grid-template-columns: 1fr;
        gap: 0;
        max-width: 840px;
    }

    .sctm-article-sidebar {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 20px 40px;
        padding: 24px 0;
        border-bottom: 1px solid var(--m-glass-border);
        margin-bottom: 8px;
    }

    .sctm-article-sidebar__section {
        margin-bottom: 0;
    }

    .sctm-article-sidebar__divider {
        display: none;
    }

    .sctm-article-sidebar__tags {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .sctm-article-sidebar__progress-track {
        display: none;
    }

    /* Reset breakout on tablet */
    .sctm-article-body img,
    .sctm-article-body pre,
    .sctm-article-body table {
        width: 100%;
        margin-left: 0;
    }

    .sctm-article-body blockquote {
        width: 100%;
        margin-left: 0;
    }

    .sctm-article-body hr {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sctm-article-hero__viewport {
        max-height: 40vh;
    }

    .sctm-article-meta__title {
        font-size: 28px;
    }

    .sctm-article-meta__telemetry {
        flex-wrap: wrap;
        gap: 12px;
    }

    .sctm-article-body {
        font-size: 16px;
    }

    .sctm-article-body h2 {
        margin-top: 40px;
    }

    .sctm-article-body pre code {
        font-size: 13px;
    }

    .sctm-devnotes__grid,
    .sctm-devnotes-preview__grid {
        grid-template-columns: 1fr;
    }

    .sctm-briefing-card {
        padding: 20px;
    }

    .sctm-article-sidebar {
        flex-direction: column;
        gap: 12px;
    }
}
