/* ══════════════════════════════════════════════════════════════
   BENCHMARK SITE — GOLDEN RATIO DESIGN SYSTEM
   Base: Swiss Typography + phi (1.618033988749895)
   Source: report template + dashboard extensions
   ══════════════════════════════════════════════════════════════ */

:root {
    --phi: 1.618033988749895;
    --phi-inv: 0.618033988749895;

    /* Spacing (base 10px, Fibonacci-phi sequence) */
    --s-0: 6.18px;
    --s-1: 10px;
    --s-2: 16.18px;
    --s-3: 26.18px;
    --s-4: 42.36px;
    --s-5: 68.54px;

    /* Typography */
    --t-xs: 11px;
    --t-sm: 13px;
    --t-base: 15px;
    --t-md: 18px;
    --t-lg: 24px;
    --t-xl: 32px;
    --t-2xl: 46.6px;

    /* Ink palette — strictly monochrome */
    --ink: #0a0a0a;
    --ink-80: #333333;
    --ink-60: #5c5c5c;
    --ink-40: #666666;  /* was #8c8c8c — raised for WCAG AA (5.74:1) */
    --ink-20: #c4c4c4;
    --ink-10: #e8e8e8;
    --ink-05: #f4f4f4;
    --paper: #ffffff;

    /* Functional colors (dashboard) */
    --green: #2a7b3d;
    --green-bg: #f0faf2;
    --yellow: #a07a10;
    --yellow-bg: #fefcf3;
    --red: #b44c2a;
    --red-bg: #fef8f5;

    /* Accent */
    --accent: #0a0a0a;
    --accent-low: #c4c4c4;

    /* Line heights */
    --lh-tight: 1.236;
    --lh-base: 1.414;
    --lh-loose: 1.618;

    /* Layout */
    --max-w: 1100px;
    --radius: 3px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: var(--t-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial Nova', 'Arial', system-ui, sans-serif;
    font-weight: 400;
    line-height: var(--lh-base);
    color: var(--ink-80);
    background: var(--paper);
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--s-4) var(--s-3);
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
    margin-bottom: var(--s-5);
    padding-bottom: var(--s-3);
    border-bottom: 2px solid var(--ink);
}

.site-title {
    font-size: var(--t-2xl);
    font-weight: 700;
    color: var(--ink);
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    margin-bottom: var(--s-0);
}

.site-subtitle {
    font-size: var(--t-md);
    color: var(--ink-40);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.site-meta {
    display: flex;
    gap: var(--s-3);
    margin-top: var(--s-2);
    font-size: var(--t-xs);
    color: var(--ink-40);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Navigation ── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--paper);
    border-bottom: 1px solid var(--ink-10);
    margin-bottom: var(--s-4);
    padding: var(--s-1) 0;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    list-style: none;
}

.nav-link {
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-40);
    padding: var(--s-0) var(--s-1);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.nav-link:hover { color: var(--ink); text-decoration: none; background: var(--ink-05); }
.nav-link.active { color: var(--ink); font-weight: 600; }

/* ── Sections ── */
.section {
    margin-bottom: var(--s-5);
}

.section h2 {
    font-size: var(--t-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-60);
    border-bottom: 1px solid var(--ink-10);
    padding-bottom: var(--s-0);
    margin-bottom: var(--s-3);
}

.section h3 {
    font-size: var(--t-md);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--s-2);
}

/* ── KPI Cards ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-2);
    margin-bottom: var(--s-4);
}

.kpi-card {
    background: var(--ink-05);
    border-radius: var(--radius);
    padding: var(--s-3);
}

.kpi-value {
    font-size: var(--t-xl);
    font-weight: 700;
    color: var(--ink);
    line-height: var(--lh-tight);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.kpi-label {
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-40);
    margin-top: var(--s-0);
}

/* ── Data Tables ── */
.table-scroll { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--t-sm);
}

.data-table th {
    text-align: left;
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-40);
    padding: var(--s-1) var(--s-1);
    border-bottom: 2px solid var(--ink-10);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover { color: var(--ink); }
.data-table th.num { text-align: right; }
.data-table th.sorted-asc::after { content: ' \u25B2'; font-size: 8px; }
.data-table th.sorted-desc::after { content: ' \u25BC'; font-size: 8px; }

.data-table td {
    padding: var(--s-1) var(--s-1);
    border-bottom: 1px solid var(--ink-05);
    vertical-align: middle;
}

.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table tbody tr:hover { background: var(--ink-05); }

/* ── Profile Cards ── */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}

.profile-card {
    border: 1px solid var(--ink-10);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.profile-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profile-card-img {
    width: 100%;
    height: 340px;
    object-fit: cover;
    object-position: top;
    display: block;
}

.profile-card-body {
    padding: var(--s-2);
}

.profile-card-handle {
    font-size: var(--t-md);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--s-0);
}

.profile-card-meta {
    font-size: var(--t-xs);
    color: var(--ink-40);
    display: flex;
    gap: var(--s-2);
    margin-bottom: var(--s-1);
}

.profile-card-assessment {
    font-size: var(--t-sm);
    color: var(--ink-60);
    line-height: var(--lh-loose);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Rating Pills ── */
.rating {
    display: inline-block;
    font-size: var(--t-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 2px 8px;
    border-radius: 2px;
}

.rating-green { color: var(--green); background: var(--green-bg); }
.rating-yellow { color: var(--yellow); background: var(--yellow-bg); }
.rating-red { color: var(--red); background: var(--red-bg); }

/* ── Archetype Badges ── */
.archetype-badge {
    display: inline-block;
    font-size: var(--t-xs);
    letter-spacing: 0.05em;
    color: var(--ink-60);
    border: 1px solid var(--ink-20);
    border-radius: 2px;
    padding: 1px 6px;
}

/* ── Pattern Cards (reuse technique-card style) ── */
.pattern-card {
    border-left: 3px solid var(--ink);
    background: var(--ink-05);
    padding: var(--s-2) var(--s-3);
    margin-bottom: var(--s-3);
}

.pattern-card h4 {
    font-size: var(--t-md);
    font-weight: 600;
    margin-bottom: var(--s-0);
}

.pattern-card p {
    font-size: var(--t-sm);
    color: var(--ink-60);
    line-height: var(--lh-loose);
}

.pattern-profiles {
    margin-top: var(--s-1);
    font-size: var(--t-xs);
    color: var(--ink-40);
}

/* ── Format Template Cards ── */
.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-2);
}

.format-card {
    border: 1px solid var(--ink-10);
    border-radius: var(--radius);
    padding: var(--s-2);
}

.format-name {
    font-size: var(--t-sm);
    font-weight: 600;
    margin-bottom: var(--s-0);
}

.format-meta {
    font-size: var(--t-xs);
    color: var(--ink-40);
    display: flex;
    gap: var(--s-2);
}

.format-requires {
    font-size: var(--t-xs);
    color: var(--ink-60);
    margin-top: var(--s-0);
}

/* ── Quadrant Map (CSS grid-based) ── */
.quadrant-container {
    max-width: 680px;
    margin: var(--s-3) auto;
}

.quadrant-x-axis {
    display: flex;
    justify-content: space-between;
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-40);
    margin-bottom: var(--s-0);
    padding-left: var(--s-4);
}

.quadrant-wrapper {
    display: flex;
    gap: var(--s-1);
}

.quadrant-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-40);
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    min-width: var(--s-3);
    padding: var(--s-1) 0;
}

.quadrant-map {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    background: var(--ink-20);
    aspect-ratio: 1.618;
    flex: 1;
}

.quadrant-cell {
    background: var(--paper);
    padding: var(--s-2);
    position: relative;
}

.quadrant-cell.empty {
    background: var(--green-bg);
    border: 2px dashed var(--green);
}

.quadrant-label {
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-40);
    margin-bottom: var(--s-1);
}

.quadrant-profiles {
    font-size: var(--t-xs);
    color: var(--ink-60);
    line-height: 1.8;
}

/* ── Recommendation Cards ── */
.rec-card {
    display: flex;
    gap: var(--s-2);
    margin-bottom: var(--s-3);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--ink-10);
}

.rec-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--t-sm);
    font-weight: 700;
}

.rec-body h4 {
    font-size: var(--t-md);
    font-weight: 600;
    margin-bottom: var(--s-0);
}

.rec-body p {
    font-size: var(--t-sm);
    color: var(--ink-60);
    line-height: var(--lh-loose);
}

/* ── Profile Detail Page ── */
.profile-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-4);
    margin-bottom: var(--s-4);
}
/* Collapse to single column when screenshot cell is empty */
.profile-header > div:first-child:empty {
    display: none;
}
.profile-header > div:first-child:empty + div {
    grid-column: 1 / -1;
}

.profile-screenshot {
    width: 100%;
    border: 1px solid var(--ink-10);
    border-radius: var(--radius);
}

.profile-metrics dt {
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-40);
    margin-top: var(--s-2);
}

.profile-metrics dd {
    font-size: var(--t-lg);
    font-weight: 600;
    color: var(--ink);
}

.mechanics-list {
    list-style: none;
}

.mechanics-list li {
    border-left: 3px solid var(--ink-20);
    padding: var(--s-1) var(--s-2);
    margin-bottom: var(--s-1);
    font-size: var(--t-sm);
}

.mechanics-list li strong {
    color: var(--ink);
}

/* ── External Links ── */
.external-link {
    font-size: var(--t-xs);
    color: var(--ink-40);
    margin-left: var(--s-0);
    text-decoration: none;
}
.external-link:hover { color: var(--ink); }

/* ── Report Links ── */
.report-link {
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--green);
    text-decoration: none;
}
.report-link:hover { text-decoration: underline; }

/* ── Footer ── */
.site-footer {
    margin-top: var(--s-5);
    padding-top: var(--s-3);
    border-top: 1px solid var(--ink-10);
    display: flex;
    justify-content: space-between;
    font-size: var(--t-xs);
    color: var(--ink-40);
}

/* ── Print ── */
@media print {
    @page { size: A4; margin: 20mm 15mm; }

    .nav, .settings-toggle, .settings-panel, .breadcrumb { display: none !important; }
    body { max-width: none; padding: 0; color: #000; font-size: 11pt; }

    /* Prevent page breaks inside components */
    .profile-card, .pattern-card, .kpi-card, .format-card, .chord-card,
    .rec-card, .profile-header, .glyph-profile-grid, .data-table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Force page break before major sections */
    .section { page-break-before: auto; }

    /* Remove hover effects */
    .profile-card:hover { box-shadow: none; }

    /* Images */
    img { max-width: 100% !important; }
    .profile-card-img { height: 200px; }

    /* Links: show URL */
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #666;
        word-break: break-all;
    }
    /* But not for internal links */
    a[href^="profiles/"]::after,
    a[href^="../"]::after,
    a[href$=".html"]::after { content: none; }

    /* B/W fallback for rating colors */
    .rating-green { border: 2px solid #000; background: #fff !important; }
    .rating-yellow { border: 2px dashed #666; background: #fff !important; }
    .rating-red { border: 2px solid #666; background: #eee !important; }

    /* Glyph bars print correctly (CSS backgrounds) */
    .glyph-bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Gap alert in B/W */
    .gap-alert { border-left-color: #666 !important; background: #f0f0f0 !important; }

    /* Footer as page marker */
    .site-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-top: 1px solid #ccc;
        font-size: 8pt;
        padding: 4px 15mm;
    }
}

/* ── Card Utilities (centralized) ── */
.card-detail {
    margin-top: var(--s-1);
    font-size: var(--t-sm);
    color: var(--ink-60);
}

.card-synthesis {
    margin-top: var(--s-1);
    font-size: var(--t-sm);
    color: var(--ink-60);
    font-style: italic;
    line-height: var(--lh-loose);
}

.card-footer {
    margin-top: var(--s-2);
}

.tag-badge {
    margin: 2px;
}

/* ── Strategy List ── */
.strategy-list {
    margin: var(--s-1) 0;
    padding-left: var(--s-3);
    font-size: var(--t-sm);
    color: var(--ink-60);
    line-height: var(--lh-loose);
}

.strategy-list li {
    margin-bottom: var(--s-0);
}

/* ── Format Card Variants ── */
.format-core {
    border-left: 3px solid var(--green);
}

.format-support {
    border-left: 3px solid var(--yellow);
}

/* ── Glyph Radar ── */
.glyph-radar {
    margin: var(--s-2) 0;
}

.glyph-bar {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    margin-bottom: 4px;
}

.glyph-bar-label {
    font-size: var(--t-xs);
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-40);
    width: 36px;
    flex-shrink: 0;
}

.glyph-bar-track {
    flex: 1;
    height: 8px;
    background: var(--ink-05);
    border-radius: 1px;
    overflow: hidden;
}

.glyph-bar-fill {
    height: 100%;
    background: var(--ink);
    border-radius: 1px;
    transition: width 0.3s;
}

.glyph-bar-val {
    font-size: var(--t-xs);
    font-family: 'Courier New', monospace;
    color: var(--ink-60);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.chord-card {
    background: var(--ink-05);
    border-left: 3px solid var(--ink);
    padding: var(--s-2) var(--s-3);
    margin-top: var(--s-2);
}

.chord-card h4 {
    font-size: var(--t-sm);
    font-weight: 600;
    margin-bottom: var(--s-1);
}

/* ── Brand Extract ── */
.brand-extract-list {
    list-style: none;
}

.brand-extract-list li {
    border-left: 3px solid var(--green);
    padding: var(--s-1) var(--s-2);
    margin-bottom: var(--s-1);
    font-size: var(--t-sm);
    line-height: var(--lh-loose);
    background: var(--green-bg);
}

.brand-extract-list li strong {
    color: var(--ink);
}

/* ── Breadcrumb ── */
.breadcrumb {
    font-size: var(--t-xs);
    color: var(--ink-40);
    margin-bottom: var(--s-3);
    letter-spacing: 0.05em;
}
.breadcrumb a { color: var(--ink-40); }
.breadcrumb a:hover { color: var(--ink); }

/* ── Analyst-only content (hidden by default, togglable) ── */
.analyst-only { display: none; }
body.show-analyst .analyst-only { display: initial; }
/* For block-level analyst content */
div.analyst-only, p.analyst-only, li.analyst-only { display: none; }
body.show-analyst div.analyst-only { display: block; }
body.show-analyst p.analyst-only { display: block; }
body.show-analyst li.analyst-only { display: list-item; }

/* ── Settings Toggle ── */
.settings-toggle {
    position: fixed;
    bottom: var(--s-2);
    right: var(--s-2);
    width: 32px;
    height: 32px;
    background: var(--ink-05);
    border: 1px solid var(--ink-10);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--t-sm);
    color: var(--ink-40);
    z-index: 200;
    transition: all 0.15s;
}
.settings-toggle:hover { background: var(--ink-10); color: var(--ink); }
body.show-analyst .settings-toggle { background: var(--ink); color: var(--paper); }

.settings-panel {
    position: fixed;
    bottom: 52px;
    right: var(--s-2);
    background: var(--paper);
    border: 1px solid var(--ink-10);
    border-radius: var(--radius);
    padding: var(--s-2);
    font-size: var(--t-xs);
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: none;
}
.settings-panel.open { display: block; }
.settings-panel label {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    cursor: pointer;
    color: var(--ink-60);
}

/* ── Glyph Profile Grid ── */
.glyph-profile-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--s-3);
    align-items: start;
}

.glyph-insights ul {
    margin-bottom: var(--s-2);
}

/* ── Gap Alert ── */
.gap-alert {
    border-left-color: var(--red) !important;
    background: var(--red-bg);
}

/* ── Sector Grid ── */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--s-2);
}

.sector-grid .pattern-card {
    margin-bottom: 0;
}

/* ── Hashtag Cloud ── */
.hashtag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    body { padding: var(--s-2) var(--s-1); }
    .profile-header { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-card-meta { flex-wrap: wrap; }
    .site-meta { flex-wrap: wrap; }
    .format-grid { grid-template-columns: 1fr; }
    .quadrant-map { aspect-ratio: auto; }
    .site-footer { flex-direction: column; gap: var(--s-1); }
    .glyph-profile-grid { grid-template-columns: 1fr; }
    .sector-grid { grid-template-columns: 1fr; }
}

/* (claim/sales CSS removed — report is pure data) */
