:root {
    --bg-color: #0a0a0f;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-color: #f59e0b; /* Amber 500 */
    --accent-hover: #d97706; /* Amber 600 */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1a1a2e; 
}
::-webkit-scrollbar-thumb {
    background: #4b5563; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color); 
}
a{
    color: var(--text-primary);
    text-decoration: none;
}

/* Glassmorphism */
.glass {
    background: rgba(16, 16, 24, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hover-scale {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-scale:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

/* Typography: first paragraph drop cap on article body */
.drop-cap::first-letter,
.drop-cap-article > p:first-of-type::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.1rem;
    color: var(--accent-color);
    font-weight: bold;
}

/* Brand logo: fixed box, never blocks LCP; hide on load failure */
.n1-nav-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    min-width: 0;
}
.n1-nav-brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.n1-nav-logo {
    height: 28px;
    width: auto;
    max-width: 84px;
    max-height: 28px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
    object-position: left center;
}
.n1-nav-logo[hidden] {
    display: none;
}
/* Mobile: keep burger inset; brand can shrink so logo+name never shove it off-edge */
.n1-nav-mobile-toggle {
    margin-right: 0;
}
@media (max-width: 767px) {
    .n1-nav-bar {
        gap: 0.75rem;
    }
    .n1-nav-logo {
        max-width: 72px;
    }
    .n1-nav-brand-link {
        font-size: 1.25rem;
        line-height: 1.2;
    }
}

/* Desktop nav: visible links + More overflow dropdown */
.n1-nav-menus {
    position: relative;
    align-items: center;
    justify-content: flex-start;
    height: 5rem;
    gap: 0.15rem;
    min-width: 0;
}
@media (min-width: 768px) {
    .n1-nav-menus.n1-nav-menus--pending {
        visibility: hidden;
    }
}
.n1-nav-primary {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 0.75rem;
    min-width: 0;
    overflow: hidden;
    height: 100%;
}
.n1-nav-primary.is-measuring {
    overflow: visible;
}
.n1-nav-link {
    flex: 0 0 auto;
    display: block;
    max-width: none !important;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    transition: color 0.2s ease;
}
.n1-nav-link.is-overflow {
    display: none !important;
}
.n1-nav-more {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
}
.n1-nav-more[hidden] {
    display: none !important;
}
.n1-nav-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}
.n1-nav-more-btn i {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}
.n1-nav-more.is-open .n1-nav-more-btn,
.n1-nav-more-btn:hover,
.n1-nav-more-btn:focus-visible {
    color: var(--accent-color);
}
.n1-nav-more.has-active .n1-nav-more-btn {
    color: #fff;
}
.n1-nav-more.is-open .n1-nav-more-btn i {
    transform: rotate(180deg);
}
.n1-nav-more-panel {
    position: absolute;
    top: calc(100% - 0.75rem);
    right: 0;
    z-index: 70;
    min-width: 12rem;
    max-width: min(18rem, 70vw);
    max-height: min(60vh, 22rem);
    overflow-y: auto;
    padding: 0.4rem;
    border-radius: 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(16, 16, 24, 0.98);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.n1-nav-more-panel[hidden] {
    display: none !important;
}
.n1-nav-more-panel .nav-menu-item {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 0.45rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    color: #d1d5db;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: background 0.15s ease, color 0.15s ease;
}
.n1-nav-more-panel .nav-menu-item:hover,
.n1-nav-more-panel .nav-menu-item:focus-visible {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-color);
}
.n1-nav-more-panel .nav-menu-item.active,
.n1-nav-more-panel .nav-menu-item.text-white {
    color: #fff;
    background: rgba(245, 158, 11, 0.16);
}

/* Mobile Menu — absolute overlay under sticky nav (does not push content) */
#site-nav {
    position: sticky;
    overflow: visible;
}
#mobile-menu.mobile-menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    background: rgba(16, 16, 24, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    transition: max-height 0.28s ease, opacity 0.22s ease, visibility 0.22s ease;
}
#mobile-menu.mobile-menu-panel[hidden] {
    display: none !important;
}
#mobile-menu.mobile-menu-panel.open {
    display: block !important;
    max-height: min(70vh, 28rem);
    opacity: 1;
    overflow-y: auto;
    pointer-events: auto;
    visibility: visible;
}
.mobile-menu-inner {
    padding: 0.5rem 1rem 0.75rem;
}
.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.mobile-menu-link {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-weight: 500;
    line-height: 1.25;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.mobile-menu-link:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}
.mobile-menu-link.active,
.mobile-menu-link.text-white {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    font-weight: 600;
}
.mobile-menu-auth {
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    align-items: center;
    min-height: 3.25rem;
}
/* Sign In / logged-in row share one slot so leftover invisible nodes can't push content down */
.mobile-menu-auth > .mobile-menu-signin,
.mobile-menu-auth > .n1-nav-user--mobile {
    grid-area: 1 / 1;
    width: 100%;
    box-sizing: border-box;
}
.mobile-menu-signin {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 2.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    color: #f59e0b;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}
.mobile-menu-signin:hover {
    background: rgba(245, 158, 11, 0.1);
}
.mobile-menu-signin i {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* High-contrast menu toggle (CSS burger — no Font Awesome dependency) */
.mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.55);
    outline: none;
}
.mobile-menu-toggle.is-open {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #0a0a0f;
}
.mobile-menu-toggle.is-open:hover,
.mobile-menu-toggle.is-open:focus-visible {
    background: #fbbf24;
    border-color: #fbbf24;
}
.mobile-menu-burger {
    position: relative;
    display: block;
    width: 1.125rem;
    height: 0.875rem;
}
.mobile-menu-burger span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.22s ease, opacity 0.22s ease, top 0.22s ease;
}
.mobile-menu-burger span:nth-child(1) { top: 0; }
.mobile-menu-burger span:nth-child(2) { top: 50%; margin-top: -1px; }
.mobile-menu-burger span:nth-child(3) { bottom: 0; }
.mobile-menu-toggle.is-open .mobile-menu-burger span:nth-child(1) {
    top: 50%;
    margin-top: -1px;
    transform: rotate(45deg);
}
.mobile-menu-toggle.is-open .mobile-menu-burger span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.is-open .mobile-menu-burger span:nth-child(3) {
    top: 50%;
    bottom: auto;
    margin-top: -1px;
    transform: rotate(-45deg);
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255,255,255,0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: var(--accent-color);
    animation: spin 1s linear infinite;
    display: inline-block;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hero carousel: shorter on mobile so more content appears above the fold */
.hero-carousel {
    height: 380px;
}
.hero-carousel .carousel-caption {
    padding: 1rem;
    padding-bottom: 2.5rem;
}
.hero-carousel .carousel-title {
    font-size: 1.25rem;
    line-height: 1.25;
}
.hero-carousel .carousel-summary {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}
.hero-carousel .carousel-indicators {
    bottom: 0.75rem;
}
@media (min-width: 768px) {
    .hero-carousel {
        height: 550px;
    }
    .hero-carousel .carousel-caption {
        padding: 2rem;
        padding-bottom: 2rem;
    }
    .hero-carousel .carousel-title {
        font-size: 3rem;
    }
    .hero-carousel .carousel-summary {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
    .hero-carousel .carousel-indicators {
        bottom: 1.25rem;
    }
}
@media (min-width: 1024px) {
    .hero-carousel {
        height: 650px;
    }
}

/* Category horizontal scroll — ensure right padding when scrolled to end */
.category-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.category-scroll-inner {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    white-space: nowrap;
    padding: 0.875rem 1rem;
    min-width: 100%;
    box-sizing: border-box;
}

/* Module section headers — compact on mobile */
.module-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}
.module-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.module-section-header--bordered {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #1f2937;
}
.module-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    border-left: 4px solid var(--accent-color);
    padding-left: 0.75rem;
    line-height: 1.25;
    min-width: 0;
}
.module-section-link {
    flex-shrink: 0;
    font-size: 0.75rem;
}
@media (min-width: 768px) {
    .module-section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
    .module-section-header {
        margin-bottom: 2.5rem;
    }
    .module-section-header--bordered {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }
    .module-section-title {
        font-size: 1.875rem;
    }
    .module-section-link {
        font-size: 0.875rem;
    }
}
.module-section-spaced {
    margin-top: 2.5rem;
}
@media (min-width: 768px) {
    .module-section-spaced {
        margin-top: 5rem;
    }
}

/* Back to top — fixed to viewport; keep outside footer in markup */
.n1-back-to-top.back-to-top {
    position: fixed !important;
    bottom: 1.25rem !important;
    right: 1rem !important;
    left: auto !important;
    top: auto !important;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    font-size: 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
    z-index: 9990;
    transform: none;
}
.n1-back-to-top.back-to-top:not(.show) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.5rem) scale(0.9);
}
.n1-back-to-top.back-to-top.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}
.n1-back-to-top.back-to-top::before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.n1-back-to-top.back-to-top:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 12px 35px rgba(245, 158, 11, 0.45);
    transform: translateY(-2px);
}
@media (min-width: 768px) {
    .n1-back-to-top.back-to-top {
        bottom: 2rem !important;
        right: 1.875rem !important;
        width: 56px;
        height: 56px;
        border-radius: 28px;
        font-size: 22px;
    }
}

/* News Ticker Animation
   Starts just off the right edge of the track (padding-left: 100%),
   so text appears immediately instead of waiting for a long off-screen travel. */
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
.ticker-track {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
}
.ticker-content {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    width: max-content;
    padding-left: 100%;
    animation: ticker linear infinite;
    animation-duration: 40s; /* fallback; JS sets duration from content length */
    will-change: transform;
}
.ticker-content:hover {
    animation-play-state: paused;
}

/* Market Ticker */
.market-ticker-container {
    overflow: hidden;
    position: relative;
}
.market-items {
    display: flex;
    animation: slide-left 40s linear infinite;
}
@keyframes slide-left {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Opinion Cards */
.opinion-card {
    border-left: 4px solid var(--accent-color);
}

/* Scroll Hide */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Below-fold modules: skip layout/paint until near viewport */
.module-section,
.module-section-spaced,
aside .bg-secondary {
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
}

@media (prefers-reduced-motion: reduce) {
    .ticker-content,
    .market-items {
        animation: none !important;
    }
    .fade-in {
        animation: none !important;
    }
}

/* content-link-marker */
#article-content a {
  color: #fbbf24;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 1px;
  text-decoration-thickness: 1px;
  background-image: linear-gradient(transparent 55%, rgba(245, 158, 11, 0.35) 55%);
  background-repeat: no-repeat;
  padding: 0 0.05em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
}
#article-content a:hover {
  color: #fcd34d;
  background-image: linear-gradient(transparent 55%, rgba(245, 158, 11, 0.5) 55%);
}
/* /content-link-marker */

/* detail-content-images */
#article-content figure,
#article-content picture {
  display: block;
  max-width: 100%;
  margin: 1.25rem auto;
  text-align: center;
}
#article-content img {
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 1.25rem auto;
  background: #f4f4f4;
  object-fit: contain;
}
#article-content figure img,
#article-content picture img {
  margin-top: 0;
  margin-bottom: 0;
}
#article-content img.detail-img-broken {
  object-fit: fill;
}

.n1-article-times {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  margin-top: 0.15rem;
  color: #6b7280;
  font-size: 0.75rem;
  line-height: 1.35;
}
.n1-article-times time {
  white-space: nowrap;
}
@media (min-width: 768px) {
  .n1-article-times {
    font-size: 0.875rem;
  }
}

@media (max-width: 767px) {
  .n1-article-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.125rem;
  }
  article header h1.text-3xl {
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 1rem;
  }
  #article-content.prose-lg {
    font-size: 0.9375rem;
    line-height: 1.65;
  }
  .drop-cap-article > p:first-of-type::first-letter {
    font-size: 2.5rem;
  }
}

.description-toggle-btn {
    display: none;
}

@media (max-width: 768px) {
    .description-collapse-section {
        display: flex;
        flex-direction: column;
    }

    .description-collapse-section .description-text-wrap {
        position: relative;
        overflow: hidden;
        transition: max-height 0.35s ease;
        width: 100%;
    }

    .description-collapse-section .description-text-wrap.is-collapsed {
        max-height: 180px;
    }

    .description-collapse-section .description-text-wrap.is-expanded {
        max-height: 5000px;
    }

    .description-collapse-section .description-text-wrap.is-collapsed::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 48px;
        pointer-events: none;
        background: linear-gradient(to bottom, transparent, var(--bg-color, #0a0a0f));
    }

    .description-collapse-section .description-text-wrap.is-expanded::after {
        display: none;
    }

    .description-collapse-section .description-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin-top: 0.5rem;
        padding: 10px 14px;
        border: 1px solid rgba(245, 158, 11, 0.35);
        border-radius: 0.75rem;
        background: rgba(245, 158, 11, 0.08);
        color: var(--accent-color, #f59e0b);
        font-family: inherit;
        font-size: 0.8125rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        cursor: pointer;
        transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .description-collapse-section .description-toggle-btn::after {
        content: '';
        flex-shrink: 0;
        width: 7px;
        height: 7px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-1px);
        transition: transform 0.3s ease;
        opacity: 0.85;
    }

    .description-collapse-section .description-toggle-btn[aria-expanded='true']::after {
        transform: rotate(-135deg) translateY(1px);
    }

    .description-collapse-section .description-toggle-btn:hover,
    .description-collapse-section .description-toggle-btn:focus-visible {
        background: rgba(245, 158, 11, 0.16);
        border-color: var(--accent-color, #f59e0b);
        color: var(--accent-hover, #d97706);
        outline: none;
    }

    .description-collapse-section .description-toggle-btn[hidden] {
        display: none !important;
    }
}