﻿
/* =========================================================
   THE HUMAN DILEMMA LAB
   PERSPECTIVES ROOM
   Editorial community feed • Refined • Responsive
   ========================================================= */

:root {
    --perspectives-bg: #f4f1e9;
    --perspectives-paper: #fbfaf6;
    --perspectives-paper-deep: #eeece3;
    --perspectives-ink: #292c25;
    --perspectives-muted: #77796e;
    --perspectives-olive: #626d4d;
    --perspectives-olive-dark: #465039;
    --perspectives-line: rgba(41, 44, 37, 0.12);
    --perspectives-accent: #a18b65;
    --perspectives-radius: 18px;
    --perspectives-shadow: 0 12px 35px rgba(37, 42, 32, 0.045);
}

/* =========================================================
   PAGE FOUNDATION
   ========================================================= */

.perspectives-page {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient( ellipse at 85% 5%, rgba(98, 109, 77, 0.065), transparent 32% ), var(--perspectives-bg);
    color: var(--perspectives-ink);
    font-family: "DM Sans", sans-serif;
}

    .perspectives-page *,
    .perspectives-page *::before,
    .perspectives-page *::after {
        box-sizing: border-box;
    }

    .perspectives-page button,
    .perspectives-page input,
    .perspectives-page select {
        font: inherit;
    }

    .perspectives-page a {
        color: inherit;
        text-decoration: none;
    }

/* =========================================================
   HEADER
   ========================================================= */

.perspectives-header {
    min-height: 76px;
    padding: 0 7%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--perspectives-line);
    background: rgba(244, 241, 233, 0.88);
    position: relative;
    z-index: 5;
}

    .perspectives-header .brand {
        font-family: "Playfair Display", serif;
        font-size: 21px;
        font-weight: 600;
        letter-spacing: -0.7px;
    }

        .perspectives-header .brand span {
            color: var(--perspectives-olive);
        }

    .perspectives-header .back-link {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--perspectives-muted);
        font-size: 12px;
        font-weight: 600;
        transition: color 0.25s ease, transform 0.25s ease;
    }

        .perspectives-header .back-link:hover {
            color: var(--perspectives-olive-dark);
            transform: translateX(-3px);
        }

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

.perspectives-container {
    width: min(100% - 48px, 1040px);
    margin: 0 auto;
    padding: 75px 0 110px;
}

/* =========================================================
   INTRODUCTION / HERO
   ========================================================= */

.perspectives-hero {
    max-width: 790px;
    margin: 0 auto 58px;
    text-align: center;
    animation: perspectiveFadeUp 0.8s ease both;
}

    .perspectives-hero .eyebrow {
        display: inline-flex;
        align-items: center;
        gap: 11px;
        margin-bottom: 22px;
        color: var(--perspectives-olive);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 3px;
    }

        .perspectives-hero .eyebrow::before,
        .perspectives-hero .eyebrow::after {
            content: "";
            width: 25px;
            height: 1px;
            background: var(--perspectives-accent);
        }

    .perspectives-hero h1 {
        max-width: 760px;
        margin: 0 auto;
        font-family: "Playfair Display", Georgia, serif;
        font-size: clamp(38px, 5.5vw, 64px);
        font-weight: 500;
        line-height: 1.13;
        letter-spacing: -1.8px;
    }

        .perspectives-hero h1 span {
            color: var(--perspectives-olive);
            font-style: italic;
        }

    .perspectives-hero > p {
        max-width: 610px;
        margin: 23px auto 0;
        color: var(--perspectives-muted);
        font-size: 14px;
        line-height: 1.9;
    }

.response-count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 27px;
    padding: 9px 15px;
    border: 1px solid var(--perspectives-line);
    border-radius: 30px;
    color: var(--perspectives-muted);
    background: rgba(251, 250, 246, 0.55);
    font-size: 11px;
    letter-spacing: 0.2px;
}

    .response-count strong {
        color: var(--perspectives-olive-dark);
        font-size: 14px;
        font-weight: 700;
    }

/* =========================================================
   DISCOVERY TOOLBAR
   ========================================================= */

.perspectives-toolbar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
    margin-top: 43px;
    padding: 15px;
    border: 1px solid var(--perspectives-line);
    border-radius: 17px;
    background: rgba(251, 250, 246, 0.78);
    box-shadow: var(--perspectives-shadow);
    text-align: left;
}

.perspectives-search {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 180px;
    gap: 12px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--perspectives-paper-deep);
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

    .perspectives-search:focus-within {
        border-color: rgba(98, 109, 77, 0.55);
        background: var(--perspectives-paper);
        box-shadow: 0 0 0 3px rgba(98, 109, 77, 0.08);
    }

    .perspectives-search > span {
        color: var(--perspectives-olive);
        font-size: 25px;
        line-height: 1;
    }

    .perspectives-search input {
        width: 100%;
        min-width: 0;
        padding: 16px 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--perspectives-ink);
        font-size: 12px;
    }

        .perspectives-search input::placeholder {
            color: #96968b;
        }

        .perspectives-search input::-webkit-search-cancel-button {
            cursor: pointer;
        }

.perspectives-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .perspectives-filters select {
        min-width: 145px;
        padding: 15px 34px 15px 13px;
        border: 1px solid var(--perspectives-line);
        border-radius: 10px;
        outline: none;
        background-color: var(--perspectives-paper);
        color: var(--perspectives-ink);
        font-size: 11px;
        cursor: pointer;
        transition: border-color 0.2s ease;
    }

        .perspectives-filters select:hover,
        .perspectives-filters select:focus {
            border-color: var(--perspectives-olive);
        }

/* =========================================================
   REFLECTION FEED
   ========================================================= */

.perspectives-list {
    display: flex;
    flex-direction: column;
    gap: 17px;
    max-width: 820px;
    margin: 0 auto;
}

.perspective-card {
    position: relative;
    padding: 27px 30px 21px;
    overflow: hidden;
    border: 1px solid var(--perspectives-line);
    border-radius: var(--perspectives-radius);
    background: var(--perspectives-paper);
    box-shadow: 0 4px 18px rgba(37, 42, 32, 0.025);
    animation: perspectiveFadeUp 0.55s ease both;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

    .perspective-card:hover {
        transform: translateY(-3px);
        border-color: rgba(98, 109, 77, 0.28);
        box-shadow: 0 14px 32px rgba(37, 42, 32, 0.065);
    }

    .perspective-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 3px;
        height: 0;
        background: var(--perspectives-olive);
        transition: height 0.3s ease;
    }

    .perspective-card:hover::before {
        height: 100%;
    }

/* =========================================================
   CARD METADATA
   ========================================================= */

.perspective-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.anonymous-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--perspectives-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

    .anonymous-label::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--perspectives-accent);
    }

.dilemma-label {
    display: inline-block;
    max-width: 65%;
    padding: 7px 11px;
    overflow: hidden;
    border: 1px solid rgba(98, 109, 77, 0.16);
    border-radius: 30px;
    background: rgba(98, 109, 77, 0.075);
    color: var(--perspectives-olive-dark);
    font-size: 10px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   REFLECTION CONTENT
   ========================================================= */

.perspective-reasoning-wrapper {
    position: relative;
}

.perspective-reasoning {
    margin: 0;
    color: #41443b;
    font-size: 14px;
    line-height: 1.95;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

    .perspective-reasoning.is-collapsed {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
    }

.read-more-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--perspectives-olive);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease;
}

    .read-more-button:hover {
        color: var(--perspectives-olive-dark);
    }

    .read-more-button:focus-visible,
    .like-button:focus-visible {
        outline: 2px solid var(--perspectives-olive);
        outline-offset: 4px;
    }

/* =========================================================
   CARD FOOTER
   ========================================================= */

.perspective-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(41, 44, 37, 0.08);
}

.reflection-date {
    color: #96968b;
    font-size: 10px;
    letter-spacing: 0.3px;
}

/* =========================================================
   LIKE BUTTON
   ========================================================= */

.like-form {
    margin: 0;
}

.like-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 58px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 30px;
    background: transparent;
    color: var(--perspectives-muted);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

    .like-button:hover {
        transform: translateY(-2px);
        border-color: rgba(157, 91, 82, 0.2);
        background: rgba(157, 91, 82, 0.06);
    }

    .like-button.is-liked {
        border-color: rgba(157, 91, 82, 0.16);
        background: rgba(157, 91, 82, 0.075);
        color: #a45f56;
    }

    .like-button:disabled {
        opacity: 0.6;
        cursor: wait;
    }

.heart-icon {
    display: inline-block;
    font-size: 19px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.like-button.is-liked .heart-icon {
    color: #a45f56;
}

.like-count {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.heart-pop {
    animation: heartPop 0.4s ease;
}

/* =========================================================
   EMPTY STATES
   ========================================================= */

.empty-perspectives {
    padding: 65px 30px;
    border: 1px dashed rgba(98, 109, 77, 0.3);
    border-radius: var(--perspectives-radius);
    background: rgba(251, 250, 246, 0.6);
    text-align: center;
}

    .empty-perspectives h2 {
        margin: 0 0 12px;
        font-family: "Playfair Display", Georgia, serif;
        font-size: 29px;
        font-weight: 500;
    }

    .empty-perspectives p {
        max-width: 420px;
        margin: 0 auto;
        color: var(--perspectives-muted);
        font-size: 13px;
        line-height: 1.8;
    }

.explore-link {
    display: inline-flex;
    margin-top: 22px;
    color: var(--perspectives-olive);
    font-size: 12px;
    font-weight: 700;
}

    .explore-link:hover {
        color: var(--perspectives-olive-dark);
    }

.no-filter-results {
    padding: 35px 20px;
    border: 1px dashed var(--perspectives-line);
    border-radius: 14px;
    color: var(--perspectives-muted);
    font-size: 13px;
    text-align: center;
}

.is-filtered-out {
    display: none !important;
}

/* =========================================================
   TALK IT THROUGH — FLOATING ASSISTANT
   ========================================================= */

#ai-chat-widget.ai-chat-widget {
    position: fixed !important;
    right: 26px !important;
    bottom: 25px !important;
    z-index: 10000 !important;
    font-family: "DM Sans", sans-serif;
}

.ai-chat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 51px;
    padding: 0 19px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    background: var(--perspectives-olive-dark);
    box-shadow: 0 8px 25px rgba(37, 42, 32, 0.2);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

    .ai-chat-toggle:hover {
        transform: translateY(-3px);
        background: var(--perspectives-olive);
        box-shadow: 0 12px 28px rgba(37, 42, 32, 0.25);
    }

.ai-chat-toggle-icon {
    font-size: 17px;
}

.ai-chat-panel {
    position: absolute;
    right: 0;
    bottom: 65px;
    display: flex;
    flex-direction: column;
    width: min(370px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 120px));
    overflow: hidden;
    border: 1px solid var(--perspectives-line);
    border-radius: 19px;
    background: var(--perspectives-paper);
    box-shadow: 0 18px 60px rgba(25, 30, 22, 0.2);
    animation: perspectiveFadeUp 0.25s ease both;
}

    .ai-chat-panel[hidden] {
        display: none !important;
    }

.ai-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 22px;
    background: var(--perspectives-olive-dark);
    color: white;
}

.ai-chat-eyebrow {
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

.ai-chat-header h2 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 23px;
    font-weight: 500;
}

.ai-chat-subtitle {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 11px;
    line-height: 1.6;
}

.ai-chat-close {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: transparent;
    color: white;
    font-size: 19px;
    cursor: pointer;
}

.ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
    padding: 19px;
    overflow-y: auto;
    background: var(--perspectives-paper);
}

.ai-chat-message {
    max-width: 90%;
    padding: 12px 14px;
    border-radius: 13px;
    font-size: 12px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.ai-chat-message-assistant {
    align-self: flex-start;
    border: 1px solid var(--perspectives-line);
    border-top-left-radius: 3px;
    background: var(--perspectives-paper-deep);
    color: var(--perspectives-ink);
}

.ai-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 13px;
    border-top: 1px solid var(--perspectives-line);
    background: var(--perspectives-paper);
}

    .ai-chat-form textarea {
        flex: 1;
        min-width: 0;
        min-height: 43px;
        max-height: 100px;
        padding: 12px;
        resize: vertical;
        border: 1px solid var(--perspectives-line);
        border-radius: 10px;
        outline: none;
        background: white;
        color: var(--perspectives-ink);
        font-size: 11px;
    }

        .ai-chat-form textarea:focus {
            border-color: var(--perspectives-olive);
        }

    .ai-chat-form button {
        min-height: 42px;
        padding: 0 15px;
        border: 0;
        border-radius: 10px;
        background: var(--perspectives-olive-dark);
        color: white;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
    }

.ai-chat-disclaimer {
    margin: 0;
    padding: 0 14px 13px;
    background: var(--perspectives-paper);
    color: var(--perspectives-muted);
    font-size: 9px;
    line-height: 1.5;
}

.ai-chat-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   ACCESSIBILITY WIDGET
   ========================================================= */

.accessibility-toggle {
    position: fixed !important;
    right: 26px !important;
    bottom: 88px !important;
    z-index: 10001 !important;
    display: grid;
    place-items: center;
    width: 49px;
    height: 49px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: var(--perspectives-olive-dark);
    box-shadow: 0 7px 22px rgba(37, 42, 32, 0.2);
    color: white;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease;
}

    .accessibility-toggle:hover {
        transform: translateY(-3px);
        background: var(--perspectives-olive);
    }

    .accessibility-toggle svg {
        width: 23px;
        height: 23px;
    }

.accessibility-panel {
    position: fixed !important;
    right: 26px !important;
    bottom: 148px !important;
    z-index: 10002 !important;
    width: min(290px, calc(100vw - 32px));
    padding: 20px;
    border: 1px solid var(--perspectives-line);
    border-radius: 16px;
    background: var(--perspectives-paper);
    box-shadow: 0 15px 45px rgba(25, 30, 22, 0.18);
    color: var(--perspectives-ink);
}

    .accessibility-panel[hidden] {
        display: none !important;
    }

    /* Common accessibility panel controls */
    .accessibility-panel button {
        cursor: pointer;
    }

        .accessibility-panel button:focus-visible {
            outline: 2px solid var(--perspectives-olive);
            outline-offset: 3px;
        }

/* =========================================================
   HIGH CONTRAST MODE
   ========================================================= */

.accessibility-high-contrast .perspectives-page,
body.accessibility-high-contrast.perspectives-page {
    background: #fff !important;
    color: #000 !important;
}

.accessibility-high-contrast .perspective-card,
.accessibility-high-contrast .perspectives-toolbar,
.accessibility-high-contrast .perspectives-search,
.accessibility-high-contrast .perspectives-filters select {
    border: 2px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
}

.accessibility-high-contrast .perspective-reasoning,
.accessibility-high-contrast .perspectives-hero > p,
.accessibility-high-contrast .reflection-date,
.accessibility-high-contrast .anonymous-label {
    color: #000 !important;
}

.accessibility-high-contrast .dilemma-label {
    border: 1px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes perspectiveFadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.45);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* =========================================================
   RESPONSIVE — TABLETS
   ========================================================= */

@media (max-width: 800px) {
    .perspectives-container {
        width: min(100% - 36px, 720px);
        padding-top: 58px;
    }

    .perspectives-toolbar {
        flex-direction: column;
    }

    .perspectives-search {
        min-height: 54px;
    }

    .perspectives-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

        .perspectives-filters select {
            width: 100%;
            min-width: 0;
        }

    .perspective-card {
        padding: 24px;
    }
}

/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 600px) {
    .perspectives-header {
        min-height: 66px;
        padding: 0 19px;
    }

        .perspectives-header .brand {
            font-size: 18px;
        }

        .perspectives-header .back-link {
            font-size: 10px;
        }

    .perspectives-container {
        width: calc(100% - 30px);
        padding: 49px 0 100px;
    }

    .perspectives-hero {
        margin-bottom: 39px;
    }

        .perspectives-hero .eyebrow {
            font-size: 9px;
            letter-spacing: 2px;
        }

        .perspectives-hero h1 {
            font-size: clamp(36px, 10vw, 48px);
            letter-spacing: -1px;
        }

        .perspectives-hero > p {
            margin-top: 17px;
            font-size: 12px;
            line-height: 1.8;
        }

    .response-count {
        margin-top: 21px;
    }

    .perspectives-toolbar {
        gap: 11px;
        margin-top: 29px;
        padding: 11px;
    }

    .perspectives-filters {
        gap: 8px;
    }

        .perspectives-filters select {
            padding: 13px 27px 13px 9px;
            font-size: 10px;
        }

    .perspective-card {
        padding: 21px 19px 17px;
        border-radius: 15px;
    }

    .perspective-meta {
        align-items: flex-start;
        margin-bottom: 17px;
    }

    .anonymous-label {
        font-size: 9px;
    }

    .dilemma-label {
        max-width: 60%;
        font-size: 9px;
    }

    .perspective-reasoning {
        font-size: 12px;
        line-height: 1.85;
    }

    .perspective-footer {
        margin-top: 19px;
    }

    #ai-chat-widget.ai-chat-widget {
        right: 15px !important;
        bottom: 16px !important;
    }

    .ai-chat-toggle {
        min-height: 46px;
        padding: 0 15px;
        font-size: 10px;
    }

    .ai-chat-panel {
        right: 0;
        bottom: 58px;
        max-height: calc(100vh - 100px);
    }

    .accessibility-toggle {
        right: 15px !important;
        bottom: 73px !important;
        width: 45px;
        height: 45px;
    }

    .accessibility-panel {
        right: 15px !important;
        bottom: 129px !important;
    }
}

/* =========================================================
   SMALL MOBILE SCREENS
   ========================================================= */

@media (max-width: 380px) {
    .perspectives-header .brand {
        font-size: 16px;
    }

    .perspectives-header .back-link {
        font-size: 9px;
    }

    .perspectives-filters {
        grid-template-columns: 1fr;
    }

    .perspective-card {
        padding: 18px 15px;
    }

    .ai-chat-toggle {
        min-height: 43px;
        padding: 0 12px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .perspectives-page *,
    .perspectives-page *::before,
    .perspectives-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
