/*
 * Home page only (loaded by index.php through $homeStylesheet).
 * Navy + gold: a centred full-width navy hero, then an introduction,
 * how it works, the two ways to get a link, and the marketplace itself.
 */
@import url("https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap");

.market-home {
    --hero: #12284a;
    --hero-deep: #0d1f3b;
    --hero-text: #f3f5f8;
    --hero-muted: #b9c4d6;
    --hero-line: rgba(255, 255, 255, .14);
    --hero-gold: #c9a66b;
    --hero-gold-hover: #d8ba86;
    --serif: "Newsreader", Georgia, "Times New Roman", serif;
}
:root[data-theme="dark"] .market-home {
    --hero: #0c1b33;
    --hero-deep: #08142a;
}

/* The hero is wider than the page, so stop the 100vw band from adding a sideways scrollbar */
html { overflow-x: clip; }

/* =========================================================
   Hero (full width, centred)
   ========================================================= */
.market-hero {
    margin: -28px calc(50% - 50vw) 0;   /* break out of the page width; cancel main's top padding */
    background: var(--hero);
    color: var(--hero-text);
    text-align: center;
}
:root[data-theme="dark"] .market-hero { border-bottom: 1px solid var(--line); }

.market-hero-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(64px, 10vw, 128px) 16px clamp(56px, 8vw, 96px);
}

.market-hero h1 {
    max-width: 16ch;
    margin: 0 auto 24px;
    font-family: var(--serif);
    font-size: clamp(2.6rem, 6.2vw, 4.8rem);
    font-weight: 500;
    line-height: 1.03;
    letter-spacing: -0.025em;
    color: var(--hero-text);
}

.market-hero-lead {
    max-width: 52ch;
    margin: 0 auto;
    color: var(--hero-muted);
    font-size: 1.15rem;
    line-height: 1.6;
}

.market-hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.market-hero .btn { padding: 13px 26px; font-size: 1rem; border-radius: 4px; }
.market-hero .market-primary { background: var(--hero-gold); border-color: var(--hero-gold); color: #1a1406; }
.market-hero .market-primary:hover { background: var(--hero-gold-hover); border-color: var(--hero-gold-hover); color: #1a1406; }
.market-hero .market-secondary { background: transparent; border-color: rgba(255, 255, 255, .35); color: var(--hero-text); }
.market-hero .market-secondary:hover { border-color: var(--hero-text); color: var(--hero-text); }
.market-hero a:focus-visible { outline-color: var(--hero-gold); }

/* Popular topics: a quiet row of links under the buttons */
.market-topics {
    display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-top: 40px;
}
.market-topics-label { color: var(--hero-muted); font-size: .9rem; margin-right: 4px; }
.market-topics a {
    color: var(--hero-text); text-decoration: none; font-size: .9rem;
    padding: 5px 13px; border: 1px solid var(--hero-line); border-radius: 999px;
}
.market-topics a:hover { border-color: var(--hero-gold); color: var(--hero-gold-hover); }

/* Trust strip: real totals from the database */
.market-trust {
    margin: 0;
    background: var(--hero-deep);
    border-top: 1px solid rgba(201, 166, 107, .45);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0 max(16px, calc(50% - 554px));   /* line up with the page width */
}
.market-trust > div { padding: 22px 12px 24px; }
.market-trust > div + div { border-left: 1px solid var(--hero-line); }
.market-trust dt { color: var(--hero-muted); font-size: .88rem; }
.market-trust dd {
    margin: 2px 0 0;
    font-family: var(--serif);
    font-size: clamp(1.8rem, 3vw, 2.3rem);
    font-weight: 500;
    line-height: 1.1;
    color: var(--hero-text);
    font-variant-numeric: lining-nums tabular-nums;
}

/* Small chevron drawn in CSS */
.chev { flex: 0 0 auto; width: 7px; height: 7px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }

/* =========================================================
   Sections below the hero
   ========================================================= */
.market-section { margin-top: clamp(64px, 9vw, 112px); scroll-margin-top: 90px; }
.market-section-head { margin-bottom: 28px; text-align: center; }
.market-section-head h2, .market-owner h2, .market-intro h2 {
    font-family: var(--serif);
    font-size: clamp(1.7rem, 3.2vw, 2.3rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-bottom: 8px;
}
.market-section-head p { color: var(--muted); margin: 0 auto; max-width: 52ch; }
.market-section > .muted,
.market-section > .empty { text-align: center; }
.market-section h3 { font-size: 1.1rem; margin-bottom: 6px; }

/* ----- Introduction: text + link illustration ----- */
.market-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(32px, 6vw, 80px);
    align-items: center;
}
.market-intro h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.12; margin-bottom: 18px; max-width: 22ch; }
.market-intro-text p { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.market-intro-text strong { color: var(--text); }

.link-demo { margin: 0; display: grid; gap: 14px; }
.demo-page { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.demo-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.demo-bar::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); box-shadow: 12px 0 0 var(--line-strong), 24px 0 0 var(--line-strong); margin-right: 26px; flex-shrink: 0; }
.demo-body { padding: 14px 16px 16px; font-size: .95rem; }
.demo-body .line { height: 8px; border-radius: 4px; background: var(--line); margin: 7px 0; }
.demo-body p { margin: 10px 0; line-height: 1.6; }
.demo-body a { font-weight: 600; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.demo-caption { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; padding-left: 24px; }
.demo-caption svg { flex-shrink: 0; color: var(--gold); }
.demo-target { margin-left: 52px; }
.demo-target .demo-body { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-target strong { font-size: 1.05rem; }
.demo-gain { color: var(--ok); font-weight: 600; font-size: .9rem; }

/* ----- How it works: three numbered steps ----- */
.market-steps {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
    counter-reset: step;
    border-top: 1px solid var(--line);
}
.market-steps li { counter-increment: step; padding: 28px 28px 8px 0; }
.market-steps li + li { padding-left: 28px; border-left: 1px solid var(--line); }
.market-steps li::before {
    content: counter(step);
    display: block;
    font-family: var(--serif);
    font-size: 2.4rem;
    line-height: 1;
    color: var(--gold);
    margin-bottom: 14px;
}
.market-steps p { color: var(--muted); margin: 0; }

/* ----- Two ways ----- */
.market-ways {
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.market-ways > div { padding: clamp(22px, 3vw, 34px); }
.market-ways > div + div { border-left: 1px solid var(--line); }
.market-ways p { color: var(--muted); }
.market-ways .market-fit { margin: 0; font-size: .95rem; padding-top: 14px; border-top: 1px solid var(--line); }
.market-ways .market-fit strong { color: var(--text); }

/* ----- Categories ----- */
.market-category-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 12px;
}
.market-category-list a {
    display: flex; height: 100%; align-items: center; justify-content: space-between; gap: 12px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: border-color .15s, box-shadow .15s;
}
.market-category-list a:hover { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); color: var(--text); }
.market-category-list strong { font-size: 1.05rem; }
.market-category-list small { display: block; color: var(--muted); margin-top: 2px; }
.market-category-list .chev { color: var(--gold); }

/* ----- FAQ: heading on top, questions in a centred column ----- */
.market-questions { max-width: 760px; margin: 0 auto; }
.market-questions details { border-bottom: 1px solid var(--line); }
.market-questions details:first-child { border-top: 1px solid var(--line); }
.market-questions summary {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 18px 4px; cursor: pointer; font-weight: 600; font-size: 1.04rem; list-style: none;
}
.market-questions summary::-webkit-details-marker { display: none; }
.market-questions summary::after {
    content: ""; flex: 0 0 7px; height: 7px; margin-right: 5px;
    border: solid var(--gold); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.market-questions details[open] summary::after { transform: rotate(225deg); }
.market-questions summary:hover { color: var(--accent); }
.market-questions p { padding: 0 28px 18px 4px; margin: 0; color: var(--muted); max-width: 64ch; }

/* ----- Closing band for site owners: echoes the hero ----- */
.market-owner {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;
    margin-top: clamp(64px, 9vw, 112px);
    padding: clamp(28px, 5vw, 52px);
    background: var(--hero);
    color: var(--hero-text);
    border-radius: 6px;
    border-top: 2px solid var(--hero-gold);
}
.market-owner h2 { color: var(--hero-text); margin-bottom: 6px; }
.market-owner p { color: var(--hero-muted); margin: 0; }
.market-owner .btn-primary { background: var(--hero-gold); border-color: var(--hero-gold); color: #1a1406; padding: 12px 24px; border-radius: 4px; }
.market-owner .btn-primary:hover { background: var(--hero-gold-hover); border-color: var(--hero-gold-hover); color: #1a1406; }

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 860px) {
    .market-intro { grid-template-columns: 1fr; }
    .market-steps { grid-template-columns: 1fr; }
    .market-steps li, .market-steps li + li { padding: 22px 0 8px; border-left: 0; }
    .market-steps li + li { border-top: 1px solid var(--line); }
    .market-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .market-trust > div:nth-child(3) { border-left: 0; }
    .market-trust > div:nth-child(n+3) { border-top: 1px solid var(--hero-line); }
    .market-category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .market-ways { grid-template-columns: 1fr; }
    .market-ways > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 460px) {
    .market-category-list { grid-template-columns: 1fr; }
    .demo-target { margin-left: 20px; }
    .demo-caption { padding-left: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .market-category-list a { transition: none; }
}
