/* ==========================================================================
   BestBlogTheme — Main Stylesheet
   ========================================================================== */

/* -- Reset & Base --------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--bbt-font-secondary);
    font-weight: 400;
    line-height: 1.7;
    color: var(--bbt-color-paragraph);
    background-color: var(--bbt-color-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -- Typography ----------------------------------------------------------- */
/* Color 1 (primary): H1, links */
h1 {
    font-family: var(--bbt-font-primary);
    font-weight: 700;
    line-height: 1.3;
    color: var(--bbt-color-primary);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

/* Color 2 (secondary): H2 */
h2 {
    font-family: var(--bbt-font-primary);
    font-weight: 700;
    line-height: 1.3;
    color: var(--bbt-color-secondary);
    font-size: clamp(1.5rem, 3vw, 2rem);
}

/* Color 3 (tertiary): H3, H4, H5, H6 */
h3, h4, h5, h6 {
    font-family: var(--bbt-font-primary);
    font-weight: 700;
    line-height: 1.3;
    color: var(--bbt-color-tertiary);
}

h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

/* Paragraph color */
p {
    margin-bottom: 1.25rem;
    color: var(--bbt-color-paragraph);
}

li {
    color: var(--bbt-color-paragraph);
}

/* Color 4 (accent): bold and underline */
strong, b {
    color: var(--bbt-color-accent);
}

u, ins {
    color: var(--bbt-color-accent);
    text-decoration-color: var(--bbt-color-accent);
}

/* Color 1 (primary): links */
a {
    color: var(--bbt-color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus-visible {
    color: var(--bbt-color-secondary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* -- Skip Link ------------------------------------------------------------ */
.bbt-skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--bbt-color-primary);
    color: #fff;
    font-weight: 600;
}

.bbt-skip-link:focus {
    top: 0;
}

/* -- Container ------------------------------------------------------------ */
.bbt-container {
    width: 100%;
    max-width: var(--bbt-container-width);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

.bbt-container--narrow {
    max-width: 780px;
}

/* -- Layout with Sidebar -------------------------------------------------- */
.bbt-layout-sidebar {
    display: grid;
    gap: 2.5rem;
    padding-block: 2rem;
}

.bbt-layout-sidebar--right {
    grid-template-columns: 1fr;
}

.bbt-layout-sidebar--left {
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .bbt-layout-sidebar--right {
        grid-template-columns: 1fr 320px;
    }

    .bbt-layout-sidebar--left {
        grid-template-columns: 320px 1fr;
    }
}

/* -- Main Content --------------------------------------------------------- */
.bbt-site-main {
    min-height: 60vh;
    padding-block: 2rem;
}

.bbt-site-main--full-width {
    max-width: 100%;
    padding-inline: 0;
}

.bbt-site-main--full-width .bbt-page__content {
    max-width: 100%;
}

/* -- Page ----------------------------------------------------------------- */
.bbt-page__header {
    margin-bottom: 2rem;
}

.bbt-page__title {
    margin-bottom: 0.5rem;
}

.bbt-page__content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.bbt-page__content > *:last-child {
    margin-bottom: 0;
}

/* -- Entry Content (Gutenberg + Classic) ---------------------------------- */
.entry-content h2 { margin-top: 2.5rem; margin-bottom: 1rem; }
.entry-content h3 { margin-top: 2rem; margin-bottom: 0.75rem; }
.entry-content h4 { margin-top: 1.5rem; margin-bottom: 0.5rem; }

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.entry-content li {
    margin-bottom: 0.35rem;
}

.entry-content blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--bbt-color-primary);
    background: var(--bbt-color-light);
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

.entry-content pre {
    background: var(--bbt-color-black);
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.entry-content code {
    background: var(--bbt-color-light);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.entry-content pre code {
    background: none;
    padding: 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}

.entry-content th,
.entry-content td {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.entry-content th {
    background: var(--bbt-color-light);
    font-family: var(--bbt-font-primary);
    font-weight: 600;
}

.entry-content figure {
    margin: 1.5rem 0;
}

.entry-content figcaption {
    font-size: 0.875rem;
    color: var(--bbt-color-gray);
    margin-top: 0.5rem;
    text-align: center;
}

/* -- Gutenberg alignments ------------------------------------------------- */
.alignwide {
    max-width: calc(var(--bbt-container-width) + 200px);
    margin-inline: auto;
    width: 100%;
}

.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.aligncenter {
    text-align: center;
}

/* -- Sidebar Widgets ------------------------------------------------------ */
.bbt-sidebar {
    padding-block: 1rem;
}

.bbt-widget {
    margin-bottom: 2rem;
}

.bbt-widget__title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bbt-color-primary);
}

.bbt-widget ul {
    list-style: none;
    padding: 0;
}

.bbt-widget li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.bbt-widget li:last-child {
    border-bottom: none;
}

/* -- Pagination ----------------------------------------------------------- */
.bbt-pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.bbt-pagination .nav-links {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.bbt-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-family: var(--bbt-font-primary);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--bbt-color-dark);
    background: var(--bbt-color-light);
    transition: all 0.2s ease;
}

.bbt-pagination .page-numbers:hover {
    background: var(--bbt-color-primary);
    color: #fff;
}

.bbt-pagination .page-numbers.current {
    background: var(--bbt-color-primary);
    color: #fff;
}

/* -- Breadcrumbs ---------------------------------------------------------- */
.bbt-breadcrumbs {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.bbt-breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    gap: 0.25rem;
}

.bbt-breadcrumbs__item:not(:last-child)::after {
    content: '/';
    margin-left: 0.25rem;
    color: var(--bbt-color-gray);
}

.bbt-breadcrumbs__item a {
    color: var(--bbt-color-gray);
}

.bbt-breadcrumbs__item a:hover {
    color: var(--bbt-color-primary);
}

.bbt-breadcrumbs__item--current {
    color: var(--bbt-color-dark);
    font-weight: 500;
}

/* -- Screen Reader Text --------------------------------------------------- */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    clip: auto;
    clip-path: none;
    height: auto;
    width: auto;
}

/* -- Selection ------------------------------------------------------------ */
::selection {
    background: var(--bbt-color-primary);
    color: #fff;
}

/* -- Focus visible -------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--bbt-color-primary);
    outline-offset: 2px;
}
