/* =============================================
   CHIAROSCURO — STYLENEWS.CSS (Phase 2 Redesign)
   ============================================= */

/* --- RESET & TOKENS --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --cobalt: #0047AB;
    --cobalt-dark: #003080;
    --cobalt-darker: #0A1128;
    --cobalt-light: #005bc5;
    --white: #ffffff;
    --off-white: #F8F9FA;
    --border: rgba(255,255,255,0.18);
    --border-dark: rgba(0,71,171,0.15);
    --muted: rgba(255,255,255,0.5);
    --muted-dark: #8899BB;

    --font-display: 'DM Serif Display', Georgia, serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
    --font-body: 'DM Sans', Helvetica, Arial, sans-serif;

    --nav-h: 76px;
    --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--cobalt);
    color: var(--white);
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
img { display: block; max-width: 100%; }

/* --- SCROLL REVEAL --- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-delay-1 { transition-delay: 0.15s; }
.reveal-delay-2 { transition-delay: 0.3s; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* --- SHARED TYPOGRAPHY --- */
.mono {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    font-weight: 500;
    text-transform: uppercase;
}
.label-tag { color: var(--muted); }

h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 2rem;
}

p {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.65;
    font-weight: 300;
    margin-bottom: 1.25rem;
    max-width: 560px;
}

/* --- BUTTONS --- */
.btn-primary {
    display: inline-block;
    padding: 13px 28px;
    background: var(--white);
    color: var(--cobalt);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: 2px solid var(--white);
    transition: var(--transition);
}
.btn-primary:hover { background: transparent; color: var(--white); }

.btn-secondary {
    display: inline-block;
    padding: 13px 28px;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.3);
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--white); color: var(--white); }

/* --- PILL --- */
.pill-mono {
    display: inline-block;
    padding: 8px 18px;
    border: 1.5px solid rgba(255,255,255,0.6);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: transparent;
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
    cursor: pointer;
}
.pill-mono:hover, .pill-mono.active {
    background: var(--white);
    color: var(--cobalt);
    border-color: var(--white);
}

/* =============================================
   NAVIGATION
   ============================================= */
nav.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2.5rem;
    height: var(--nav-h);
    width: 100%;
    position: fixed;
    top: 0; left: 0;
    z-index: 999;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.4s ease, border-color 0.4s ease, backdrop-filter 0.4s ease;
}
nav.site-header.scrolled {
    background: rgba(0, 48, 128, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.brand-link {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    font-style: italic;
    color: var(--white);
    letter-spacing: 0.5px;
}

.nav-menu { display: flex; align-items: center; gap: 2.5rem; }

.nav-item {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.25s ease;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}
.nav-item:hover { color: var(--white); border-bottom-color: rgba(255,255,255,0.4); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.4rem;
    cursor: pointer;
}

/* =============================================
   HERO — GRADIENT
   ============================================= */
.chi-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(145deg, var(--cobalt-darker) 0%, var(--cobalt) 55%, var(--cobalt-light) 100%);
    overflow: hidden;
}

/* Subtle diagonal texture overlay */
.chi-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -55deg,
        transparent,
        transparent 80px,
        rgba(255,255,255,0.015) 80px,
        rgba(255,255,255,0.015) 81px
    );
    pointer-events: none;
}

.chi-hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 6rem) 2.5rem 5rem;
}

.chi-label {
    display: block;
    color: rgba(255,255,255,0.6);
    margin-bottom: 1.2rem;
}

.chi-title {
    font-family: var(--font-display);
    font-size: clamp(5rem, 14vw, 12rem);
    line-height: 0.88;
    font-weight: 400;
    letter-spacing: -3px;
    color: var(--white);
    margin-bottom: 1.5rem;
}

.chi-subtitle {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-style: italic;
    color: rgba(255,255,255,0.75);
    margin-bottom: 0.75rem;
    font-weight: 400;
    line-height: 1.3;
    max-width: 600px;
}

.chi-desc {
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    max-width: 480px;
    margin-bottom: 2.5rem;
    font-weight: 300;
    line-height: 1.6;
}

/* =============================================
   MANIFESTO
   ============================================= */
.chi-manifesto {
    background: var(--off-white);
    padding: 7rem 2.5rem;
}

.chi-manifesto-inner { max-width: 1200px; margin: 0 auto; }

.manifesto-label { margin-bottom: 3rem; }
.manifesto-label .label-tag { color: rgba(0,71,171,0.5); }

.manifesto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: start;
}

.manifesto-statement h2 {
    color: var(--cobalt);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.2;
}
.manifesto-statement h2 em {
    font-style: italic;
    color: var(--cobalt-light);
}

.manifesto-body p {
    color: #333;
    max-width: 100%;
}
.manifesto-body p strong { color: var(--cobalt); font-weight: 600; }

/* =============================================
   RECENT ISSUES
   ============================================= */
.chi-issues {
    background: var(--cobalt);
    padding: 7rem 2.5rem;
    border-top: 1px solid var(--border);
}

.chi-issues-inner { max-width: 1200px; margin: 0 auto; }

.issues-label { margin-bottom: 3rem; }

/* Loading dots */
.issues-loading {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}
.loading-dots { display: flex; gap: 6px; align-items: center; }
.loading-dots span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    animation: dot-pulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.issues-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }

.issue-item {
    display: grid;
    grid-template-columns: 160px 1fr 100px;
    gap: 2rem;
    align-items: center;
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--white);
    transition: background 0.2s ease;
    position: relative;
}
.issue-item::before {
    content: "";
    position: absolute;
    left: -2.5rem; right: -2.5rem; top: 0; bottom: 0;
    background: rgba(255,255,255,0.03);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.issue-item:hover::before { opacity: 1; }
.issue-item:hover .issue-arrow { transform: translateX(6px); color: var(--white); }

.issue-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.issue-num { color: rgba(255,255,255,0.2); font-size: 1.5rem; letter-spacing: 0; font-family: var(--font-display); }
.issue-tag { color: #8899BB; font-size: 0.6rem; }

.issue-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--white);
    line-height: 1.25;
    margin-bottom: 0.6rem;
}

.issue-desc {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.55;
    margin-bottom: 0;
    max-width: 100%;
    font-weight: 300;
    font-style: italic;
}

.issue-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.issue-date { color: rgba(255,255,255,0.3); }

.issue-arrow {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.25);
    transition: transform 0.25s ease, color 0.25s ease;
}

.issues-more { padding-top: 1rem; }

/* =============================================
   SUBSCRIBE
   ============================================= */
.chi-subscribe {
    background: var(--cobalt-dark);
    padding: 7rem 2.5rem;
    border-top: 1px solid var(--border);
}

.chi-subscribe-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.subscribe-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1;
    letter-spacing: -1px;
    color: var(--white);
    margin: 1rem 0 2rem;
}
.subscribe-title em { font-style: italic; color: rgba(255,255,255,0.6); }

.subscribe-promises {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 0;
}
.subscribe-promises li {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.promise-dot { color: rgba(255,255,255,0.25); font-size: 0.5rem; }

.iframe-wrapper {
    border: 2px solid rgba(255,255,255,0.2);
    overflow: hidden;
    transition: border-color 0.3s ease;
}
.iframe-wrapper:hover { border-color: rgba(255,255,255,0.5); }

/* =============================================
   TOPICS TICKER STRIP
   ============================================= */
.chi-topics-strip {
    background: var(--cobalt-darker);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    overflow: hidden;
    white-space: nowrap;
}

.topics-ticker {
    display: inline-flex;
    gap: 1.5rem;
    animation: ticker 30s linear infinite;
    padding-right: 1.5rem;
}

.topic-tick {
    color: rgba(255,255,255,0.3);
    font-size: 0.62rem;
    letter-spacing: 2px;
    flex-shrink: 0;
}

.topic-sep {
    color: rgba(255,255,255,0.12);
    font-size: 0.62rem;
    flex-shrink: 0;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* =============================================
   FOOTER
   ============================================= */
footer {
    padding: 3rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--cobalt);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-brand {
    font-family: var(--font-body);
    font-weight: 700;
    font-style: italic;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.footer-link {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 2px;
    transition: color 0.2s, border-color 0.2s;
}
.footer-link:hover { color: var(--white); border-color: var(--white); }

.footer-center { display: flex; gap: 1.5rem; }

.footer-social {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.35);
    transition: color 0.2s;
}
.footer-social:hover { color: var(--white); }

.footer-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    opacity: 0.35;
    line-height: 1.7;
    text-align: right;
    text-transform: uppercase;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
    nav.site-header { padding: 0 1.5rem; }
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--nav-h); left: 0;
        width: 100%;
        background: var(--cobalt-dark);
        padding: 2rem;
        gap: 1.5rem;
    }
    .nav-menu.open { display: flex; }
    .nav-toggle { display: block; }

    .chi-title { letter-spacing: -1px; font-size: clamp(3.8rem, 10vw, 6rem); }
    .chi-hero-content { padding: calc(var(--nav-h) + 3rem) 1.5rem 4rem; }
    .chi-hero-credit { align-self: flex-start; }

    .manifesto-grid { grid-template-columns: 1fr; gap: 3rem; }
    .chi-manifesto { padding: 5rem 1.5rem; }

    .chi-issues { padding: 5rem 1.5rem; }
    .issue-item { grid-template-columns: 1fr; gap: 1rem; padding: 2rem 0; }
    .issue-footer { flex-direction: row; justify-content: space-between; align-items: center; }
    .issue-num { font-size: 1rem; }

    .chi-subscribe { padding: 5rem 1.5rem; }
    .chi-subscribe-inner { grid-template-columns: 1fr; gap: 3rem; }

    footer { padding: 2.5rem 1.5rem; flex-direction: column; align-items: flex-start; }
    .footer-meta { text-align: left; }
}

@media (max-width: 480px) {
    .chi-title { font-size: clamp(3rem, 10vw, 6rem); }
    .chi-hero { min-height: 100svh; }
    .chi-hero-content { padding: calc(var(--nav-h) + 2rem) 1.5rem 3rem; }
}

/* =============================================
   SUBSTACK FEED WIDGET — ISSUES CONTEXT OVERRIDE
   When #substack-feed-embed lives inside .chi-issues,
   render cards as the existing .issue-item row style.
   ============================================= */

/* Reset grid — stack as rows with border-top like .issues-list */
.chi-issues #substack-feed-embed {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    grid-template-columns: unset;
    gap: 0;
    width: 100%;
    margin-bottom: 0;
}

/* Each card becomes a row mirroring .issue-item */
.chi-issues .substack-card {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 2rem;
    align-items: center;
    padding: 2.5rem 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    transform: none;
    position: relative;
}
.chi-issues .substack-card::before {
    content: "";
    position: absolute;
    left: -2.5rem; right: -2.5rem; top: 0; bottom: 0;
    background: rgba(255,255,255,0.03);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.chi-issues .substack-card:hover {
    border-color: transparent;
    transform: none;
}
.chi-issues .substack-card:hover::before { opacity: 1; }
.chi-issues .substack-card:hover .substack-arrow { transform: translateX(6px); color: var(--white); }

/* Hide thumbnail in row layout */
.chi-issues .substack-thumbnail { display: none; }

/* Body: title + date + desc */
.chi-issues .substack-body {
    padding: 0;
    gap: 0.4rem;
}

.chi-issues .substack-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--white);
    margin-bottom: 0.4rem;
}

.chi-issues .substack-date {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    margin-bottom: 0.3rem;
}

.chi-issues .substack-desc {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.55;
    font-weight: 300;
    font-style: italic;
}

/* Right column: arrow indicator */
.chi-issues .substack-post {
    display: contents; /* let card grid handle layout */
}

/* Inject arrow via pseudo on card hover column */
.chi-issues .substack-card::after {
    content: "\2192";
    font-size: 1.2rem;
    color: rgba(255,255,255,0.25);
    transition: transform 0.25s ease, color 0.25s ease;
    justify-self: end;
    align-self: center;
}
.chi-issues .substack-card:hover::after {
    transform: translateX(6px);
    color: var(--white);
}

/* Skeleton inside issues context */
.chi-issues .substack-skeleton {
    grid-column: unset;
    border-top: 1px solid var(--border);
    padding: 3rem 0;
}

/* State messages inside issues context */
.chi-issues .substack-error,
.chi-issues .substack-empty {
    grid-column: unset;
    border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
    .chi-issues #substack-feed-embed { grid-template-columns: unset; }
    .chi-issues .substack-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 2rem 0;
    }
    .chi-issues .substack-card::after { display: none; }
}


/* Grid wrapper */
.substack-feed-embed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* Individual card link */
.substack-card {
    display: block;
    text-decoration: none;
    color: var(--white);
    border: 1px solid var(--border);
    transition: border-color var(--transition), transform var(--transition);
    background: rgba(255,255,255,0.03);
}
.substack-card:hover {
    border-color: rgba(255,255,255,0.45);
    transform: translateY(-3px);
}

/* Inner post wrapper */
.substack-post {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Thumbnail */
.substack-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    filter: saturate(0.7);
    transition: filter var(--transition);
}
.substack-card:hover .substack-thumbnail {
    filter: saturate(1);
}

/* Body text */
.substack-body {
    padding: 1.4rem 1.5rem 1.6rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.substack-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--white);
    margin: 0;
}

.substack-date {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    margin: 0;
}

.substack-desc {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.55;
    font-weight: 300;
    font-style: italic;
    margin: 0;
    max-width: 100%;
    flex: 1;
}

/* Skeleton loader */
.substack-skeleton {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 0;
    width: 100%;
    grid-column: 1 / -1;
}

/* State messages */
.substack-error,
.substack-empty {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    padding: 2rem 0;
    grid-column: 1 / -1;
}
.substack-error a,
.substack-empty a {
    color: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 1px;
    transition: color var(--transition), border-color var(--transition);
}
.substack-error a:hover,
.substack-empty a:hover {
    color: var(--white);
    border-color: var(--white);
}

/* Responsive */
@media (max-width: 960px) {
    .substack-feed-embed {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 600px) {
    .substack-feed-embed {
        grid-template-columns: 1fr;
    }
}
