/* Homepage (index.php). Flat, data-first layout built on the shared --ak-* theme tokens. */

.hp {
    --hp-surface: var(--ak-surface-solid);
    --hp-border: var(--ak-border);
    --hp-radius: 12px;
    --hp-gap: clamp(1rem, 2.4vw, 1.5rem);
    --hp-buy: var(--ak-positive);
    --hp-sell: var(--ak-negative);
    --hp-hold: var(--ak-warning);
    padding-top: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: 2rem;
    color: var(--ak-text);
}

:where(.hp) h1,
:where(.hp) h2,
:where(.hp) h3 {
    font-family: 'Sora', 'Manrope', system-ui, sans-serif;
    color: var(--ak-text);
    letter-spacing: -0.02em;
    margin: 0;
}

:where(.hp) p {
    margin: 0;
}

:where(.hp) a {
    text-decoration: none;
}

.hp-num,
.hp-chg,
.hp-rank,
.hp-breadth-legend dd {
    font-variant-numeric: tabular-nums;
}

.hp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hp-actions .btn-primary,
.hp-actions .btn-secondary {
    margin: 0;
    width: auto;
}

.hp-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ak-brand);
    white-space: nowrap;
}

.hp-more:hover {
    color: var(--ak-brand-strong);
}

.hp-card {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
}

/* Hero */

.hp-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
    padding-bottom: clamp(2rem, 5vw, 3.5rem);
    border-bottom: 1px solid var(--hp-border);
}

.hp-hero-copy {
    padding-top: 0.5rem;
}

.hp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ak-text-muted);
    margin-bottom: 1rem;
}

.hp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hp-buy);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hp-buy) 22%, transparent);
}

.hp-hero h1 {
    font-size: clamp(2.1rem, 4.6vw, 3.4rem);
    line-height: 1.06;
    font-weight: 700;
    max-width: 14ch;
}

.hp-lead {
    margin-top: 1rem;
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.6;
    color: var(--ak-text-soft);
    max-width: 52ch;
}

.hp .hp-search {
    margin: 1.75rem 0 1rem;
    max-width: 560px;
    padding: 0.35rem 0.35rem 0.35rem 0.9rem;
    gap: 0.6rem;
    background: var(--ak-control-bg);
    border: 1px solid var(--ak-border-strong);
    border-radius: 10px;
    box-shadow: none;
}

.hp .hp-search:focus-within {
    border-color: var(--ak-brand);
    box-shadow: 0 0 0 3px var(--ak-focus);
}

.hp-search-icon {
    flex: none;
    color: var(--ak-text-muted);
}

/* app.css styles .search-box input with !important; the field sits inside the bordered form here. */
.hp .hp-search input[type="search"] {
    flex: 1;
    min-width: 0;
    width: auto;
    margin: 0;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    background: transparent !important;
    color: var(--ak-text);
    font-size: 1rem;
    padding: 0.55rem 0;
}

.hp-search-submit {
    flex: none;
    border: 0;
    border-radius: 7px;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--ak-brand);
    color: #04121f;
}

:root[data-theme="light"] .hp-search-submit {
    color: #fff;
}

.hp-search-submit:hover {
    filter: brightness(1.08);
}

.hp .search-suggestions {
    left: 0;
    right: 0;
    top: calc(100% + 6px);
}

.hp-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    font-size: 0.85rem;
    color: var(--ak-text-muted);
}

.hp-trust li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.hp-trust li::before {
    content: '';
    width: 14px;
    height: 14px;
    flex: none;
    background: var(--hp-buy);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hp-trust a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--hp-border);
    text-underline-offset: 3px;
}

.hp-trust a:hover {
    color: var(--ak-text);
}

/* Market panel */

.hp-panel {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 1.25rem;
}

.hp-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hp-panel-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
}

.hp-panel-head time,
.hp-panel-head span {
    font-size: 0.8rem;
    color: var(--ak-text-muted);
}

.hp-breadth {
    padding-bottom: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--hp-border);
}

.hp-breadth-bar {
    display: flex;
    gap: 3px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.hp-breadth-bar .is-buy { background: var(--hp-buy); }
.hp-breadth-bar .is-hold { background: color-mix(in srgb, var(--hp-hold) 70%, var(--hp-surface)); }
.hp-breadth-bar .is-sell { background: var(--hp-sell); }

.hp-breadth-legend {
    display: flex;
    gap: 1.25rem;
    margin: 0.65rem 0 0;
    font-size: 0.8rem;
}

.hp-breadth-legend div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hp-breadth-legend div::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.hp-breadth-legend .is-buy::before { background: var(--hp-buy); }
.hp-breadth-legend .is-hold::before { background: var(--hp-hold); }
.hp-breadth-legend .is-sell::before { background: var(--hp-sell); }

.hp-breadth-legend dt {
    color: var(--ak-text-muted);
    font-weight: 600;
}

.hp-breadth-legend dd {
    margin: 0;
    font-weight: 700;
    color: var(--ak-text);
}

.hp-panel-sub {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ak-text-muted);
    margin: 0.25rem 0;
}

.hp-panel-link {
    display: block;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--hp-border);
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ak-brand);
}

.hp-panel-link:hover {
    color: var(--ak-brand-strong);
}

.hp-empty {
    color: var(--ak-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    padding: 0.5rem 0;
}

/* Stock rows (panel + market cards) */

.hp-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hp-list li + li {
    border-top: 1px solid var(--hp-border);
}

.hp-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.4rem;
    margin: 0 -0.4rem;
    border-radius: 6px;
    color: var(--ak-text);
}

.hp-row:hover {
    background: var(--ak-surface-soft);
}

.hp-row .hp-row-logo {
    width: 28px;
    height: 28px;
    margin: 0;
}

.hp-row-id {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.hp-row-id strong {
    color: var(--ak-text);
    font-size: 0.92rem;
    font-weight: 700;
}

.hp-row-id span {
    font-size: 0.78rem;
    color: var(--ak-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-row-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hp-row-meta .signal-badge {
    margin: 0;
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
}

.hp-rank {
    font-size: 0.78rem;
    color: var(--ak-text-muted);
}

.hp-row-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
    min-width: 4.5rem;
}

.hp-row-value .hp-num {
    font-weight: 700;
    font-size: 0.92rem;
}

.hp-chg {
    font-size: 0.78rem;
    font-weight: 700;
}

.hp-chg.is-up { color: var(--hp-buy); }
.hp-chg.is-down { color: var(--hp-sell); }
.hp-chg.is-flat { color: var(--ak-text-muted); }

/* Sections */

.hp-section {
    padding: clamp(2rem, 5vw, 3.25rem) 0 0;
}

.hp-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem 2rem;
    margin-bottom: 1.25rem;
}

.hp-section-head h2 {
    font-size: clamp(1.4rem, 2.4vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
}

.hp-section-head p {
    margin-top: 0.4rem;
    color: var(--ak-text-soft);
    line-height: 1.55;
    max-width: 62ch;
}

.hp-market-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--hp-gap);
}

.hp-market-card {
    padding: 1rem 1.15rem 0.6rem;
}

.hp-market-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--hp-border);
}

.hp-market-card h3 {
    font-size: 1rem;
    font-weight: 700;
}

.hp-market-head span {
    font-size: 0.75rem;
    color: var(--ak-text-muted);
    white-space: nowrap;
}

.hp-market-card .hp-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
}

/* Tools */

.hp-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--hp-gap);
}

.hp-tool {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.25rem;
    color: var(--ak-text);
    transition: border-color 0.15s ease;
}

.hp-tool:hover {
    border-color: var(--ak-border-strong);
}

.hp-tool h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.hp-tool p {
    color: var(--ak-text-soft);
    font-size: 0.92rem;
    line-height: 1.55;
    flex: 1;
}

.hp-tool .hp-more {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

/* Member resume */

.hp-resume-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem 2rem;
    flex-wrap: wrap;
    padding: 1.25rem;
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-left: 3px solid var(--ak-brand);
    border-radius: var(--hp-radius);
}

.hp-resume-card.is-due { border-left-color: var(--hp-sell); }
.hp-resume-card.is-missing { border-left-color: var(--hp-hold); }
.hp-resume-card.is-fresh { border-left-color: var(--hp-buy); }

.hp-resume-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.hp-resume-card p {
    color: var(--ak-text-soft);
    font-size: 0.9rem;
    line-height: 1.55;
}

.hp-resume-state {
    font-weight: 700;
    color: var(--ak-text);
}

/* Articles */

.hp-articles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--hp-gap);
}

.hp-article {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hp-article-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 40 / 21;
    object-fit: cover;
    border-bottom: 1px solid var(--hp-border);
}

.hp-article-body {
    padding: 1.15rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hp-article-meta {
    font-size: 0.78rem;
    color: var(--ak-text-muted);
}

.hp-article h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.hp-article h3 a {
    color: var(--ak-text);
}

.hp-article h3 a:hover {
    color: var(--ak-brand);
}

.hp-article p:last-child {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ak-text-soft);
}

/* FAQ */

.hp-faq-list {
    border-top: 1px solid var(--hp-border);
    max-width: 860px;
}

.hp-faq details {
    border-bottom: 1px solid var(--hp-border);
}

.hp-faq summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem 0;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ak-text);
}

.hp-faq summary::-webkit-details-marker {
    display: none;
}

.hp-faq summary::after {
    content: '+';
    flex: none;
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1;
    color: var(--ak-text-muted);
}

.hp-faq details[open] summary::after {
    content: '\2212';
}

.hp-faq details p {
    padding: 0 0 1.15rem;
    color: var(--ak-text-soft);
    line-height: 1.65;
    max-width: 72ch;
}

/* Final CTA */

.hp-cta {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding: clamp(1.5rem, 4vw, 2.25rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem 2rem;
    flex-wrap: wrap;
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
}

.hp-cta h2 {
    font-size: clamp(1.3rem, 2.4vw, 1.6rem);
    font-weight: 700;
}

.hp-cta p {
    margin-top: 0.4rem;
    color: var(--ak-text-soft);
    line-height: 1.55;
    max-width: 56ch;
}

.hp-disclaimer {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: var(--ak-text-muted);
    line-height: 1.5;
}

/* Responsive */

@media (max-width: 1080px) {
    .hp-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-market-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-market-grid > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .hp-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-hero h1 {
        max-width: none;
    }

    .hp-articles {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .hp {
        padding-top: 1.25rem;
    }

    .hp-market-grid,
    .hp-tools {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .hp-actions > a {
        flex: 1 1 100%;
        text-align: center;
    }

    .hp-panel {
        padding: 1rem;
    }

    .hp-row-meta .hp-rank {
        display: none;
    }
}

/* The form shows focus (see .hp-search:focus-within); global input focus styles would draw a second box inside it. */
.hp .hp-search input[type="search"]:focus,
.hp .hp-search input[type="search"]:focus-visible {
    outline: none !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}
