/* ============================================
   AgFoodNews.com — Custom Stylesheet
   Bootstrap 5.3 + Custom Components
   "TechCrunch for Ag-Food"
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --afn-dark: #163019;
    --afn-dark-hover: #0e2010;
    --afn-accent: #2D8A4E;
    --afn-accent-light: #e1f5ee;
    --afn-green: #2D8A4E;
    --afn-green-light: #e1f5ee;
    --afn-orange: #D4760A;
    --afn-orange-light: #faeeda;
    --afn-red: #C0392B;
    --afn-purple: #534AB7;
    --afn-purple-light: #EEEDFE;
    --afn-pink: #D4537E;
    --afn-pink-light: #FBEAF0;
    --afn-coral: #D85A30;
    --afn-coral-light: #FAECE7;
    --afn-amber: #BA7517;
    --afn-amber-light: #FAEEDA;

    --afn-body-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --afn-display-font: 'Fraunces', Georgia, serif;

    --afn-border: #e8e8e8;
    --afn-bg-soft: #f7f9fc;
    --afn-text: #1a1a1a;
    --afn-text-muted: #6b7280;
    --afn-text-faint: #9ca3af;

    --afn-radius: 8px;
    --afn-radius-lg: 12px;
    --afn-transition: 0.2s ease;
}

/* --- Base --- */
body {
    font-family: var(--afn-body-font);
    color: var(--afn-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container-fluid {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
}

a {
    color: var(--afn-accent);
    transition: color var(--afn-transition);
}
a:hover {
    color: var(--afn-dark);
}

/* --- Top Bar --- */
.afn-topbar {
    background: var(--afn-dark);
    color: #ffffff;
    padding: 6px 0;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.afn-topbar__date { opacity: 0.7; }
.afn-topbar__sep { opacity: 0.3; }
.afn-topbar__edition {
    color: #ffffff;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    transition: all var(--afn-transition);
}
.afn-topbar__edition:hover,
.afn-topbar__edition.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.afn-topbar__link {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.75rem;
    transition: color var(--afn-transition);
}
.afn-topbar__link:hover { color: #e0e0e0; }

/* --- Masthead --- */
.afn-masthead {
    border-bottom: 1px solid var(--afn-border);
    background: #fff;
}
.afn-masthead__logo {
    display: inline-block;
    transition: opacity var(--afn-transition);
}
.afn-masthead__logo:hover {
    opacity: 0.85;
}
.afn-masthead__logo img {
    max-height: 90px;
    width: auto;
    display: block;
    margin: 0 auto;
    padding: 0 !important;
}
.afn-masthead__tagline {
    font-size: 0.72rem;
    color: var(--afn-text-muted);
    margin-top: 0px;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

/* --- Primary Nav --- */
.afn-nav {
    border-top: 1px solid var(--afn-border);
    padding-top: 8px;
    margin-top: 8px;
}
.afn-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 0;
}
.afn-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--afn-text);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--afn-radius);
    transition: all var(--afn-transition);
}
.afn-nav__link:hover {
    color: var(--afn-accent);
    background: var(--afn-accent-light);
}
.afn-nav__link.active {
    color: var(--afn-accent);
    font-weight: 800;
}
.afn-nav__link i {
    display: none;
}

/* --- News Ticker --- */
.afn-ticker {
    background: var(--afn-dark);
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}
.afn-ticker__label {
    background: var(--afn-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 14px;
    flex-shrink: 0;
}
.afn-ticker__track {
    flex: 1;
    overflow: hidden;
    padding: 0 16px;
}
.afn-ticker__content {
    display: inline-block;
    animation: tickerScroll 40s linear infinite;
    color: #c8d8e8;
    font-size: 0.78rem;
}
.afn-ticker__item {
    cursor: pointer;
    transition: color var(--afn-transition);
}
.afn-ticker__item:hover { color: #fff; }
.afn-ticker__sep {
    margin: 0 12px;
    opacity: 0.4;
}

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

/* --- Category Pills --- */
.afn-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
}
.afn-pill--sm { font-size: 0.62rem; padding: 2px 8px; margin-top: 0; }

.afn-pill--startups { background: var(--afn-purple-light); color: #3C3489; }
.afn-pill--capital  { background: var(--afn-green-light);  color: #085041; }
.afn-pill--policy   { background: var(--afn-amber-light);  color: #633806; }
.afn-pill--ag-ai    { background: var(--afn-accent-light); color: #0C447C; }
.afn-pill--dairy-tech { background: var(--afn-pink-light); color: #72243E; }
.afn-pill--ag-robotics { background: var(--afn-coral-light); color: #712B13; }

/* --- Hero Section --- */
.afn-hero {
    padding: 20px 0;
}
.afn-hero__image img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}
.afn-hero__placeholder {
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, #163019 0%, #2d5a33 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    gap: 6px;
}
.afn-hero__headline {
    font-family: var(--afn-display-font);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 8px;
}
.afn-hero__headline a {
    color: var(--afn-dark);
    text-decoration: none;
    transition: color var(--afn-transition);
}
.afn-hero__headline a:hover { color: var(--afn-accent); }
.afn-hero__excerpt {
    font-size: 0.88rem;
    color: var(--afn-text-muted);
    margin-top: 8px;
    line-height: 1.6;
}
.afn-hero__meta {
    font-size: 0.72rem;
    color: var(--afn-text-faint);
    margin-top: 8px;
}

/* Side Stories */
.afn-hero__sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.afn-side-story {
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--afn-border);
}
.afn-side-story:last-child { border-bottom: none; padding-bottom: 0; }
.afn-side-story__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--afn-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.afn-side-story__icon--startups { background: var(--afn-purple-light); color: var(--afn-purple); }
.afn-side-story__icon--ag-ai    { background: var(--afn-accent-light); color: var(--afn-accent); }
.afn-side-story__icon--policy   { background: var(--afn-amber-light);  color: var(--afn-amber); }
.afn-side-story__icon--dairy-tech { background: var(--afn-pink-light); color: var(--afn-pink); }
.afn-side-story__headline {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    margin-top: 4px;
}
.afn-side-story__headline a {
    color: var(--afn-text);
    text-decoration: none;
}
.afn-side-story__headline a:hover { color: var(--afn-accent); }
.afn-side-story__meta {
    font-size: 0.68rem;
    color: var(--afn-text-faint);
    margin-top: 4px;
}

/* --- Section Headers --- */
.afn-section {
    padding: 24px 0;
    border-top: 1px solid var(--afn-border);
}
.afn-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.afn-section__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--afn-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.afn-section__title i {
    color: var(--afn-accent);
    font-size: 1.1rem;
}
.afn-section__link {
    font-size: 0.78rem;
    color: var(--afn-accent);
    text-decoration: none;
    font-weight: 500;
}
.afn-section__link:hover { text-decoration: underline; }

/* --- Interview Cards --- */
.afn-interview-card {
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius-lg);
    padding: 16px 12px;
    background: #fff;
    transition: all var(--afn-transition);
}
.afn-interview-card:hover {
    border-color: var(--afn-accent);
    box-shadow: 0 2px 12px rgba(46,117,182,0.08);
}
.afn-interview-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--afn-accent-light);
    color: var(--afn-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    font-size: 0.85rem;
}
.afn-interview-card__name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--afn-dark);
}
.afn-interview-card__title {
    font-size: 0.68rem;
    color: var(--afn-text-muted);
    margin-top: 2px;
}
.afn-interview-card__quote {
    font-size: 0.68rem;
    color: var(--afn-text-faint);
    margin-top: 6px;
    font-style: italic;
    line-height: 1.4;
}

/* --- Deal Flow Table --- */
.afn-deal-tabs {
    gap: 0;
    border-bottom: none;
}
.afn-deal-tab {
    font-size: 0.78rem;
    padding: 6px 16px;
    border: 1px solid var(--afn-border);
    background: #fff;
    color: var(--afn-text-muted);
    text-decoration: none;
    transition: all var(--afn-transition);
    cursor: pointer;
}
.afn-deal-tab:first-child { border-radius: var(--afn-radius) 0 0 var(--afn-radius); }
.afn-deal-tab:last-child  { border-radius: 0 var(--afn-radius) var(--afn-radius) 0; }
.afn-deal-tab.active {
    background: var(--afn-dark);
    color: #fff;
    border-color: var(--afn-dark);
}
.afn-deal-table {
    font-size: 0.78rem;
}
.afn-deal-table th {
    font-weight: 500;
    color: var(--afn-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom-width: 1px;
}
.afn-deal-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--afn-border);
}
.afn-deal-amount {
    font-weight: 700;
    color: var(--afn-green);
}

/* --- Vertical Cards --- */
.afn-vert-card {
    display: block;
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius);
    padding: 12px;
    background: #fff;
    transition: all var(--afn-transition);
    height: 100%;
}
.afn-vert-card:hover {
    border-color: var(--afn-accent);
    background: var(--afn-accent-light);
    transform: translateY(-1px);
}
.afn-vert-card__icon {
    color: var(--afn-accent);
    font-size: 1.1rem;
}
.afn-vert-card__name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--afn-dark);
    margin-top: 4px;
}
.afn-vert-card__headline {
    font-size: 0.7rem;
    color: var(--afn-text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

/* --- Country Cards --- */
.afn-country-card {
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius);
    padding: 12px 6px;
    background: #fff;
    transition: all var(--afn-transition);
}
.afn-country-card:hover {
    border-color: var(--afn-accent);
    background: var(--afn-accent-light);
}
.afn-country-card__flag {
    font-size: 1.6rem;
}
.afn-country-card__name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--afn-dark);
    margin-top: 4px;
}

/* --- Network Strip --- */
.afn-network {
    background: var(--afn-bg-soft);
    padding: 24px 0;
    border-top: 1px solid var(--afn-border);
}
.afn-network__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--afn-text-muted);
    margin-bottom: 12px;
}
.afn-network__logos {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}
.afn-network__logo {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--afn-text);
    text-decoration: none;
    opacity: 0.5;
    transition: opacity var(--afn-transition);
}
.afn-network__logo:hover { opacity: 1; color: var(--afn-accent); }
.afn-network__teaser {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--afn-orange);
    font-weight: 500;
}

/* --- Community Cards --- */
.afn-comm-card {
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius-lg);
    padding: 16px;
    background: #fff;
    height: 100%;
}
.afn-comm-card__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--afn-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.afn-comm-card__title i { color: var(--afn-accent); }
.afn-comm-card__search {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--afn-bg-soft);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--afn-text-faint);
}
.afn-comm-card__item {
    font-size: 0.75rem;
    color: var(--afn-text-muted);
    padding: 6px 0;
    border-bottom: 1px solid var(--afn-border);
}
.afn-comm-card__item:last-of-type { border-bottom: none; }
.afn-comm-card__link {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--afn-accent);
    font-weight: 500;
    text-decoration: none;
}
.afn-comm-card__link:hover { text-decoration: underline; }
.afn-comm-card__powered {
    font-size: 0.65rem;
    color: var(--afn-text-faint);
    margin-top: 8px;
}

/* --- Newsletter --- */
.afn-newsletter {
    background: var(--afn-dark);
    padding: 40px 0;
}
.afn-newsletter__title {
    font-family: var(--afn-display-font);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}
.afn-newsletter p {
    font-size: 0.9rem;
    color: #ffffff;
    margin-bottom: 16px;
}
.afn-newsletter__companies {
    font-size: 0.75rem;
    color: #ffffff;
    margin-top: 16px;
}
.afn-newsletter__sub {
    color: #ffffff;
    font-size: 0.85rem;
    margin-top: 6px;
}
.afn-newsletter__form {
    display: flex;
    gap: 8px;
    max-width: 440px;
    margin: 16px auto 0;
}
.afn-newsletter__input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--afn-radius);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 0.85rem;
    font-family: var(--afn-body-font);
}
.afn-newsletter__input::placeholder { color: #6a8aa8; }
.afn-newsletter__input:focus {
    outline: none;
    border-color: var(--afn-accent);
    background: rgba(255,255,255,0.12);
}
.afn-newsletter__btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--afn-radius);
    background: var(--afn-accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--afn-transition);
}
.afn-newsletter__btn:hover { background: #2563a0; }
.afn-newsletter__proof { margin-top: 18px; }
.afn-newsletter__proof-label {
    font-size: 0.7rem;
    color: #ffffff;
}
.afn-newsletter__proof-logos {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 6px;
}
.afn-newsletter__proof-logos span {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
    opacity: 1;
}

/* --- Footer --- */
.afn-footer {
    border-top: 1px solid var(--afn-border);
    padding: 32px 0 16px;
    background: #fff;
}
.afn-footer__heading {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--afn-text-muted);
    margin-bottom: 8px;
}
.afn-footer__link {
    display: block;
    font-size: 0.78rem;
    color: var(--afn-text-muted);
    text-decoration: none;
    padding: 3px 0;
}
.afn-footer__link:hover { color: var(--afn-accent); }
.afn-footer__verticals {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
}
.afn-footer__vert-link {
    font-size: 0.72rem;
    color: var(--afn-text-faint);
    text-decoration: none;
}
.afn-footer__vert-link:hover { color: var(--afn-accent); }
.afn-footer__bottom {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--afn-border);
    font-size: 0.7rem;
    color: var(--afn-text-faint);
    display: flex;
    justify-content: space-between;
}
.afn-footer__bottom a {
    color: var(--afn-text-faint);
    text-decoration: none;
}
.afn-footer__bottom a:hover { color: var(--afn-accent); }

/* --- Inner Page Styles --- */
.afn-page-main {
    min-height: 60vh;
}
.afn-page-heading {
    font-family: var(--afn-display-font);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--afn-dark);
    margin-bottom: 4px;
}
.afn-page-desc {
    font-size: 0.88rem;
    color: var(--afn-text-muted);
    margin-bottom: 24px;
    max-width: 700px;
}
.afn-breadcrumb {
    font-size: 0.75rem;
}
.afn-breadcrumb .breadcrumb-item a {
    color: var(--afn-text-muted);
    text-decoration: none;
}
.afn-breadcrumb .breadcrumb-item a:hover {
    color: var(--afn-accent);
}
.afn-breadcrumb .breadcrumb-item.active {
    color: var(--afn-text-faint);
}

/* Sidebar cards */
.afn-sidebar-card {
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius-lg);
    padding: 16px;
    background: #fff;
}
.afn-sidebar-card__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--afn-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.afn-sidebar-card__title i {
    color: var(--afn-accent);
}

/* Article body typography */
.afn-article-body {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--afn-text);
}
.afn-article-body h2 {
    font-family: var(--afn-display-font);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--afn-dark);
    margin-top: 32px;
    margin-bottom: 12px;
}
.afn-article-body p {
    margin-bottom: 16px;
}
.afn-article-body .lead {
    font-size: 1.1rem;
    color: var(--afn-dark);
    font-weight: 400;
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Placeholder content */
.afn-placeholder-content {
    padding: 40px;
    border: 2px dashed var(--afn-border);
    border-radius: var(--afn-radius-lg);
    text-align: center;
}

/* --- Ad Slot System --- */
.afn-ad {
    text-align: center;
    margin: 20px 0;
    clear: both;
}
.afn-ad--leaderboard { margin: 16px auto; }
.afn-ad--sidebar { margin-bottom: 16px; }
.afn-ad--in-feed { margin: 12px 0; }
.afn-ad--sticky-sidebar {
    position: sticky;
    top: 16px;
}
.afn-ad__placeholder {
    margin: 0 auto;
    background: repeating-linear-gradient(
        45deg,
        var(--afn-bg-soft),
        var(--afn-bg-soft) 10px,
        #eef2f7 10px,
        #eef2f7 20px
    );
    border: 1px dashed var(--afn-border);
    border-radius: var(--afn-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.afn-ad__label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--afn-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.afn-ad__dims {
    font-size: 0.62rem;
    color: var(--afn-text-faint);
}

/* Tile ads: small inline cards for sponsored content */
.afn-ad-tile {
    border: 1px solid var(--afn-border);
    border-radius: var(--afn-radius);
    padding: 12px;
    background: var(--afn-bg-soft);
    margin-bottom: 12px;
}
.afn-ad-tile__label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--afn-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.afn-ad-tile__content {
    font-size: 0.78rem;
    color: var(--afn-text);
    font-weight: 500;
}
.afn-ad-tile__sponsor {
    font-size: 0.68rem;
    color: var(--afn-text-muted);
    margin-top: 4px;
}

/* --- Responsive --- */
@media (max-width: 767px) {
    .afn-topbar__editions { display: none; }
    .afn-hero__headline { font-size: 1.2rem; }
    .afn-hero__placeholder,
    .afn-hero__image img { height: 200px; }
    .afn-nav__list { overflow-x: auto; white-space: nowrap; }
    .afn-newsletter__form { flex-direction: column; }
    .afn-footer__bottom { flex-direction: column; gap: 4px; }
    .afn-country-card__flag { font-size: 1.2rem; }
}
