:root {
    --site-radius: 18px;
    --site-radius-sm: 14px;
    --site-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    --reader-max-width: 920px;
}

html,
body {
    height: 100%;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
    flex: 1 0 auto;
}

/* Shared typography */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.muted {
    color: var(--bs-secondary-color) !important;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bs-heading-color);
}

.page-title {
    font-size: clamp(2rem, 5vw, 3.8rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.page-subtitle {
    max-width: 720px;
    color: var(--bs-secondary-color);
    font-size: 1.05rem;
}

/* Navbar */
.site-navbar {
    border-bottom: 1px solid var(--bs-border-color);
    backdrop-filter: blur(12px);
}

.site-navbar .navbar-brand,
.site-navbar .nav-link {
    color: var(--bs-emphasis-color);
}

.site-navbar .nav-link {
    opacity: 0.85;
    font-weight: 500;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    opacity: 1;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff5fa2, #7c5cff);
    color: white;
}

/* Hero */
.hero {
    padding: 4rem 0 2rem;
}

.hero-fullscreen {
    min-height: calc(100vh - 68px);
    display: flex;
    align-items: center;
    padding: 3rem 0;
}

.hero-fullscreen .container {
    width: 100%;
}

.hero-card {
    border-radius: calc(var(--site-radius) + 8px);
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--site-shadow);
    padding: clamp(1.25rem, 4vw, 2.25rem);
}

/* URL input/search */
.reader-form {
    max-width: 850px;
}

.reader-form .input-group {
    min-height: 68px;
}

.reader-form .form-control {
    border-radius: 999px;
    padding: 0.85rem 1.1rem;
}

.reader-form .btn {
    border-radius: 999px;
    padding-inline: 1.25rem;
    font-weight: 700;
}

/* Cards */
.card {
    border-radius: var(--site-radius);
    border: 1px solid var(--bs-border-color);
    box-shadow: none;
    background-color: var(--bs-tertiary-bg);
}

.dashboard-card,
.reader-card {
    padding: 1.1rem 1.15rem;
}

.reader-card {
    max-width: var(--reader-max-width);
    margin-inline: auto;
}

/* Reader content */
.reader-content {
    max-width: var(--reader-max-width);
    margin-inline: auto;
    font-size: 1.02rem;
    line-height: 1.75;
}

.reader-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--site-radius-sm);
    border: 1px solid var(--bs-border-color);
}

.reader-content h1,
.reader-content h2,
.reader-content h3,
.reader-content h4 {
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.reader-content h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

.reader-content h2 {
    font-size: 1.65rem;
}

.reader-content h3 {
    font-size: 1.3rem;
}

.reader-content p {
    margin-bottom: 1rem;
}

.reader-content a {
    text-decoration: none;
    font-weight: 600;
}

.reader-content a:hover {
    text-decoration: underline;
}

.reader-content ul,
.reader-content ol {
    padding-left: 1.25rem;
}

.reader-content li + li {
    margin-top: 0.3rem;
}

/* Member/profile blocks */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.profile-card {
    border-radius: var(--site-radius);
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-tertiary-bg);
    overflow: hidden;
}

.profile-card img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 0;
    border: 0;
}

.profile-card-body {
    padding: 1rem;
}

.profile-name {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.profile-meta {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

/* Pills */
.badge-pill {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Raw/debug blocks */
pre {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--bs-emphasis-color);
}

/* Accordion */
.accordion-item,
.accordion-button,
.accordion-button:not(.collapsed),
.accordion-body {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-emphasis-color);
    border-color: var(--bs-border-color);
}

.accordion-button:focus {
    box-shadow: none;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

/* Full-width rendered KProfiles homepage */
.reader-full-width {
    width: 100%;
}

.reader-full-width .kprofiles-homepage-render {
    width: 100%;
}

.reader-full-width .kprofiles-homepage-render > .herald-site-header,
.reader-full-width .kprofiles-homepage-render > .herald-site-content {
    max-width: 100%;
}

/* Dark mode */
[data-bs-theme="dark"] body {
    background-color: #111317;
    color: #e9ecef;
}

[data-bs-theme="dark"] .site-navbar {
    background-color: rgba(21, 24, 29, 0.92);
}

[data-bs-theme="dark"] .hero-card,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .profile-card {
    background-color: #171a1f;
    border-color: #2a2f37;
}

[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] .section-title,
[data-bs-theme="dark"] .navbar-brand,
[data-bs-theme="dark"] .nav-link,
[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] .mono {
    color: #f8f9fa;
}

/* Light mode */
[data-bs-theme="light"] body {
    background-color: #f8f9fb;
}

[data-bs-theme="light"] .site-navbar {
    background-color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .hero-card,
[data-bs-theme="light"] .card,
[data-bs-theme="light"] .profile-card {
    background-color: #ffffff;
    border-color: #dee2e6;
}

[data-bs-theme="light"] .page-title,
[data-bs-theme="light"] .section-title,
[data-bs-theme="light"] pre,
[data-bs-theme="light"] .mono {
    color: #111827;
}

/* Tablet */
@media (max-width: 991.98px) {
    .hero-fullscreen {
        min-height: calc(100vh - 64px);
        padding: 2.5rem 0;
    }

    .hero .display-4 {
        font-size: 2.75rem;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .hero {
        padding: 2rem 0 1rem;
    }

    main {
        padding-top: 1rem !important;
    }

    .reader-content {
        font-size: 1rem;
        line-height: 1.65;
    }
}

/* Small mobile */
@media (max-width: 575.98px) {
    .hero-fullscreen {
        min-height: calc(100vh - 60px);
        padding: 2rem 0;
    }

    .hero .display-4 {
        font-size: 1.75rem;
        line-height: 1.15;
    }

    .hero .lead {
        font-size: 0.95rem;
        margin-bottom: 1.75rem !important;
    }

    .reader-form .input-group {
        display: flex;
        align-items: center;
        min-height: 64px;
        border-radius: 999px !important;
        gap: 0;
    }

    .reader-form .input-group-text {
        padding-left: 1rem !important;
        padding-right: 0.75rem !important;
    }

    .reader-form .form-control {
        width: auto;
        min-width: 0;
        font-size: 0.95rem;
        padding: 0.75rem 0.25rem;
    }

    .reader-form #pasteIconBtn {
        width: auto;
        padding-left: 0.75rem !important;
        padding-right: 1rem !important;
    }

    .reader-form .d-flex {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem !important;
    }

    .reader-form .d-flex .btn {
        width: 100%;
        font-size: 0.9rem;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}


/* Better dark-mode contrast */
[data-bs-theme="dark"] .hero .display-4,
[data-bs-theme="dark"] .hero .lead,
[data-bs-theme="dark"] .hero .form-text {
    color: #f8f9fa !important;
    opacity: 1;
}

[data-bs-theme="dark"] .hero .lead,
[data-bs-theme="dark"] .hero .form-text {
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] .reader-form .input-group {
    background-color: #171a1f !important;
    border-color: #343a46 !important;
}

[data-bs-theme="dark"] .reader-form .form-control {
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .reader-form .form-control::placeholder {
    color: #8f98a8 !important;
}

[data-bs-theme="dark"] .reader-form .input-group-text,
[data-bs-theme="dark"] .reader-form #pasteIconBtn {
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] .reader-form .btn.btn-light {
    background-color: #21262d !important;
    border-color: #3b434f !important;
    color: #f8f9fa !important;
}

[data-bs-theme="dark"] .reader-form .btn.btn-light:hover {
    background-color: #2b313a !important;
}


