@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Merriweather:wght@400;700&display=swap');

:root {
    /* set colors */
    --primary-color: #000000;
    --secondary-color: #ffffff;
    --gray-light: #ebeaea;
    --gray-medium: #666666;
    --border-color: #e2e2e2;
    /* Font sizes for large screens (≥992px) */
    --title-large: 2rem;
    /* Double-wide cards */
    --title-medium: 1.65rem;
    /* Regular stories */
    --title-small: 1.1rem;
    /* Category cards */
    --text-size: 1rem;
    --byline-size: 0.9rem;
    --date-size: 0.85rem;

    /* Image heights */
    --img-height-large: 400px;
    --img-height-medium: 240px;
    --img-height-small: 180px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--primary-color);
}

body {
    font-family: "Georgia", serif;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--primary-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

main .container {
    background-color: var(--secondary-color);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#storiesContainer {
    margin: 0;
    width: 100%;
    max-width: 100%;
}

header {
    text-align: center;
    background-color: var(--primary-color);
    width: 100%;
    padding: 0;
    margin: 0;
    left: 0;
    right: 0;
    padding-top: 1rem;
    position: relative;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 700;
    color: var(--secondary-color);
    letter-spacing: -0.5px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    margin: 0 0 1rem 0;
}

/* Nav Category list */
.category-list {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.75rem 0;
    margin: 0;
    border-top: 1px solid var(--secondary-color);
    flex-wrap: wrap;
    background-color: var(--primary-color);
}

.category-list li {
    color: var(--secondary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.3s;
}

.category-list li:hover {
    opacity: 0.8;
}

.nav-controls {
    background-color: var(--primary-color);
    padding: 0;
    /* default hide */
    display: none;
    justify-content: center;
    gap: 1.5rem;
    border-top: 1px solid var(--secondary-color);

}

.nav-controls-mobile {
    background-color: var(--primary-color);
    padding: 0.75rem 0;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    border-top: 1px solid var(--secondary-color);
    border-bottom: 1px solid var(--gray-dark);
    position: relative;
    z-index: 1;
}

.nav-controls select,
.nav-controls button,
.nav-controls-mobile select,
.nav-controls-mobile button {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    color: var(--secondary-color);
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-controls select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 1.5rem;
}

.nav-controls-mobile select {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    min-width: 150px;
    max-width: 200px;
    height: 1.75rem;
    font-size: 0.85rem;
    padding: 0 1.5rem 0 0.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 1.5rem;
    line-height: 1.75rem;
}

.nav-controls-mobile button {
    color: var(--secondary-color);
    padding: 0 0.75rem;
    height: 1.75rem;
    min-width: auto;
    width: auto;
    border: 1px solid var(--secondary-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-controls-mobile button i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    top: 1px;
}

/* Section Tags on photos */
.sections-card {
    border: 2px solid var(--primary-color);
    background-color: var(--primary-color);
    display: flex;
    flex-direction: column;
    border-radius: 4px 4px 0 0;
}

.sections-title {
    color: var(--secondary-color);
    padding: 1rem;
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sections-content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: var(--primary-color);
}

.icon-spacing {
    margin-right: 0.5rem;
}

/* Refresh button */
select, button {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 0 !important;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em;
    padding-right: 2.5rem;
}

button {
    font-weight: bold;
}

select:hover, button:hover {
    background-color: var(--gray-light);
    /* color: var(--secondary-color); */
}

select {
    min-width: 200px;
}

button {
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Regular card size */
.card {
    position: relative;
    background: var(--secondary-color);
    height: 100%;
    border: none;
    border-radius: 0;
    transition: background-color 0.2s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    background: linear-gradient(to bottom,
            var(--gray-light) 0%,
            var(--gray-light) 50%,
            var(--secondary-color) 100%);
}

.card-img-top {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.card-body {
    padding: 1rem 0.75rem;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: var(--title-medium);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.card-title a:hover {
    text-decoration: underline;
}

.card-text {
    font-size: var(--text-size);
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Card image and category tag styles */
.card-img-wrapper {
    position: relative;
    width: 100%;
}

.category-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
    letter-spacing: 0.5px;
    border-top: 3px solid var(--secondary-color);
    border-right: 3px solid var(--secondary-color);
    border-radius: 0 4px 0 0;
}

/* Top story */
.top-story .card-title {
    font-size: var(--title-large);
    object-fit: cover;
    object-position: center top;
}

.top-story .card-img-top {
    height: var(--img-height-large);
    object-fit: cover;
    object-position: center top;
}

/* Author and date */
.byline, .date {
    color: var(--gray-medium);
}

.byline {
    font-size: var(--byline-size);
    margin-bottom: 0.25rem;
}

.date {
    font-size: var(--date-size);
    display: block;
}

/* Card title and hover styles */
.card-title {
    font-family: 'Playfair Display', serif;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.card-title a {
    color: var(--primary-color);
    text-decoration: none;
    transition: text-decoration 0.3s ease;
}

/* Top story */
.col-md-8 .card-title {
    font-size: var(--title-large);
}

/* Regular card */
.col-md-4 .card-title {
    font-size: var(--title-medium);
}

/* Small cards */
.col-md-3 .card-title {
    font-size: var(--title-small);
    line-height: 1.3;
}

/* Section headers */
.section-header {
    font-family: 'Playfair Display', serif;
    font-size: var(--title-medium);
    font-weight: bold;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--primary-color);
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
}

.section-header:hover {
    color: var(--gray-medium);
    border-bottom-color: var(--gray-medium);
}

@media (max-width: 991px) {
    .section-header {
        font-size: var(--title-small);
    }
}

@media (max-width: 767px) {
    .section-header {
        font-size: var(--title-small);
        padding-bottom: 0.35rem;
        margin-bottom: 0.35rem;
    }
}

/* Large screens and up (≥992px) */
@media (min-width: 992px) {
    .nav-controls {
        display: flex !important;
    }

    .nav-controls-mobile {
        display: none !important;
    }

    /* Show regular nav categories on large screens */
    .category-list {
        display: flex !important;
        gap: 1rem;
    }

    .category-list li {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }

    /* Show sections card on large and XL screens */
    .sections-card {
        display: flex !important;
    }

    /* Hide second story on large screens */
    .second-story {
        display: none !important;
    }
}

/* Medium devices (tablets, 768px to 991px) */
@media (max-width: 991px) {

    /* Typography */
    :root {
        --title-large: 1.75rem;
        --title-medium: 1.15rem;
        --title-small: 1rem;
        --text-size: 0.95rem;
        --byline-size: 0.85rem;
        --date-size: 0.8rem;
        --img-height-large: 300px;
        --img-height-medium: 200px;
        --img-height-small: 150px;
    }

    /* Header Layout */
    header .container {
        display: flex;
        flex-direction: column;
    }

    h1 {
        order: 0;
    }

    /* Logo at top */
    .nav-controls {
        order: 1;
    }

    /* First nav */
    .nav-controls-mobile {
        order: 2;
    }

    /* Second nav */
    .stock-ticker {
        order: 3;
    }

    /* Stock ticker below navs */

    /* Navigation Display */
    .nav-controls {
        display: none !important;
    }

    .nav-controls-mobile {
        display: flex !important;
    }

    .category-list {
        display: none !important;
    }

    .sections-card {
        display: none !important;
    }

    .second-story {
        display: block !important;
    }

    /* Layout Adjustments */
    .container {
        padding: 1rem;
    }

    .card-body {
        padding: 1.25rem 0.85rem;
    }

    /* Mobile Controls */
    .mobile-controls {
        display: flex;
        justify-content: flex-end;
        background-color: var(--primary-color);
        padding: 0.5rem 2rem;
        border-top: 1px solid var(--secondary-color);
    }

    .mobile-controls select,
    .mobile-controls button {
        background-color: transparent;
        border: none;
        color: var(--secondary-color);
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        padding: 0.25rem 1rem;
        min-width: 150px;
        height: auto;
    }

    .mobile-controls select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    }
}

/* Small devices (landscape phones, 576px to 767px) */
@media (max-width: 767px) {

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1rem;
    }

    /* Layout */
    .container {
        padding: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Images */
    :root {
        --img-height-large: 250px;
        --img-height-medium: 180px;
        --img-height-small: 200px;
    }

    /* Controls */
    .controls {
        flex-direction: column;
        align-items: center;
    }

    select, button {
        width: 100%;
        max-width: 300px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {

    /* Typography */
    h1 {
        font-size: 1rem;
    }

    h2 {
        font: 1rem;
    }

    /* Layout */
    .container {
        padding: 0.5rem;
    }

    /* Images */
    :root {
        --img-height-large: 200px;
        --img-height-medium: 200px;
        --img-height-small: 180px;
    }

    /* Adjust font sizes for mobile */
    .col-md-8 .card-title {
        font-size: 1.25rem;
    }

    .col-md-4 .card-title {
        font-size: 1.25rem;
    }

    .small-card .card-title {
        font-size: 1.1rem;
    }

    .card-text {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Footer Styles */
.site-footer {
    background-color: var(--primary-color);
    width: 100%;
    margin: 0;
    position: relative;
    padding-bottom: 1rem;
}

.footer-nav {
    margin: 0;
    border-top: 1px solid var(--gray-medium);
    border-bottom: 1px solid var(--gray-medium);
}

.footer-nav li {
    color: var(--secondary-color);
}

.site-footer .copyright {
    color: var(--gray-light);
    font-size: 0.9rem;
    margin: 0;
    padding: 0.5rem 0;
    padding: 1rem 0 0 0;
    text-align: center;
}

.main-wrapper {
    background-color: var(--secondary-color);
    width: 100%;
    padding: 2rem 0;
}

.byline {
    font-family: 'Merriweather', serif;
    font-size: var(--byline-size);
    color: var(--gray-medium);
    margin-bottom: 0.25rem;
}

.date {
    font-size: var(--date-size);
    color: var(--gray-medium);
    display: block;
}

.card:hover .card-title a {
    text-decoration: underline;
}

/* Footer Navigation Controls */
.footer-nav-controls {
    background-color: var(--primary-color);
    padding: 0.75rem 0;
    display: none;
    justify-content: center;
    gap: 1.5rem;
    border-top: 1px solid var(--secondary-color);
}

.footer-nav-controls-mobile {
    background-color: var(--primary-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    /* border-top: 1px solid var(--secondary-color); */
    position: relative;
    z-index: 1;
}

.footer-nav-controls select,
.footer-nav-controls button,
.footer-nav-controls-mobile select,
.footer-nav-controls-mobile button {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    color: var(--secondary-color);
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.footer-nav-controls select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 1.5rem;
}

.footer-nav-controls-mobile select {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    min-width: 150px;
    max-width: 200px;
    height: 1.75rem;
    font-size: 0.85rem;
    padding: 0 1.5rem 0 0.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 1.5rem;
    line-height: 1.75rem;
}

.footer-nav-controls-mobile button {
    color: var(--secondary-color);
    padding: 0 0.75rem;
    height: 1.75rem;
    min-width: auto;
    width: auto;
    border: 1px solid var(--secondary-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Update media queries for footer navigation */
@media (min-width: 992px) {
    .footer-nav-controls {
        display: flex;
    }

    .footer-nav-controls-mobile {
        display: none;
    }
}

/* Stock Ticker Styles */
.stock-ticker {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    height: 2.5rem;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid var(--secondary-color);
    border-bottom: 1px solid var(--gray-dark);
    margin-top: -1px;
    /* Remove gap between nav and ticker */
}

.stock-ticker-content {
    display: inline-block;
    animation: ticker 60s linear infinite;
    height: 100%;
    line-height: 2.5rem;
    white-space: nowrap;
}

.stock-item {
    display: inline-block;
    padding: 0 1rem;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.stock-change-positive {
    color: #0cd667;
}

.stock-change-negative {
    color: #fd5151;
}

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

    100% {
        transform: translateX(-50%);
    }
}

/* Pause animation on hover */
.stock-ticker:hover .stock-ticker-content {
    animation-play-state: paused;
}

.row {
    margin-left: -15px;
    margin-right: -15px;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Center row content */
}

/* Fix for card columns */
.col-12, .col-sm-6, .col-md-4, .col-lg-3 {
    padding: 0 15px;
    /* Match Bootstrap padding */
}

/* Ensure top story is centered */
.top-story {
    margin: 0;
}

/* Center sections card */
.sections-card {
    margin: 0 auto;
    width: 100%;
}

#storiesContainer>.row {
    justify-content: flex-start !important;
}

.top-story {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Ensure container doesn't force centering */
main .container {
    display: block;
}

.top-story .card-body {
    padding-left: 0;
}