/* ============================================
   Sex Health Guide — "Warm Editorial Wellness"
   Palette: deep teal, warm cream, terracotta accent
   Fonts: Playfair Display (headlines) + DM Sans (body)
   ============================================ */

:root {
    --teal: #1A5653;
    --teal-dark: #123D3B;
    --teal-light: #2A7A76;
    --cream: #FBF7F0;
    --cream-dark: #F0E9DD;
    --terra: #D4714E;
    --terra-dark: #B85E3F;
    --terra-light: #E8956F;
    --charcoal: #2C2C2C;
    --text: #3A3530;
    --text-light: #7A7067;
    --text-muted: #ADA49A;
    --border: #E6DFD4;
    --shadow-sm: 0 1px 4px rgba(26, 86, 83, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 86, 83, 0.08);
    --shadow-lg: 0 8px 32px rgba(26, 86, 83, 0.1);
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

/* === Base === */
*::selection {
    background: var(--terra-light);
    color: white;
}

body {
    background-color: var(--cream);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Subtle grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* === Typography === */
h1, h2, h3, .display-font {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--charcoal);
    letter-spacing: -0.01em;
}

/* === Navbar === */
.navbar, .navbar.navbar-dark, .navbar.bg-dark {
    background: var(--teal) !important;
    padding: 0.85rem 0;
    box-shadow: none;
    border-bottom: 3px solid var(--terra);
}

.navbar-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cream) !important;
}

.navbar-brand i {
    color: var(--terra-light);
}

.navbar .btn-outline-light {
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 100px;
    padding: 0.4rem 1.2rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}

.navbar .btn-outline-light:hover {
    background: var(--terra);
    border-color: var(--terra);
    color: white;
}

/* === Hero === */
.hero-section {
    background: var(--teal-dark);
    padding: 2.5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(212, 113, 78, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(42, 122, 118, 0.3) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-section h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cream);
    line-height: 1.15;
    position: relative;
    z-index: 1;
}

.hero-section .lead {
    font-size: 1.1rem;
    color: rgba(251, 247, 240, 0.7);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.65;
    position: relative;
    z-index: 1;
}

/* === Tools Grid (Homepage) === */
.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: -2rem;
    position: relative;
    z-index: 2;
}

.tool-link-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tool-link-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
    background: var(--teal);
    transition: width 0.25s ease;
}

.tool-link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.tool-link-card:hover::before {
    width: 6px;
}

.tool-link-card .tool-link-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cream);
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(26, 86, 83, 0.25);
}

.tool-link-card h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--charcoal);
}

.tool-link-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .tool-link-card {
        padding: 1.15rem 1.25rem;
        gap: 1rem;
    }

    .tool-link-card .tool-link-icon {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .tool-link-card h2 {
        font-size: 1.1rem;
    }

    .tool-link-card p {
        font-size: 0.82rem;
    }
}

/* === Tool Card === */
.tool-card-overlap {
    margin-top: -2rem;
    position: relative;
    z-index: 2;
}

.tool-card {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--teal), var(--terra));
}

.tool-card .card-body {
    padding: 2rem 2rem 1.75rem;
}

.tool-card .tool-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.5rem;
}

.tool-card .tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cream);
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(26, 86, 83, 0.25);
}

.tool-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: var(--charcoal);
}

.tool-card .tool-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

/* === Forms === */
.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.form-control, .form-select {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    background: var(--cream);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--teal-light);
    box-shadow: 0 0 0 4px rgba(26, 86, 83, 0.08);
    background: white;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === Buttons === */
.btn-primary {
    background: var(--terra) !important;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem 1.8rem;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
    box-shadow: 0 3px 12px rgba(212, 113, 78, 0.3);
    color: white !important;
}

.btn-primary:hover {
    background: var(--terra-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(212, 113, 78, 0.35);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    transform: none;
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

/* === Results === */
.result-card {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.result-card .card-body {
    padding: 2rem;
}

.step-card {
    border: none;
    border-left: 3px solid var(--teal);
    border-radius: 0;
    margin-bottom: 0;
    background: transparent;
    box-shadow: none;
    padding: 1.25rem 0 1.25rem 1.5rem;
    position: relative;
    transition: background 0.2s ease;
}

.step-card:hover {
    background: rgba(26, 86, 83, 0.02);
}

/* Timeline dot */
.step-card::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 1.6rem;
    width: 11px;
    height: 11px;
    background: var(--teal);
    border-radius: 50%;
    border: 2px solid white;
}

.step-card .card-body {
    padding: 0;
}

.step-timestamp {
    font-family: 'DM Mono', 'SF Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--teal) !important;
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    letter-spacing: 0.03em;
}

.step-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--charcoal);
}

.step-description {
    line-height: 1.7;
    color: var(--text-light);
    font-size: 0.92rem;
}

/* === Section Divider === */
.section-divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 2.5rem 0;
    position: relative;
}

.section-divider::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -4px;
    transform: translateX(-50%);
    width: 40px;
    height: 9px;
    background: var(--cream);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* === Popular Topics === */
.topics-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--charcoal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topics-heading i {
    color: var(--terra);
    font-size: 1.1rem;
}

.topic-item {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    padding: 1rem 1.25rem;
    transition: all 0.2s ease;
    color: inherit;
    text-decoration: none;
}

.topic-item:hover {
    border-color: var(--teal-light);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
    color: inherit;
}

.topic-item h5 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 0.2rem;
}

.topic-item:hover h5 {
    color: var(--teal);
}

.topic-item .topic-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.topic-item .views-badge {
    background: var(--cream-dark);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.72rem;
    border-radius: 100px;
    padding: 0.3rem 0.65rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* === Detail Page === */
#main-response {
    line-height: 1.85;
    font-size: 1.05rem;
    color: var(--text);
}

#main-response h1,
#main-response h2,
#main-response h3 {
    font-family: 'Playfair Display', Georgia, serif;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--charcoal);
}

#main-response h2 { font-size: 1.5rem; }
#main-response h3 { font-size: 1.25rem; }

#main-response ul,
#main-response ol {
    margin-bottom: 1.25rem;
}

#main-response li {
    margin-bottom: 0.35rem;
}

#main-response p {
    margin-bottom: 1.15rem;
}

#main-response strong {
    color: var(--charcoal);
    font-weight: 700;
}

article.detail-article {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

article.detail-article .article-toolbar {
    background: var(--cream);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 1.5rem;
}

article.detail-article .article-body {
    padding: 2.5rem 2.5rem 2rem;
}

.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0;
    padding: 0.25rem 0;
}

.breadcrumb a {
    color: var(--teal);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--teal-dark);
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

/* === Footer === */
footer, footer.bg-dark {
    background: var(--charcoal) !important;
    border-top: 3px solid var(--terra);
}

footer h5 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--cream);
}

footer h5 i {
    color: var(--terra-light);
}

footer p {
    font-size: 0.88rem;
}

/* === Misc === */
.badge.bg-info {
    background: var(--teal) !important;
    border-radius: 100px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-outline-secondary {
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.82rem;
    border-color: var(--border);
    color: var(--text-light);
}

.btn-outline-secondary:hover {
    background: var(--cream-dark);
    border-color: var(--border);
    color: var(--text);
}

.btn-outline-success {
    border-color: var(--teal-light);
    color: var(--teal);
}

.btn-outline-success:hover, .btn-success {
    background: var(--teal) !important;
    border-color: var(--teal) !important;
    color: white !important;
}

/* === Guide Tips === */
#guide-tips h3, .tips-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--charcoal);
    font-size: 1.15rem;
}

#guide-tips ul, .tips-list {
    padding-left: 1.25rem;
    list-style: none;
}

#guide-tips li, .tips-list li {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 0.5rem;
    padding-left: 1.1rem;
    position: relative;
}

#guide-tips li::before, .tips-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    background: var(--terra);
    border-radius: 50%;
}

/* === Followup Questions === */
.followup-question-section h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--charcoal);
}

.qa-item {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.qa-item:hover {
    box-shadow: var(--shadow-sm);
}

.question-header {
    border-left: 3px solid var(--teal) !important;
    background: var(--cream) !important;
}

.question-header:hover {
    background: var(--cream-dark) !important;
}

.question-number {
    background-color: var(--teal) !important;
}

.vote-button {
    border-radius: 100px !important;
}

/* === Tool Page (Ask) === */
.tool-page-card {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

/* === Animations === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-card {
    animation: fadeInUp 0.5s ease-out;
}

.topic-item {
    animation: fadeInUp 0.4s ease-out both;
}

.topic-item:nth-child(1) { animation-delay: 0.05s; }
.topic-item:nth-child(2) { animation-delay: 0.1s; }
.topic-item:nth-child(3) { animation-delay: 0.15s; }
.topic-item:nth-child(4) { animation-delay: 0.2s; }
.topic-item:nth-child(5) { animation-delay: 0.25s; }

.step-card {
    animation: fadeInUp 0.35s ease-out both;
}

/* === Story Body === */
.story-body {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text);
}

.story-body p {
    margin-bottom: 1.25rem;
}

.story-body em {
    color: var(--text-light);
}

.story-body hr {
    border: none;
    text-align: center;
    margin: 2rem 0;
}

.story-body hr::after {
    content: '* * *';
    color: var(--text-muted);
    letter-spacing: 0.5em;
    font-size: 0.85rem;
}

/* === Guide Callout === */
.guide-callout {
    background: white;
    border: 2px solid var(--teal-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.guide-callout::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
    background: var(--teal);
}

.guide-callout-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cream);
    flex-shrink: 0;
}

.guide-callout h3 {
    font-family: 'DM Sans', sans-serif;
    color: var(--charcoal);
}

@media (max-width: 768px) {
    .guide-callout {
        padding: 1rem;
    }

    .guide-callout .d-flex {
        flex-wrap: wrap;
    }

    .guide-callout .btn {
        width: 100%;
        margin-top: 0.75rem;
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-section {
        padding: 1.5rem 0 3rem;
    }

    .hero-section h1 {
        font-size: 1.75rem;
        margin-bottom: 0.35rem !important;
    }

    .hero-section .lead {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .navbar {
        padding: 0.5rem 0 !important;
    }

    .navbar-brand {
        font-size: 1.1rem !important;
    }

    .navbar .btn-outline-light {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.8rem !important;
    }

    .tool-card-overlap {
        margin-top: -1.5rem;
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }

    .tool-card .card-body,
    .result-card .card-body {
        padding: 1.15rem;
    }

    /* Bigger touch targets on mobile */
    .form-control, .form-select {
        padding: 0.75rem 0.9rem;
        font-size: 16px; /* prevents iOS zoom */
    }

    .btn-primary.btn-lg {
        padding: 0.85rem 1.5rem;
        font-size: 1rem;
    }

    .topic-item {
        padding: 0.85rem 1rem;
    }

    .topic-item h5 {
        font-size: 0.88rem !important;
    }

    .topic-item .topic-desc {
        font-size: 0.78rem;
    }

    .views-badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    .topics-heading {
        font-size: 1.25rem;
    }

    .section-divider {
        margin: 1.5rem 0;
    }

    article.detail-article .article-body {
        padding: 1.25rem 1.15rem;
    }

    article.detail-article .article-toolbar {
        padding: 0.5rem 1rem;
    }

    #main-response {
        font-size: 0.98rem;
        line-height: 1.75;
    }

    #main-response h2 { font-size: 1.3rem; }
    #main-response h3 { font-size: 1.1rem; }

    .step-card {
        padding: 1rem 0 1rem 1.15rem;
    }

    /* Followup section */
    .followup-question-section h3 {
        font-size: 1.15rem;
    }

    #followup-question {
        font-size: 16px; /* prevents iOS zoom */
    }

    footer {
        text-align: center;
    }

    footer .text-md-end {
        text-align: center !important;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
