/* ------------------------------------------------------------------
   Blog styling for Tony Galluscio Consulting
   Compatible with existing css/site.css
   ------------------------------------------------------------------ */

/* ------------------------------------------------------------------
   Blog layout
   ------------------------------------------------------------------ */

#blog,
#post {
    margin-top: 72px;
}

.blog-hero {
    background: var(--light);
    padding: 56px 0 48px;
    border-bottom: 1px solid #dfe5e8;
}

.blog-hero h1 {
    margin: 0 0 12px;
    color: var(--brand);
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.1;
}

.blog-lead {
    margin: 0;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Blog content area */

.blog-content {
    padding: 48px 0;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 48px;
}

/* ------------------------------------------------------------------
   Blog post cards (on index)
   ------------------------------------------------------------------ */

.blog-post {
    border-bottom: 1px solid #dfe5e8;
    padding: 32px 0;
}

.blog-post:last-child {
    border-bottom: none;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.post-date {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-category a {
    font-size: 0.8rem;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    background: var(--light);
    padding: 3px 10px;
    border-radius: 3px;
}

.post-category a:hover {
    background: var(--brand);
    color: white;
}

.post-title {
    margin: 0 0 16px;
    font-size: 1.45rem;
    line-height: 1.3;
    font-weight: 700;
}

.post-title a {
    color: var(--text);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--brand);
}

.read-more {
    display: inline-block;
    margin-top: 12px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.read-more:hover {
    text-decoration: underline;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 12px;
}

.search-results-header h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text);
}

.search-result-count {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 0.9rem;
}

.search-result {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid #dfe5e8;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-title {
    margin: 4px 0 12px;
    font-size: 1.2rem;
}

.search-result-title a {
    color: var(--brand);
    text-decoration: none;
}

.search-result-title a:hover {
    text-decoration: underline;
}

.search-result p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.55;
}

.search-no-results {
    margin-top: 24px;
    color: var(--muted);
}

/* Blog search form */

.blog-search-form {
    display: flex;
    gap: 7px;
}

.blog-search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.blog-search-form input {
    width: 100%;
    padding: 7px 30px 7px 8px;
    font-size: 0.85rem;
    border: 1px solid #dfe5e8;
    border-radius: 3px;
    font-family: inherit;
}

.blog-search-form input:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.blog-search-form .blog-search-clear {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: block;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}

.blog-search-form .blog-search-clear[hidden] {
    display: none;
}

.blog-search-form button {
    padding: 7px 10px;
    border: 0;
    border-radius: 3px;
    background: var(--brand);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.blog-search-form button:hover {
    opacity: 0.88;
}

/* Featured image on blog index */

.featured-image {
    margin: 16px 0;
}

.featured-image img {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 4px;
}

/* ------------------------------------------------------------------
   Blog sidebar
   ------------------------------------------------------------------ */

.blog-sidebar {
    position: sticky;
    top: 90px;
    align-self: start;
}

.sidebar-section h3 {
    margin: 0 0 16px;
    color: var(--brand);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-section li {
    padding: 8px 0;
    border-bottom: 1px solid #e8ecef;
}

.sidebar-section li:last-child {
    border-bottom: none;
}

.sidebar-section a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
}

.sidebar-section a:hover {
    color: var(--brand);
}

/* Posting calendar */

.posting-calendar table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: center;
}

.posting-calendar caption {
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.posting-calendar th,
.posting-calendar td {
    padding: 4px 2px;
}

.posting-calendar a {
    font-weight: 600;
    text-decoration: none;
    color: var(--brand);
}

.posting-calendar a:hover {
    text-decoration: underline;
}

.calendar-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.85rem;
}

.calendar-navigation a {
    text-decoration: none;
    color: var(--brand);
}

.calendar-navigation a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #dfe5e8;
}

.pagination a,
.pagination-current {
    display: inline-block;
    padding: 6px 12px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid #dfe5e8;
    border-radius: 3px;
    font-size: 0.9rem;
}

.pagination a:hover {
    background: var(--light);
    border-color: var(--brand);
    color: var(--brand);
}

.pagination-current {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    font-weight: 700;
}

/* ------------------------------------------------------------------
   Individual post page
   ------------------------------------------------------------------ */

#post .post-hero {
    background: var(--light);
    padding: 48px 0 32px;
    border-bottom: 1px solid #dfe5e8;
}

#post .post-hero h1 {
    margin: 16px 0 0;
    color: var(--text);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    line-height: 1.2;
}

.post-series {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-style: italic;
}

.post-content {
    padding: 48px 0;
}

.post-body {
    max-width: 720px;
}

.post-body h2 {
    margin: 2em 0 0.75em;
    color: var(--brand);
    font-size: 1.5rem;
    line-height: 1.25;
}

.post-body h3 {
    margin: 1.75em 0 0.75em;
    font-size: 1.25rem;
}

.post-body p {
    margin: 0 0 1.25em;
    font-size: 1.05rem;
    line-height: 1.7;
}

.post-body a {
    color: var(--brand);
    text-decoration: underline;
}

.post-body a:hover {
    color: var(--text);
}

.post-body img,
.post-body video,
.post-body figure {
    display: block;
    max-width: 100%;
    margin: 1.5em 0;
}

.post-body figure {
    text-align: center;
}

.post-body figcaption {
    margin-top: 0.5em;
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
}

.post-body blockquote {
    border-left: 3px solid var(--brand);
    padding-left: 1.25em;
    margin: 1.5em 0;
    color: var(--muted);
    font-style: italic;
}

.post-body ul,
.post-body ol {
    margin: 1em 0;
    padding-left: 2em;
}

.post-body li {
    margin-bottom: 0.5em;
    font-size: 1.05rem;
    line-height: 1.65;
}

.post-body pre,
.post-body code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
}

.post-body pre {
    background: var(--light);
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body code {
    background: var(--light);
    padding: 2px 6px;
    border-radius: 3px;
}

.post-body table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95rem;
}

.post-body th,
.post-body td {
    padding: 10px 14px;
    border: 1px solid #dfe5e8;
    text-align: left;
}

.post-body th {
    background: var(--light);
    font-weight: 600;
}

/* Back to blog link */

.back-to-blog {
    display: inline-block;
    margin-top: 48px;
    padding: 10px 20px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--brand);
    border-radius: 3px;
}

.back-to-blog:hover {
    background: var(--brand);
    color: white;
}

/* ------------------------------------------------------------------
   Tablet / mobile
   ------------------------------------------------------------------ */

@media (max-width: 800px) {

    .blog-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .blog-hero {
        padding: 40px 0 32px;
    }

    .blog-content {
        padding: 32px 0;
    }

    .blog-post {
        padding: 24px 0;
    }

    .post-title {
        font-size: 1.25rem;
    }

    .post-body p {
        font-size: 1rem;
    }

    #post .post-hero {
        padding: 32px 0 24px;
    }

    #post .post-hero h1 {
        font-size: 1.6rem;
    }

    .post-content {
        padding: 32px 0;
    }

    .blog-sidebar {
        position: static;
    }

    .blog-sidebar .sidebar-section {
        margin-bottom: 28px;
    }

    .posting-calendar table {
        max-width: 360px;
    }

    .blog-search-form {
        display: block;
    }

    .blog-search-input-wrap {
        margin-bottom: 7px;
    }

    .blog-search-form input {
        width: 100%;
    }

    .blog-search-form button {
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

/* ------------------------------------------------------------------
    Archive page
    ------------------------------------------------------------------ */

#archive {
    margin-top: 72px;
}

.archive-content {
    max-width: 720px;
}

.archive-month {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid #dfe5e8;
}

.archive-month:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.archive-month-label {
    margin: 0 0 24px;
    color: var(--brand);
    font-size: 1.3rem;
    font-weight: 700;
}

.archive-post {
    padding: 16px 0;
    border-bottom: 1px solid #e8ecef;
}

.archive-post:last-child {
    border-bottom: none;
}

.archive-post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.archive-post-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.archive-post-title a {
    color: var(--text);
    text-decoration: none;
}

.archive-post-title a:hover {
    color: var(--brand);
}

@media (max-width: 800px) {

    #archive {
        margin-top: 56px;
    }

    .archive-month {
        margin-bottom: 32px;
    }

    .archive-month-label {
        font-size: 1.15rem;
    }

    .archive-post-title {
        font-size: 1rem;
    }
}

@media (max-width: 520px) {

    .archive-month-label {
        font-size: 1.05rem;
    }

    .archive-post-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 520px) {

    .blog-hero h1 {
        font-size: 1.6rem;
    }

    .blog-lead {
        font-size: 1rem;
    }

    .post-title {
        font-size: 1.15rem;
    }

    .post-meta {
        gap: 10px;
    }

    .post-body p {
        font-size: 0.95rem;
    }

    .post-body h2 {
        font-size: 1.3rem;
    }
}
