/* styling for td profile */

/* === TD Hero === */
.td-hero {
    background: var(--off-white);
    border-bottom: 3px solid lightgrey;
    padding: 32px 56px 30px;
    text-align: left;
}

.td-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--green-mid);
    margin-bottom: 8px;
}

.td-hero-row {
    display: flex;
    align-items: center;
    gap: 24px;
}

.td-hero-photo {
    width: 96px;
    height: 122px;
    object-fit: cover;
    border-radius: 6px;
    border: 3px solid var(--green-mid);
    flex-shrink: 0;
}

.td-hero-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.td-hero-info h1 {
    font-family: "Poppins", "Inter", Arial, sans-serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-dark);
    line-height: 1.3;
    margin: 0;
}

.td-hero-info .td-party {
    font-size: 13px;
    font-style: italic;
    font-weight: 400;
    color: var(--text-muted);
}

.td-hero-info .td-constituency {
    font-size: 13px;
    font-style: italic;
    color: var(--text-muted);
    font-weight: 400;
}

/* Hero stat strip */
.td-hero-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hero-stat-value {
    font-family: "Inter", sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: var(--green-deep);
    line-height: 1;
}

.hero-stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.hero-stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

/* Sentiment tooltip */
.hero-stat-tooltip {
    position: relative;
    cursor: default;
}

.sentiment-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.hero-stat-tooltip:hover .sentiment-popup {
    opacity: 1;
    transform: translateY(0);
}

.stance-negative {
    background: var(--red-light);
    color: var(--red);
}

.stance-neutral {
    background: var(--green-light);
    color: var(--text-muted);
}

.stance-positive {
    background: var(--green-light);
    color: var(--green-deep);
}

/* === Page Body === */
.td-profile-container {
    max-width: 1800px;
    margin: 24px auto 0;
    padding: 0 56px 48px;
}

/* === Two-column spread: charts left, contributions register right === */
.td-spread {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    align-items: stretch;
    gap: 24px;
}

@media (max-width: 900px) {
    .td-spread {
        grid-template-columns: 1fr;
    }
}

/* === Charts (word frequency + language share) === */
.insights-wrapper {
    margin: 0;
    padding: 0;
    min-width: 0;
}

.insights-card {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 22px 28px 28px;
    min-height: 460px;
    box-sizing: border-box;
}

.insights-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--green-deep);
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--green-light);
}

.insights-body {
    display: grid;
    grid-template-columns: 2fr 1px 1fr;
    gap: 28px;
    align-items: stretch;
}

.insights-panel {
    min-width: 0;
}

.insights-divider {
    background: var(--green-light);
}

@media (max-width: 900px) {
    .insights-body {
        grid-template-columns: 1fr;
    }

    .insights-divider {
        display: none;
    }
}

#overallprobdist,
#overallirishper {
    width: 100%;
    height: 340px;
}

/* === Contributions register — explicit height matched to the chart card === */
.contributions-section {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 22px 24px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 14px;
    height: 460px;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-width: 900px) {
    .contributions-section {
        height: 420px;
    }
}

.contributions-header {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.contributions-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--green-deep);
}

.contributions-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow-y: scroll;
    flex: 1;
    min-height: 0;
}

.contribution-link {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-dark);
    border-bottom: 1px solid var(--green-light);
    background: transparent;
    font-size: 14px;
    transition: padding-left 0.15s ease, color 0.15s ease;
}

.contribution-link:last-child {
    border-bottom: none;
}

.contribution-link:hover {
    padding-left: 20px;
    color: orange;
}

.contribution-title {
    font-weight: 600;
}

.contribution-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.contribution-category {
    color: var(--green-mid);
}

.contribution-category::after {
    content: '·';
    margin-left: 8px;
    color: var(--border);
}

.contribution-date {
    color: var(--text-muted);
}

/* === Word search (scoped to this TD) === */
.td-word-search {
    padding: 42px 0 46px;
    border-top: 3px solid lightgrey;
}

.td-word-search-title {
    font-family: "Poppins", "Inter", Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 20px;
}

.word-search-wrapper {
    position: relative;
    max-width: 420px;
}

.word-search-wrapper input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-dark);
    background: transparent;
}

.word-search-wrapper input:focus {
    outline: none;
    border-color: var(--green-mid);
}

.word-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.word-results-list {
    list-style: none;
    max-width: 420px;
    margin-top: 14px;
}

.word-results-list li {
    border-bottom: 1px solid var(--green-light);
}

.word-results-list li:last-child {
    border-bottom: none;
}

.word-results-list a {
    display: block;
    padding: 10px 4px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 600;
    transition: color 0.15s ease, padding-left 0.15s ease;
}

.word-results-list a:hover {
    color: orange;
    padding-left: 8px;
}

.td-word-chart-wrapper {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--green-light);
}

.td-word-chart-heading {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--heading);
    margin-bottom: 4px;
}

.td-word-chart-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 4px 0 14px;
}

.td-word-chart-total-value {
    font-family: "Inter", sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1;
}

.td-word-chart-total-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.chart-note {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin: 0 0 12px;
}

#td_word_chart {
    width: 100%;
    height: 320px;
}

/* === Responsive === */
@media (max-width: 800px) {
    .td-hero-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .td-hero-stats {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .hero-stat-divider {
        display: none;
    }

    .td-profile-container {
        padding: 0 20px 32px;
    }
}