/* ---------- Accent ---------- */
:root {
    --accent: #1bab53;
    --accent-hover: #159647;
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 27, 171, 83;
    --bs-link-hover-color: var(--accent-hover);
    --bs-link-hover-color-rgb: 21, 150, 71;
}

/* ---------- Base ---------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--bs-body-color);
}

.content-wrap {
    max-width: 780px;
}

/* ---------- Sidebar (blog layout) ---------- */
.sidebar-sticky {
    position: sticky;
    top: 1.5rem;
}

.sidebar-heading {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.sidebar-year {
    font-weight: 700;
    color: var(--bs-secondary-color);
    font-size: 1.05rem;
    text-transform: none;
    margin-bottom: 0.5rem;
}

.sidebar-list li {
    margin-bottom: 0.4rem;
}

.sidebar-link {
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 1rem;
}

.sidebar-link:hover {
    color: var(--accent);
}

.sidebar-link.active {
    color: var(--accent);
    font-weight: 600;
}

h1, h2, h3 {
    letter-spacing: -0.01em;
}

.article-body {
    font-size: 1.125rem;
    line-height: 1.75;
}

/* ---------- AI actions (copy/summarize as Markdown) ---------- */
.ai-actions .btn {
    font-size: 0.8125rem;
}

.ai-actions .js-ai-actions-label {
    min-width: 6.5em;
    display: inline-block;
    text-align: left;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Markdown tables (e.g. cookie-policy.md) render as bare <table> - Bootstrap
   doesn't style those without a .table class, which we can't add from
   Markdown source, so style them generically wherever content renders. */
.article-body table,
.content-wrap table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.article-body th,
.article-body td,
.content-wrap th,
.content-wrap td {
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    text-align: left;
    vertical-align: top;
}

.article-body thead th,
.content-wrap thead th {
    background: var(--bs-tertiary-bg);
    font-weight: 600;
}

.article-body tbody tr:nth-child(even),
.content-wrap tbody tr:nth-child(even) {
    background: var(--bs-tertiary-bg);
}

/* ---------- Navbar ---------- */
.site-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.site-navbar .nav-link {
    color: var(--bs-body-color);
    font-weight: 500;
}

.site-navbar .nav-link:hover {
    color: var(--bs-emphasis-color);
}

/* ---------- Theme toggle ---------- */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--bs-secondary-color);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-icon-moon {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-sun {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-moon {
    display: inline-block;
}

/* ---------- Index links ---------- */
.index-link, .article-title-link {
    color: var(--bs-emphasis-color);
    text-decoration: none;
}

.index-link:hover, .article-title-link:hover {
    color: var(--accent);
}

/* ---------- Author card ---------- */
.author-card {
    margin-bottom: 0.5rem;
}

.author-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    color: var(--accent);
    text-decoration: none;
}

.author-name:hover {
    text-decoration: underline;
}

.author-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bs-emphasis-color);
    color: var(--bs-body-bg);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.author-social-links {
    display: flex;
    gap: 0.4rem;
}

.author-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.author-social-icon:hover {
    color: var(--bs-emphasis-color);
    border-color: var(--bs-emphasis-color);
}

/* ---------- Authors list page ---------- */
.authors-list .author-card {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.authors-list .author-avatar {
    width: 64px;
    height: 64px;
}

.authors-list .author-name {
    font-size: 1.1rem;
}

/* ---------- Search ---------- */
[x-cloak] {
    display: none !important;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.65rem;
    color: var(--bs-secondary-color);
    pointer-events: none;
}

.search-input {
    width: 220px;
    padding: 0.45rem 2.1rem 0.45rem 2.1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    transition: border-color 0.15s ease, background 0.15s ease, width 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bs-body-bg);
    width: 260px;
}

.search-clear {
    position: absolute;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    border-radius: 50%;
}

.search-clear:hover {
    color: var(--bs-emphasis-color);
    background: var(--bs-border-color);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 380px;
    max-width: 90vw;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 0.5rem;
}

.search-result-list {
    max-height: 360px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: 9px;
    text-decoration: none;
    margin-bottom: 0.15rem;
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.search-result-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.search-result-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.search-result-title {
    font-weight: 500;
    color: var(--bs-emphasis-color);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title strong {
    font-weight: 700;
}

.search-result-summary {
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-enter {
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
    opacity: 0;
}

.search-result-item.is-selected {
    background: var(--accent);
}

.search-result-item.is-selected .search-result-icon {
    background: #fff;
    color: var(--accent);
}

.search-result-item.is-selected .search-result-title,
.search-result-item.is-selected .search-result-summary {
    color: #fff;
}

.search-result-item.is-selected .search-result-enter {
    color: #fff;
    opacity: 1;
}

.search-see-all {
    display: block;
    text-align: center;
    margin-top: 0.4rem;
    padding: 0.55rem 0.6rem 0.35rem;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
}

.search-see-all:hover {
    color: var(--accent);
}

.search-no-results {
    padding: 0.75rem 0.9rem;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

/* ---------- Tag pills ---------- */
.tag-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0 0.4rem 0.4rem 0;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    text-decoration: none;
}

.tag-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- CTA box ---------- */
.cta-box {
    background: var(--bs-tertiary-bg);
    border-radius: 12px;
}

.cta-text {
    max-width: 520px;
}

/* ---------- Bootstrap primary override (Bootstrap bakes #0d6efd
   directly into these classes, not via a CSS variable) ---------- */
.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-bg: var(--accent);
    --bs-btn-active-border-color: var(--accent);
    --bs-btn-disabled-color: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    --bs-btn-focus-shadow-rgb: 27, 171, 83;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
}

.footer-link {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-link:hover {
    color: var(--bs-emphasis-color);
    text-decoration: underline;
}

/* ---------- Language switch ---------- */
.lang-switch .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-secondary-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.lang-switch .dropdown-toggle:hover,
.lang-switch .dropdown-toggle:focus,
.lang-switch .dropdown-toggle:active,
.lang-switch .dropdown-toggle.show {
    color: var(--accent);
    background: transparent;
}

.lang-switch .dropdown-menu {
    min-width: 9rem;
    padding: 0.35rem;
    border-radius: 0.75rem;
}

.lang-switch .dropdown-item {
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
}

.lang-switch .dropdown-item:hover,
.lang-switch .dropdown-item:focus {
    background: transparent;
    color: var(--accent);
}

.lang-switch .dropdown-item.active {
    background: transparent;
    color: var(--accent);
    font-weight: 600;
}
