/* ===== LAYOUT ===== */

/* Body */
body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(56px + 2rem) 1.5rem 3rem;
}

/* Header */
#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    height: 56px;
    background: var(--color-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
}

.header-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.logo-mark {
    width: 24px;
    height: 24px;
}

#app-header nav {
    display: flex;
    gap: 1.5rem;
}

#app-header nav a {
    position: relative;
    padding-bottom: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

#app-header nav a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width var(--transition);
}

#app-header nav a:hover {
    color: var(--color-text);
}

#app-header nav a.active {
    color: var(--color-text);
}

#app-header nav a.active::after,
#app-header nav a:hover::after {
    width: 100%;
}

/* SPA Views */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: viewIn 180ms ease;
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Hero (Home) */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: calc(100vh - 180px);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-headline {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    font-family: var(--font-display);
}

.hero-headline mark {
    background: none;
    color: var(--color-accent);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-width: 440px;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero proof: live sample audit card + proof stats */
.hero-proof {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 440px;
}

.hero-proof-card {
    background: var(--color-bg-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.hero-proof-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.hero-proof-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
}

.hero-proof-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.hero-gauge {
    width: 84px;
    height: 84px;
    flex-shrink: 0;
}

.hero-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.hero-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--color-text-secondary);
}

.hero-bar-label {
    width: 96px;
    flex-shrink: 0;
}

.hero-bar-track {
    flex: 1;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.hero-bar-fill {
    height: 100%;
    border-radius: 2px;
}

.hero-bar-fill.score-excellent {
    background: var(--color-score-excellent);
}

.hero-bar-fill.score-good {
    background: var(--color-score-good);
}

.hero-bar-fill.score-average {
    background: var(--color-score-average);
}

.hero-bar-fill.score-poor {
    background: var(--color-score-poor);
}

.hero-bar-num {
    min-width: 1.6rem;
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-text);
}

.hero-proof-band {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.hero-proof-band.score-excellent {
    color: var(--color-score-excellent);
}

.hero-proof-band.score-good {
    color: var(--color-score-good);
}

.hero-proof-band.score-average {
    color: var(--color-score-average);
}

.hero-proof-band.score-poor {
    color: var(--color-score-poor);
}

.hero-proof-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.hero-proof-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hero-proof-stat strong {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.hero-proof-stat span {
    font-size: 0.68rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* How it works strip */
.how-it-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--color-border);
}

.how-step {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.how-num {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.how-step strong {
    display: block;
    margin-bottom: 0.2rem;
}

.how-step p {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Browse Layout */
.browse-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.browse-toolbar .search-input {
    flex: 1;
    min-width: 200px;
}

/* Supplier Grid */
#supplier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Compare Layout */
.compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.compare-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Horizontal scroll wrapper for the comparison table on narrow screens */
.compare-table-wrap {
    overflow-x: auto;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-bg-elevated);
    max-width: 640px;
    width: 100%;
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--color-border);
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Browse meta row actions (export + sort) */
.browse-meta-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Footer */
#app-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-brand {
    color: var(--color-text-tertiary);
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--color-accent);
}

/* Utility */
.hidden {
    display: none !important;
}