/* =============================================================
   Stories Homepage — template-parts/stories/stories-home.css
   Loaded only on the Stories Homepage page template.
   Masthead styles live in umbc-single.css (singles) and
   umbc-archive.css (category/tag/explorer/archive).
   ============================================================= */

/* ── Layout shell ─────────────────────────────────────────── */
.stories-home-main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    min-width: 0;
    box-sizing: border-box;
    /* Trap any overflowing child (long URL, unbreakable headline,
       image with intrinsic width) instead of letting it push the
       page wider than the viewport. */
    overflow-x: clip;
}

/* Force every direct + nested container inside the stories shell
   to honor the viewport width. Without this, a single fixed-width
   descendant (section sidebar, image, table) inflates the whole
   tree and every `width: 100%` element snaps to that inflated size. */
.stories-home-main,
.stories-home-main .stories-section,
.stories-home-main .stories-top-row,
.stories-home-main .stories-top-cards-col,
.stories-home-main .stories-top-nav-col,
.stories-home-main .stories-grid-3,
.stories-home-main .stories-grid-4,
.stories-home-main .story-card,
.stories-home-main .story-card-img-wrap,
.stories-home-main .stories-hero,
.stories-home-main .stories-hero-body,
.stories-home-main .stories-hero-img-wrap {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Card images can't exceed their wrap regardless of intrinsic
   width attributes WP outputs on <img>. Don't touch height —
   the aspect-ratio wrap relies on height:100% to fill. */
.stories-home-main .story-card-img-wrap img,
.stories-home-main .stories-hero-img-wrap img {
    max-width: 100%;
}

/* Long titles break instead of forcing the card wider. */
.stories-home-main .story-card-title,
.stories-home-main .story-card-title a,
.stories-home-main .stories-hero-title,
.stories-home-main .stories-hero-title a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Page intro header ───────────────────────────────────── */
.stories-page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.stories-page-intro-text {
    min-width: 0;
}

.stories-page-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 800;
    color: #252525;
    margin: 0 0 0.25rem;
    line-height: 1.1;
}

.stories-page-tagline {
    font-size: 1rem;
    color: #666;
    margin: 0;
}

/* ── Subscribe inline (in page intro, right side) ────────── */
.stories-subscribe-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    flex-shrink: 0;
}

.stories-subscribe-inline-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.stories-subscribe-inline-row {
    display: flex;
    gap: 0.4rem;
}

.stories-subscribe-inline input[type="email"] {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.82rem;
    width: 200px;
}

.stories-subscribe-inline input[type="email"]:focus {
    outline: 2px solid #007176;
    border-color: #007176;
}

.stories-subscribe-inline button {
    padding: 0.4rem 1rem;
    background: var(--umbc-color-gold, #fdb515);
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.stories-subscribe-inline button:hover {
    background: var(--umbc-btn-gold-hover, #e6a510);
}

@media (max-width: 768px) {
    .stories-page-intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .stories-subscribe-inline {
        align-items: flex-start;
        width: 100%;
    }

    .stories-subscribe-inline-row {
        width: 100%;
    }

    .stories-subscribe-inline input[type="email"] {
        flex: 1;
        width: auto;
    }
}

/* ── Top row: nav col + cards col ───────────────────────── */
.stories-top-row {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 0;
    align-items: start;
}

.stories-top-nav-col {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    padding-right: 2rem;
}

.stories-top-cards-col {
    min-width: 0;
}

/* ── Section heading style ───────────────────────────────── */
.sh2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #252525;
    margin: 0 0 1.25rem;
    margin-left: 0 !important;
    padding-left: 0.65rem;
    border-left: 3px solid var(--umbc-color-gold, #fdb515);
    line-height: 1.2;
    text-align: left;
}

.sh2 a {
    color: inherit;
    text-decoration: none;
}

.sh2 a:hover {
    color: #007176;
}

/* ── Section row ─────────────────────────────────────────── */
.stories-section {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #e8e8e8;
}

.stories-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.stories-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.stories-section-header .sh2 {
    margin-bottom: 0;
}

.stories-see-all {
    font-size: 0.8rem;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 99px;
    padding: 0.25rem 0.9rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.stories-see-all:hover {
    background: #252525;
    color: #fff;
    border-color: #252525;
}

/* ── Hero ────────────────────────────────────────────────── */
.stories-hero {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 0;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.stories-hero-body {
    padding: 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stories-hero-cats {
    margin-bottom: 0.6rem;
    font-size: 0.75rem;
}

.stories-hero-cats a {
    display: inline-block;
    color: #007176;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.7rem;
    margin-right: 0.5rem;
}

.stories-hero-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.75rem;
    color: #252525;
}

.stories-hero-title a {
    color: inherit;
    text-decoration: none;
}

.stories-hero-title a:hover {
    color: #007176;
}

.stories-hero-excerpt {
    font-size: 1rem;
    color: #444;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stories-hero-meta {
    font-size: 0.8rem;
    color: #777;
    margin-left: 0 !important;
}

.stories-hero-img-wrap {
    overflow: hidden;
    background: #e0e0e0;
}

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

/* ── Top Stories 3-col grid ──────────────────────────────── */
.stories-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

/* ── Story card ─────────────────────────────────────────── */
.story-card {
    display: flex;
    flex-direction: column;
}

.story-card-img-wrap {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 4px;
    background: #e0e0e0;
    margin-bottom: 0.75rem;
}

.story-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.story-card:hover .story-card-img-wrap img {
    transform: scale(1.03);
}

.story-card-cat {
    font-size: 0.68rem;
    font-weight: 600;
    color: #007176;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    text-decoration: none;
    display: inline-block;
}

.story-card-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.35rem;
    color: #252525;
}

.story-card-title a {
    color: inherit;
    text-decoration: none;
}

.story-card-title a:hover {
    color: #007176;
}

.story-card-meta {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.35rem;
    margin-left: 0 !important;
}

/* ── Sidebar-style card list (In Depth / list rows) ─────── */
.stories-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.story-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0.85rem;
    align-items: start;
    padding: 0.85rem 0;
    border-bottom: 1px solid #ebebeb;
}

.story-row:last-child {
    border-bottom: none;
}

.story-row-img-wrap {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 3px;
    background: #e0e0e0;
}

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

.story-row-cat {
    font-size: 0.65rem;
    font-weight: 600;
    color: #007176;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    display: block;
    text-decoration: none;
}

.story-row-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.2rem;
    color: #252525;
}

.story-row-title a {
    color: inherit;
    text-decoration: none;
}

.story-row-title a:hover {
    color: #007176;
}

.story-row-meta {
    font-size: 0.72rem;
    color: #888;
    margin-left: 0;
}

/* ── 4-col grid (category feeds) ────────────────────────── */
.stories-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

/* ── Magazine callout ────────────────────────────────────── */
.stories-magazine-callout {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 8px;
    padding: 2rem;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 3rem;
}

.stories-magazine-cover {
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.stories-magazine-cover img {
    width: 100%;
    display: block;
}

.stories-magazine-cover-placeholder {
    background: #444;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #888;
}

.stories-magazine-info {
    color: #fff;
}

.stories-magazine-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--umbc-color-gold, #fdb515);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.stories-magazine-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

.stories-magazine-desc {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* "On the Cover" wrapper inside the dark magazine callout. The class also
   carries `.on-the-cover` (shared with the magazine single template), but
   umbc-magazine.css does not load here, so we have to style the heading
   ourselves. Wrapper stays transparent — the callout's dark gradient is
   the surface. Heading styled as a small-caps eyebrow in UMBC gold to
   pair with the existing .stories-magazine-eyebrow above. */
.stories-magazine-on-the-cover {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0;
}

.stories-magazine-on-the-cover h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--umbc-color-gold, #fdb515);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.4rem;
    line-height: 1.2;
}

/* The callout is always dark (gradient surface). Pin the text colors with
   selectors specific enough to beat any content-area heading/paragraph rules
   (e.g. `.entry-content h3/p`), which otherwise leave dark text on the dark
   callout — the "black on black" the editors saw. Same colors in both modes. */
.stories-magazine-callout .stories-magazine-eyebrow,
.stories-magazine-callout .stories-magazine-on-the-cover h3 {
    color: var(--umbc-color-gold, #fdb515);
}
.stories-magazine-callout .stories-magazine-title {
    color: #fff;
}
.stories-magazine-callout .stories-magazine-desc {
    color: #ccc;
}

.stories-magazine-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.stories-magazine-btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.stories-magazine-btn-primary {
    background: var(--umbc-color-gold, #fdb515);
    color: #1a1a1a;
}

.stories-magazine-btn-primary:hover {
    background: var(--umbc-btn-gold-hover, #e6a510);
    color: #1a1a1a;
}

.stories-magazine-btn-secondary {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}

.stories-magazine-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: #888;
}

/* ── No-image placeholder ────────────────────────────────── */
.story-card-no-img {
    aspect-ratio: 3 / 2;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .stories-top-row {
        grid-template-columns: 1fr;
    }

    .stories-top-nav-col {
        position: static;
        padding-right: 0;
    }

    .stories-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stories-hero {
        grid-template-columns: 1fr;
    }

    .stories-hero-img-wrap {
        height: 260px;
        order: -1;
    }
}

@media (max-width: 768px) {
    .stories-home-main {
        padding: 0 1rem 3rem;
    }

    .stories-grid-3 {
        grid-template-columns: 1fr;
    }

    .stories-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stories-magazine-callout {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .stories-magazine-cover {
        max-width: 180px;
        margin: 0 auto;
    }

    .stories-magazine-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stories-grid-4 {
        grid-template-columns: 1fr;
    }
}


/* =============================================================
   Pre-2015 archive footer link
   ============================================================= */
.stories-archive-footer-link {
   margin-top: 3rem;
   margin-left: auto;
   margin-right: auto;
   padding-top: 1.5rem;
   text-align: center;
}

.stories-archive-footer-link p {
   font-size: 0.9rem;
   color: #666;
   margin: 0;
   text-align:center;
}

.stories-archive-footer-link a {
   color: #007176;
   font-weight: 600;
   text-decoration: none;
}

.stories-archive-footer-link a:hover {
   text-decoration: underline;
}


/* =============================================================
   Dark mode
   ============================================================= */

[data-theme="dark"] .stories-home-main {
    background: transparent;
}

[data-theme="dark"] .stories-page-intro {
    border-bottom-color: #333;
}

[data-theme="dark"] .stories-page-title {
    color: #e8e8e8;
}

[data-theme="dark"] .stories-page-tagline {
    color: #888;
}

[data-theme="dark"] .stories-subscribe-inline-label {
    color: #aaa;
}

[data-theme="dark"] .stories-subscribe-inline input[type="email"] {
    background: #1e1e1e;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .stories-subscribe-inline input[type="email"]::placeholder {
    color: #666;
}

[data-theme="dark"] .stories-subscribe-inline input[type="email"]:focus {
    border-color: #fdb515;
    outline-color: #fdb515;
}

[data-theme="dark"] .stories-hero {
    border-color: #333;
    background: #1a1a1a;
}

[data-theme="dark"] .stories-hero-body {
    background: #1a1a1a;
}

[data-theme="dark"] .stories-hero-title {
    color: #e8e8e8;
}

[data-theme="dark"] .stories-hero-title a {
    color: #e8e8e8;
}

[data-theme="dark"] .stories-hero-title a:hover {
    color: #fff;
}

[data-theme="dark"] .stories-hero-excerpt {
    color: #b0b0b0;
}

[data-theme="dark"] .stories-hero-meta {
    color: #777;
}

[data-theme="dark"] .stories-hero-img-wrap {
    background: #2a2a2a;
}

[data-theme="dark"] .sh2 {
    color: #e0e0e0;
}

[data-theme="dark"] .stories-section {
    border-bottom-color: #2a2a2a;
}

[data-theme="dark"] .stories-see-all {
    color: #aaa;
    border-color: #444;
}

[data-theme="dark"] .stories-see-all:hover {
    background: #e0e0e0;
    color: #1a1a1a;
    border-color: #e0e0e0;
}

[data-theme="dark"] .story-card-title {
    color: #e0e0e0;
}

[data-theme="dark"] .story-card-title a {
    color: #e0e0e0;
}

[data-theme="dark"] .story-card-title a:hover {
    color: #fff;
}

[data-theme="dark"] .story-card-cat {
    color: #4db8bc;
}

[data-theme="dark"] .story-card-meta {
    color: #777;
}

[data-theme="dark"] .story-card-img-wrap,
[data-theme="dark"] .story-card-no-img {
    background: #2a2a2a;
}

[data-theme="dark"] .story-row {
    border-bottom-color: #2a2a2a;
}

[data-theme="dark"] .story-row-title a {
    color: #e0e0e0;
}

[data-theme="dark"] .story-row-title a:hover {
    color: #fff;
}

[data-theme="dark"] .story-row-cat {
    color: #4db8bc;
}

[data-theme="dark"] .story-row-meta {
    color: #777;
}

[data-theme="dark"] .story-row-img-wrap {
    background: #2a2a2a;
}

[data-theme="dark"] .stories-magazine-callout {
    background: linear-gradient(135deg, #111 0%, #1e1e1e 100%);
}

[data-theme="dark"] .stories-archive-footer-link {
    border-top-color: #333;
}

[data-theme="dark"] .stories-archive-footer-link p {
    color: #888;
}

[data-theme="dark"] .stories-archive-footer-link a {
    color: #fdb515;
}
