/* Kemiworld Markets - Website Styles */

:root {
    --navy-dark:  #0a1628;
    --navy-mid:   #1e3a5f;
    --navy-light: #2d5282;
    --gold:       #c9a84c;
    --gold-light: #e6c76b;
    --white:      #ffffff;
    --off-white:  #f8f9fa;
    --text-dark:  #1a202c;
    --text-mid:   #4a5568;
    --text-light: #718096;
    --border:     #e2e8f0;
    --success:    #276749;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--text-dark);
    background: var(--white);
    line-height: 1.6;
}

/* --- Navigation --- */
.nav {
    background: var(--navy-dark);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
}

.nav-brand {
    color: var(--gold);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.nav-brand img {
    display: block;
    height: 60px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.nav-brand span {
    color: var(--white);
    font-weight: 400;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-links a {
    color: #cbd5e0;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    display: block;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--gold);
    background: rgba(201,168,76,0.08);
}

.nav-cta {
    background: var(--gold) !important;
    color: var(--navy-dark) !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    padding: 0.45rem 1.1rem !important;
}

.nav-cta:hover {
    background: var(--gold-light) !important;
    color: var(--navy-dark) !important;
}

/* --- Nav dropdown (CSS-only, hover for desktop, expand for mobile) --- */
.nav-dropdown { position: relative; }

.nav-dropdown-trigger { cursor: pointer; }
.nav-dropdown-caret {
    display: inline-block;
    font-size: 0.85em;
    margin-left: 0.35em;
    color: var(--gold);
    transition: transform 0.18s ease;
    line-height: 1;
}
.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown:focus-within .nav-dropdown-caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #1a202c;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    padding: 0.35rem 0;
    margin: 0.25rem 0 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 50;
}

.nav-dropdown:hover > .nav-dropdown-menu,
.nav-dropdown:focus-within > .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu li { width: 100%; }
.nav-dropdown-menu a {
    display: block;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    color: #cbd5e0;
    border-radius: 0;
    background: transparent;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
    color: var(--gold);
    background: rgba(201,168,76,0.08);
}

/* --- Mega menu (multi-column dropdown for Tools) --- */
.nav-mega-menu {
    position: absolute;
    top: 100%;
    /* Anchor to RIGHT edge of trigger so the menu grows leftward and
       never overflows the right edge of the viewport. */
    right: 0;
    left: auto;
    width: 680px;
    max-width: calc(100vw - 2rem);
    background: #1a202c;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    padding: 1.25rem 1.4rem;
    margin-top: 0.35rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 50;
}

.nav-dropdown-mega:hover > .nav-mega-menu,
.nav-dropdown-mega:focus-within > .nav-mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-section { display: flex; flex-direction: column; gap: 0.15rem; }

.mega-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.mega-item {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.mega-item:hover { background: rgba(201,168,76,0.08); }

.mega-item-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 0.18rem;
    width: 1.4rem;
    text-align: center;
}

.mega-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}
.mega-item:hover .mega-item-name { color: var(--gold); }

.mega-item-desc {
    font-size: 0.72rem;
    color: #718096;
    line-height: 1.45;
}

.mega-item-all {
    margin-top: 0.4rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.mega-item-all .mega-item-name { color: var(--gold); }

/* --- Page Wrapper --- */
main { min-height: calc(100vh - 64px - 260px); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-mid) 100%);
    color: var(--white);
    padding: 6rem 2rem;
    text-align: center;
}

.hero-inner {
    max-width: 760px;
    margin: 0 auto;
}

.hero-tag {
    display: inline-block;
    background: rgba(201,168,76,0.15);
    color: var(--gold);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 1rem;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    color: var(--white);
}

.hero h1 em {
    font-style: normal;
    color: var(--gold);
}

.hero p {
    font-size: 1.125rem;
    color: #a0aec0;
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

.btn {
    display: inline-block;
    padding: 0.85rem 2rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-gold {
    background: var(--gold);
    color: var(--navy-dark);
}

.btn-gold:hover {
    background: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201,168,76,0.35);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255,255,255,0.25);
    margin-left: 1rem;
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* --- Section --- */
.section {
    padding: 5rem 2rem;
}

.section-alt {
    background: var(--off-white);
}

.section-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--navy-dark);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--text-mid);
    font-size: 1.05rem;
    margin-bottom: 3rem;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

/* --- Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.75rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.card-icon {
    width: 44px;
    height: 44px;
    background: rgba(201,168,76,0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-mid);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- Placeholder pages --- */
.placeholder-hero {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-mid) 100%);
    padding: 5rem 2rem;
    text-align: center;
    color: var(--white);
}

.placeholder-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    margin-bottom: 1rem;
}

.placeholder-hero p {
    color: #a0aec0;
    font-size: 1.05rem;
    max-width: 520px;
    margin: 0 auto;
}

.coming-soon-badge {
    display: inline-block;
    background: rgba(201,168,76,0.15);
    color: var(--gold);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1.25rem;
}

.placeholder-body {
    padding: 4rem 2rem;
    max-width: 720px;
    margin: 0 auto;
}

.placeholder-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 1rem;
    margin-top: 2.5rem;
}

.placeholder-body p {
    color: var(--text-mid);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.placeholder-body ul {
    color: var(--text-mid);
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.placeholder-body ul li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

/* --- Blog --- */
.post-list { display: flex; flex-direction: column; gap: 1.25rem; }

.post-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.post-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }

.post-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 0.4rem;
}

.post-card p { color: var(--text-mid); font-size: 0.9rem; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state p { font-size: 1rem; }

/* --- CTA Section --- */
.cta-section {
    background: var(--navy-dark);
    color: var(--white);
    padding: 5rem 2rem;
    text-align: center;
}

.cta-section h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.cta-section p {
    color: #a0aec0;
    max-width: 480px;
    margin: 0 auto 2.5rem;
}

/* --- Footer --- */
.footer {
    background: #060e1a;
    color: #718096;
    padding: 3rem 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-brand {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 700;
}

.footer-brand img {
    display: block;
    height: 160px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
}

.footer-brand span { color: #a0aec0; font-weight: 400; }

.footer-tagline {
    font-size: 0.85rem;
    color: #4a5568;
    margin-top: 0.4rem;
}

.footer-links {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.footer-col h4 {
    color: #a0aec0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.footer-col ul { list-style: none; }

.footer-col ul li { margin-bottom: 0.4rem; }

.footer-col ul li a {
    color: #4a5568;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-col ul li a:hover { color: var(--gold); }

.footer-bottom {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid #1a202c;
    font-size: 0.8rem;
    color: #2d3748;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.disclaimer {
    font-size: 0.78rem;
    color: #2d3748;
    max-width: 680px;
    line-height: 1.5;
}

/* ── Mobile navigation (CSS-only hamburger) ──────────────────── */

/* Hidden checkbox drives the toggle — never visible */
.nav-toggle-cb { display: none; }

/* Hamburger label — hidden on desktop */
.nav-toggle-label {
    display: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    order: 2;
}

.nav-toggle-label span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gold);
    border-radius: 1px;
    transition: opacity 0.2s, transform 0.2s;
}

/* Animate top/bottom bars into an X when open */
.nav-toggle-cb:checked ~ .nav-toggle-label span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle-cb:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
}
.nav-toggle-cb:checked ~ .nav-toggle-label span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Tablet — shrink link padding before collapsing ─────────── */
@media (max-width: 900px) {
    .nav-links a { padding: 0.5rem 0.55rem; font-size: 0.82rem; }
}

/* ── Mobile — collapse to hamburger below 700px ─────────────── */
@media (max-width: 700px) {
    .nav { padding: 0 1rem; }

    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 0.6rem 0;
        align-items: center;
    }

    .nav-brand { flex: 1; order: 1; }

    .nav-toggle-label { display: flex; }

    /* Nav links hidden by default; revealed when checkbox checked */
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 3;
        padding: 0.5rem 0 1rem;
        border-top: 1px solid rgba(255,255,255,0.06);
    }

    .nav-toggle-cb:checked ~ .nav-links { display: flex; }

    .nav-links li { width: 100%; }

    .nav-links a {
        padding: 0.7rem 0.5rem;
        font-size: 0.9rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.04);
    }

    /* Dropdown becomes inline indented list on mobile, collapsed by default.
       A tap on the trigger toggles `.open` on the parent (handled in JS);
       a second tap on an already-open trigger follows the link. */
    .nav-dropdown-menu,
    .nav-mega-menu {
        position: static;
        right: auto;
        left: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        display: none;
    }
    .nav-dropdown.open > .nav-dropdown-menu {
        display: block;
        padding: 0.25rem 0 0.5rem;
    }
    .nav-dropdown-mega.open > .nav-mega-menu {
        display: grid;
        padding: 0.25rem 0 0.5rem;
    }
    .nav-dropdown.open > .nav-dropdown-trigger .nav-dropdown-caret {
        transform: rotate(180deg);
    }
    .nav-dropdown-menu a {
        padding-left: 1.5rem;
        font-size: 0.85rem;
        color: #a0aec0;
    }
    .nav-dropdown-caret {
        display: inline-block;
        margin-left: 0.4rem;
        font-size: 0.7rem;
        transition: transform 0.2s ease;
    }

    /* Mega menu: collapse 3-col grid into single column */
    .nav-mega-menu { grid-template-columns: 1fr; gap: 0.5rem; }
    .mega-section-title {
        font-size: 0.62rem;
        margin: 0.5rem 0 0.3rem;
        padding-bottom: 0.3rem;
    }
    .mega-item { padding: 0.5rem 1.5rem; gap: 0.55rem; }
    .mega-item-name { font-size: 0.85rem; }
    .mega-item-desc { display: none; }   /* save vertical space on mobile */
    .mega-item-all { margin-top: 0.2rem; padding-top: 0.4rem; }

    /* Content layout */
    .hero            { padding: 3.5rem 1.25rem; }
    .section         { padding: 3rem 1.25rem; }
    .container       { padding: 0 1.25rem; }
    .cta-section     { padding: 3rem 1.25rem; }
    .footer          { padding: 2rem 1.25rem; }
    .placeholder-hero { padding: 3.5rem 1.25rem; }

    .section-title   { font-size: 1.55rem; }
    .cta-section h2  { font-size: 1.65rem; }

    .btn             { padding: 0.75rem 1.5rem; }
    .btn-outline     { margin-left: 0.5rem; }

    .footer-inner    { flex-direction: column; gap: 1.5rem; }
    .footer-links    { gap: 1.5rem; }
    .footer-bottom   { flex-direction: column; gap: 0.4rem; }
}

/* ── Markdown rendered segments (blog posts / insights) ─────── */
.md-seg h1, .md-seg h2, .md-seg h3 {
    font-weight: 700;
    color: #1a202c;
    margin: 1.5rem 0 .6rem;
    line-height: 1.3;
}
.md-seg h2 { font-size: 1.15rem; }
.md-seg h3 { font-size: 1rem; }
.md-seg p  { margin: 0 0 1rem; }
.md-seg ul, .md-seg ol { padding-left: 1.5rem; margin: .6rem 0 1rem; }
.md-seg li { margin-bottom: .35rem; line-height: 1.7; }
.md-seg strong { color: #2d3748; }
.md-seg em     { color: #4a5568; }
.md-seg hr     { border: none; border-top: 1px solid #e2e8f0; margin: 1.5rem 0; }
.md-seg table  { width: 100%; border-collapse: collapse; font-size: .875rem; margin: 1rem 0; }
.md-seg th     { background: #1a202c; color: #fff; padding: .5rem .75rem; text-align: left; }
.md-seg td     { padding: .5rem .75rem; border-bottom: 1px solid #e2e8f0; }
.md-seg tr:nth-child(even) td { background: #f7fafc; }
.md-seg a      { color: #c9a84c; }
.md-seg blockquote { border-left: 3px solid #c9a84c; padding: .5rem 0 .5rem 1rem; color: #4a5568; font-style: italic; margin: 1rem 0; }

/* ── Small phones ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .nav-brand       { font-size: 1rem; }
    .hero h1         { font-size: 1.75rem; }
    .hero p          { font-size: 0.95rem; }
    .section-title   { font-size: 1.35rem; }
    .cta-section h2  { font-size: 1.4rem; }
    .btn             { padding: 0.7rem 1.2rem; font-size: 0.875rem; }
    /* Stack hero buttons vertically */
    .btn-outline     { margin-left: 0; margin-top: 0.6rem; display: inline-block; }
}
