/* ============================================
   EmailClarity — Redesigned Stylesheet
   Fonts: Petrona (serif) · Work Sans (sans)
   Accent: #761028 · Text: black · BG: white
   ============================================ */

:root {
    --accent:       #761028;
    --accent-dark:  #5a0c1e;
    --black:        #0f0f0f;
    --text:         #1a1a1a;
    --muted:        #6b6b6b;
    --border:       #e2e2e2;
    --bg:           #ffffff;
    --bg-subtle:    #f6f6f6;
    --font-serif:   'Petrona', Georgia, serif;
    --font-sans:    'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ── */
header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--black);
    letter-spacing: -0.02em;
}

nav a {
    margin-left: 2rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.15s;
}

nav a:hover { color: var(--accent); }

/* ── Hero ── */
.hero {
    padding: 5.5rem 0 4rem;
    border-bottom: 3px solid var(--accent);
}

.hero-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 5.5vw, 4.75rem);
    font-weight: 800;
    color: var(--black);
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 480px;
    line-height: 1.65;
    font-weight: 400;
    margin-bottom: 2rem;
}

.trust-signals {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.signal {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.divider {
    color: var(--border);
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Tool Section ── */
.tool-section {
    padding: 4rem 0;
    background: var(--bg-subtle);
}

.tool-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
}

/* ── Mode Toggle ── */
.mode-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.toggle-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s, color 0.15s;
}

.toggle-btn:last-child { border-right: none; }

.toggle-btn:hover:not(.active) {
    background: var(--bg-subtle);
    color: var(--text);
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
}

.badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.22);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
}

.toggle-btn:not(.active) .badge {
    background: var(--bg-subtle);
    color: var(--muted);
}

.help-text {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* ── Textarea ── */
.input-area { margin-bottom: 1.25rem; }

#emailInput {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    line-height: 1.65;
    resize: vertical;
    min-height: 280px;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.15s;
}

#emailInput:focus {
    outline: none;
    border-color: var(--accent);
}

#emailInput::placeholder { color: #b8b8b8; }

/* ── Analyze Button ── */
.button-container { margin-bottom: 0; }

.analyze-btn {
    display: block;
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.analyze-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.analyze-btn:active { transform: translateY(0); }

.analyze-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.rate-limit-text {
    text-align: center;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

/* ── Loading ── */
.loading-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.spinner {
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Results ── */
.results-container {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}

.risk-level {
    display: inline-block;
    padding: 0.35rem 1.1rem;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 2px;
    margin-bottom: 1.5rem;
}

.risk-critical { background: #1a0005; color: white; }
.risk-high     { background: var(--accent); color: white; }
.risk-medium   { background: #d97706; color: white; }
.risk-low      { background: #059669; color: white; }
.risk-unknown  { background: var(--muted); color: white; }

.result-section { margin-bottom: 2rem; }

.result-section h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.red-flag-item {
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--accent);
    background: #fdf4f6;
    font-size: 0.92rem;
    line-height: 1.55;
    border-radius: 0 2px 2px 0;
}

.recommendation-box {
    background: var(--bg-subtle);
    padding: 1.25rem 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.92rem;
    line-height: 1.65;
}

.recommendation-box ul { margin-left: 1.2rem; margin-top: 0.4rem; }
.recommendation-box li { margin-bottom: 0.35rem; }

.educational-note {
    background: var(--bg-subtle);
    padding: 1.25rem 1.5rem;
    border-left: 3px solid var(--black);
    border-radius: 0 4px 4px 0;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--muted);
}

/* ── Error ── */
.error-message {
    background: #fff4f6;
    color: var(--accent);
    padding: 1rem 1.25rem;
    border-radius: 4px;
    border: 1px solid var(--accent);
    margin-top: 1rem;
    font-size: 0.92rem;
}

/* ── About ── */
.about-section {
    padding: 5.5rem 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.about-section h2,
.faq-section h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.9rem, 3.5vw, 3rem);
    font-weight: 800;
    color: var(--black);
    letter-spacing: -0.025em;
    line-height: 1.12;
    margin-bottom: 2.5rem;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    max-width: 900px;
}

.about-col p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text);
    margin-bottom: 1rem;
}

.about-col em {
    font-style: italic;
    color: var(--accent);
    font-family: var(--font-serif);
}

.mission-box {
    border: 2px solid var(--black);
    padding: 2rem 2.25rem;
    border-radius: 2px;
}

.mission-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.85rem;
    display: block;
}

.mission-text {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--black);
}

/* ── FAQ ── */
.faq-section {
    padding: 5.5rem 0;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem 4rem;
    max-width: 900px;
}

.faq-item h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.faq-item p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--muted);
}

/* ── Footer ── */
footer {
    background: var(--black);
    padding: 2rem 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.footer-inner > p {
    font-size: 0.82rem;
    color: #888;
}

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

.footer-links a {
    color: #888;
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.15s;
}

.footer-links a:hover { color: white; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero { padding: 3.5rem 0 2.75rem; }

    .hero h1 { font-size: 2.25rem; }

    .trust-signals { gap: 0.4rem; }

    .tool-container { padding: 1.5rem; }

    .about-grid,
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links { justify-content: center; }

    nav a { margin-left: 1rem; }

    .mode-toggle { width: 100%; }
    .toggle-btn { flex: 1; justify-content: center; }
}
