/* ═══════════════════════════════════════════════════════════
   ASX Intel — Stylesheet
   Design language: Editorial financial intelligence
   Fonts: Syne (display) + DM Sans (body) + DM Mono (data)
═══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --bg:           #f4f3ef;
    --surface:      #ffffff;
    --ink:          #0d0d0b;
    --ink-muted:    #6b6b63;
    --ink-faint:    #b0afa8;
    --border:       #e4e3dc;
    --border-dark:  #c8c7bf;
    --accent:       #0d0d0b;

    --green-bg:     #eef7f0;
    --green-border: #aed9b8;
    --green-text:   #1a5c2a;

    --yellow-bg:    #fdf8e8;
    --yellow-border:#e8d87a;
    --yellow-text:  #6b5a00;

    --red-bg:       #fdf0ef;
    --red-border:   #f0b8b4;
    --red-text:     #7a1c18;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;

    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'DM Mono', monospace;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }

/* ── Page shell ─────────────────────────────────────────── */
.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--ink);
}
.logo span { color: var(--ink-muted); }

.header-tag {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.new-search-btn {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-muted);
    padding: 6px 14px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.new-search-btn:hover {
    background: var(--ink);
    color: #fff;
    opacity: 1;
    border-color: var(--ink);
}

/* ── Hero (landing page) ────────────────────────────────── */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 72px 0 48px;
    max-width: 640px;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-muted);
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: var(--ink);
    margin-bottom: 20px;
}
.hero-title-muted { color: var(--ink-muted); }

.hero-body {
    font-size: 1.0rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--ink-muted);
    margin-bottom: 36px;
    max-width: 520px;
}

/* ── Search form ────────────────────────────────────────── */
.search-form { width: 100%; }

.search-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s;
}
.search-input-wrap:focus-within {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(13,13,11,0.06);
}

.search-prefix {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-faint);
    padding: 0 12px 0 16px;
    letter-spacing: 1px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--ink);
    padding: 14px 16px;
    text-transform: uppercase;
}
.search-input-wrap input::placeholder {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-faint);
}

.analyse-btn {
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 28px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.analyse-btn:hover { background: #2a2a28; transform: translateY(-1px); }
.analyse-btn:active { transform: translateY(0); }

/* Dot pulse loader inside button */
.dot-pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: dotPulse 1.2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.form-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    color: var(--red-text);
}

/* ── Loading overlay ────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244,243,239,0.92);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2.5px solid var(--border);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-stage {
    font-family: var(--font-display);
    font-size: 1.0rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    min-height: 1.5em;
    transition: opacity 0.3s;
}

.loading-sub {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin-bottom: 20px;
}

.loading-progress {
    background: var(--border);
    border-radius: 999px;
    height: 3px;
    overflow: hidden;
}
.loading-bar {
    height: 100%;
    background: var(--ink);
    border-radius: 999px;
    width: 0%;
    transition: width 0.8s ease;
}

/* ── Feature pills ──────────────────────────────────────── */
.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
}
.pill {
    font-size: 0.76rem;
    font-weight: 400;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    padding: 20px 0 24px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--ink-faint);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
}
.footer-dot { color: var(--border-dark); }
.site-footer a:hover { color: var(--ink); opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   RESULTS PAGE
═══════════════════════════════════════════════════════════ */

.results-shell { max-width: 860px; }

.results-main {
    padding: 36px 0 48px;
}

/* ── Company header ─────────────────────────────────────── */
.company-header {
    margin-bottom: 24px;
}
.company-name {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--ink);
    margin-bottom: 4px;
}
.company-meta {
    font-size: 0.82rem;
    color: var(--ink-muted);
    font-weight: 300;
}

/* ── Metric strip ───────────────────────────────────────── */
.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.metric-label {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 6px;
}
.metric-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
}

/* ── 52-week bar ────────────────────────────────────────── */
.week-bar-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.week-bar-label {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 10px;
}
.week-bar-track {
    background: var(--border);
    border-radius: 999px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 6px;
}
.week-bar-fill {
    height: 100%;
    background: var(--ink);
    border-radius: 999px;
    min-width: 4px;
}
.week-bar-ends {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--ink-faint);
}
.week-bar-pct {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-muted);
}

/* ── Signal grid ────────────────────────────────────────── */
.signal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.signal-card {
    border-radius: var(--radius-md);
    padding: 18px 16px;
    text-align: center;
    border: 1px solid;
}
.signal-green { background: var(--green-bg); border-color: var(--green-border); }
.signal-yellow { background: var(--yellow-bg); border-color: var(--yellow-border); }
.signal-red { background: var(--red-bg); border-color: var(--red-border); }

.signal-title {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 10px;
}
.signal-icon { font-size: 1.5rem; margin-bottom: 6px; }
.signal-verdict {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
}
.signal-supporting {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-muted);
}

/* ── Verdict block ──────────────────────────────────────── */
.verdict-block {
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    margin-bottom: 28px;
}
.verdict-eyebrow {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
}
.verdict-text {
    font-size: 1.0rem;
    font-weight: 400;
    line-height: 1.65;
    color: rgba(255,255,255,0.92);
}

/* ── Section blocks ─────────────────────────────────────── */
.section-block {
    margin-bottom: 28px;
}
.section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.prose-text {
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.75;
    color: #333;
}

/* ── Analysis cards ─────────────────────────────────────── */
.card-stack { display: flex; flex-direction: column; gap: 8px; }

.analysis-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border: 1px solid;
}
.ac-green { background: var(--green-bg); border-color: var(--green-border); }
.ac-yellow { background: var(--yellow-bg); border-color: var(--yellow-border); }
.ac-red { background: var(--red-bg); border-color: var(--red-border); }

.ac-signal { font-size: 1.05rem; flex-shrink: 0; margin-top: 1px; }
.ac-body { flex: 1; }
.ac-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 4px;
}
.ac-text {
    font-size: 0.875rem;
    color: #333;
    line-height: 1.6;
}

/* ── Highlight cards (strength/concern) ─────────────────── */
.highlight-card {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.86rem;
    line-height: 1.55;
    margin-top: 4px;
}
.hc-strength {
    background: var(--green-bg);
    border-left: 3px solid #28a745;
    color: var(--green-text);
}
.hc-concern {
    background: var(--red-bg);
    border-left: 3px solid #dc3545;
    color: var(--red-text);
}
.hc-tag {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 4px;
}

/* ── Investor fit ───────────────────────────────────────── */
.fit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.fit-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.fit-panel-header {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.fit-suits .fit-panel-header { color: #28a745; }
.fit-not .fit-panel-header { color: #dc3545; }

.fit-item {
    font-size: 0.84rem;
    color: #444;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}
.fit-item:last-child { border-bottom: none; }

/* ── Risk list ──────────────────────────────────────────── */
.risk-list { display: flex; flex-direction: column; gap: 8px; }
.risk-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--ink);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.86rem;
    color: #333;
    line-height: 1.55;
}
.risk-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Disclaimer ─────────────────────────────────────────── */
.disclaimer-block {
    font-size: 0.74rem;
    color: var(--ink-faint);
    line-height: 1.65;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    margin-bottom: 28px;
}

/* ── Anomaly cards ──────────────────────────────────────── */
.anomaly-note {
    font-size: 0.8rem;
    color: var(--ink-muted);
    margin-bottom: 12px;
}
.anomaly-card {
    background: #fffbf0;
    border: 1px solid #ffe0a0;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}
.anomaly-summary {
    padding: 14px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #7a5c00;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.anomaly-summary::-webkit-details-marker { display: none; }
.anomaly-summary::before {
    content: '▶ ';
    font-size: 0.65rem;
    opacity: 0.6;
}
details[open] .anomaly-summary::before { content: '▼ '; }

.anomaly-body {
    padding: 0 16px 16px;
    font-size: 0.84rem;
    color: #555;
    line-height: 1.65;
    border-top: 1px solid #ffe0a0;
}
.anomaly-loading {
    padding: 12px 0;
    color: var(--ink-faint);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════════════════════ */

@media (max-width: 700px) {

    .page-shell { padding: 0 16px; }

    /* Header */
    .header-tag { display: none; }

    /* Hero */
    .hero { padding: 40px 0 32px; }
    .hero-title { font-size: 2.2rem; letter-spacing: -1px; }
    .hero-body { font-size: 0.9rem; }

    /* Search */
    .search-row { flex-direction: column; }
    .analyse-btn { width: 100%; justify-content: center; padding: 14px; }

    /* Pills */
    .feature-pills { gap: 6px; }
    .pill { font-size: 0.7rem; }

    /* Metric strip — 2 columns on mobile */
    .metric-strip { grid-template-columns: repeat(2, 1fr); }

    /* Signal grid — 2 columns on mobile */
    .signal-grid { grid-template-columns: repeat(2, 1fr); }

    /* Investor fit — stack on mobile */
    .fit-grid { grid-template-columns: 1fr; }

    /* Company name */
    .company-name { font-size: 1.4rem; }

}

@media (max-width: 400px) {
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .signal-grid { grid-template-columns: repeat(2, 1fr); }
}
