/*
Theme Name: Cornerstone
Description: A WordPress theme for the IndieWeb with microformats2, ActivityPub, and Webmentions support. Built on the principle that you own your digital home.
Version: 1.0.2
Author: Khürt Williams
License: GPL v2 or later

Text Domain: cornerstone
Domain Path: /languages
Tags: indieweb, microformats, activitypub, webmentions, responsive, minimalist, one-column, custom-header, custom-background, custom-colors, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, sticky-post, footer-widgets

Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4

This theme supports the IndieWeb building blocks and passes IndieWebify.me validation tests.
*/

/* Reset and Base Styles */


* {
    box-sizing: border-box;
}

html {
    font-size: 18px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-weight: 400;
    color: #333;
    background-color: #fff;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.5rem;
}

a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover, a:focus {
    color: #005a87;
    text-decoration: underline;
}

/* Header Styles */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid #e1e1e1;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 999;
}

.site-branding {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.site-logo {
    margin-right: 1rem;
}

.site-title {
    font-size: 1.8rem;
    margin: 0;
}

.site-title a {
    color: #333;
}

.site-description {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Navigation */
.main-navigation {
    position: relative;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid #ccc;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 4px;
}

.primary-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.primary-menu li {
    margin-right: 2rem;
    position: relative;
}

.primary-menu a {
    display: block;
    padding: 0.5rem 0;
    color: #333;
    font-weight: 500;
}

.primary-menu a:hover {
    color: #0073aa;
}

/* Sub-menus */
.primary-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e1e1e1;
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.primary-menu li:hover .sub-menu {
    display: block;
}

.primary-menu .sub-menu li {
    margin: 0;
    width: 100%;
}

.primary-menu .sub-menu a {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Post Styles */
.posts-container {
    display: grid;
    gap: 3rem;
}

article {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e1e1e1;
}

article:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sticky-post-label {
    background: #0073aa;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.post-thumbnail {
    margin-bottom: 1.5rem;
}

/* Featured image caption styling to match inline images */
.post-thumbnail .wp-caption-text {
    text-align: right;
    font-style: italic;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #666;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.entry-header {
    margin-bottom: 1.5rem;
}

.entry-title {
    margin-bottom: 0.5rem;
}

.entry-title a {
    color: #333;
}

.entry-title a:hover {
    color: #0073aa;
}

.entry-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.entry-meta a {
    color: #666;
}

.entry-meta a:hover {
    color: #0073aa;
}

.entry-meta .p-author .u-photo {
    display: none;
}

.entry-content {
    line-height: 1.7;
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Image Captions */
.wp-caption {
    max-width: 100%;
    margin-bottom: 1.5rem;
}

.wp-caption img {
    display: block;
    width: 100%;
    height: auto;
}

.wp-caption-text {
    text-align: right;
    font-style: italic;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #666;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

/* Author Bio */
.author-bio {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 2rem;
    margin: 3rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.author-avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
}

.author-info {
    flex: 1;
}

.author-name {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.author-name a {
    color: #333;
}

.author-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.author-social a {
    display: inline-block;
    margin-right: 1rem;
    color: #0073aa;
    font-size: 0.9rem;
}

/* Related Posts */
.related-posts {
    margin: 3rem 0;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.related-posts h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-post {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.related-post:hover {
    transform: translateY(-2px);
}

.related-post-thumbnail img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.related-post-title {
    padding: 1rem 1rem 0.5rem;
    margin: 0;
    font-size: 1rem;
}

.related-post-title a {
    color: #333;
}

.related-post-date {
    padding: 0 1rem 1rem;
    color: #666;
    font-size: 0.85rem;
}

/* Post Navigation */
.post-navigation {
    margin: 3rem 0;
    border-top: 1px solid #e1e1e1;
    border-bottom: 1px solid #e1e1e1;
    padding: 2rem 0;
}

.post-navigation .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.post-navigation .nav-links a {
    display: block;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
    color: #333;
    transition: background-color 0.3s ease;
}

.post-navigation .nav-links a:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.post-navigation .nav-subtitle {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.post-navigation .nav-title {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.post-navigation .nav-next {
    text-align: right;
}

/* Comments */
.comments-area {
    margin: 3rem 0;
    padding-top: 2rem;
    border-top: 1px solid #e1e1e1;
}

.comment-respond {
    margin-bottom: 3rem;
}

.comment-reply-title {
    margin-bottom: 1.5rem;
}

.comment-form {
    display: grid;
    gap: 1rem;
}

.comment-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.comment-form textarea {
    min-height: 120px;
    resize: vertical;
}

.comment-form .submit {
    background: #0073aa;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    justify-self: start;
}

.comment-form .submit:hover {
    background: #005a87;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list .comment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 6px;
}

.comment-list .children {
    list-style: none;
    margin-left: 2rem;
    margin-top: 1rem;
}

.comment-body {
    display: grid;
    gap: 1rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-author img {
    border-radius: 50%;
}

.comment-metadata {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.comment-metadata .fn {
    font-weight: 600;
}

.comment-metadata a {
    color: #666;
    font-size: 0.85rem;
}

.comment-content {
    line-height: 1.6;
}

/* Pagination */
.pagination {
    margin: 3rem 0;
    text-align: center;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    margin: 0 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Footer */
.site-footer {
    background: #f9f9f9;
    border-top: 1px solid #e1e1e1;
    margin-top: auto;
}

.footer-widgets {
    padding: 3rem 0;
}

.footer-widget-areas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.footer-widget-area h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

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

.footer-widget-area ul li {
    margin-bottom: 0.5rem;
}

.site-info {
    background: #333;
    color: white;
    padding: 1.5rem 0;
}

.site-info a {
    color: white;
    text-decoration: none;
}

.site-info a:hover {
    color: #ccc;
    text-decoration: underline;
}

.site-info .container {
    display: flex;
    align-items: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
}

.footer-content p.copyright {
    margin: 0;
    font-size: 0.9rem;
}

.footer-navigation {
    flex: 1;
    text-align: center;
}

.footer-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-navigation a {
    color: #ccc;
    font-size: 0.9rem;
    text-decoration: none;
}

.footer-navigation a:hover {
    color: white;
    text-decoration: underline;
}

.rss-link {
    font-size: 0.9rem;
}

.rss-link a {
    color: white;
    text-decoration: none;
}

.rss-link a:hover {
    color: #ccc;
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .container {
        padding: 0 15px;
    }
    
    .site-header {
        padding: 0.75rem 0;
    }
    
    .site-branding {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }
    
    .site-title {
        font-size: 1.5rem;
    }
    
    .menu-toggle {
        display: block;
        margin-bottom: 1rem;
    }
    
    .primary-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background: #f9f9f9;
        border-radius: 4px;
        padding: 1rem;
    }
    
    .primary-menu.toggled {
        display: flex;
    }
    
    .primary-menu li {
        margin: 0;
        border-bottom: 1px solid #e1e1e1;
    }
    
    .primary-menu li:last-child {
        border-bottom: none;
    }
    
    .primary-menu a {
        padding: 0.75rem 0;
    }
    
    .primary-menu .sub-menu {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: 1rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.4rem; }
    
    .author-bio {
        flex-direction: column;
        text-align: center;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        grid-template-columns: 1fr;
    }
    
    .nav-next {
        text-align: left;
    }
    
    .comment-list .children {
        margin-left: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-navigation {
        width: 100%;
    }
    
    .footer-navigation ul {
        justify-content: center;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .site-main {
        padding: 1rem 0;
    }
    
    .related-posts-grid {
        gap: 1rem;
    }
    
    .footer-widget-areas {
        grid-template-columns: 1fr;
    }
    
    .footer-navigation ul {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Accessibility */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-size: 0.875rem;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .comment-respond,
    .post-navigation,
    .related-posts {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* ActivityPub Reactions */
.activitypub-reactions {
    margin: 2rem 0 3rem;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 8px;
    border-top: 1px solid #e1e1e1;
}

.activitypub-reactions h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: #333;
    font-weight: 600;
}

.ap-likes,
.ap-boosts {
    margin-bottom: 1.5rem;
}

.ap-likes:last-child,
.ap-boosts:last-child {
    margin-bottom: 0;
}

.ap-likes strong,
.ap-boosts strong {
    display: block;
    margin-bottom: 0.75rem;
    color: #666;
    font-size: 0.95rem;
    font-weight: 600;
}

.reaction-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reaction-avatars a {
    display: inline-block;
    line-height: 0;
    transition: transform 0.2s ease;
}

.reaction-avatars a:hover {
    transform: translateY(-2px);
}

.reaction-avatar {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }
    
    a {
        color: #0000EE;
    }
    
    a:visited {
        color: #551A8B;
    }
    
    .site-header {
        border-bottom: 2px solid black;
    }
    
    article {
        border-bottom: 2px solid black;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e1e1e1;
    }

    .site-header {
        background: #1a1a1a;
        border-bottom-color: #333;
    }

    .site-title a,
    .entry-title a,
    .primary-menu a {
        color: #e1e1e1;
    }

    /* Mobile menu dark mode fix */
    .primary-menu {
        background: #2a2a2a;
    }

    /* Desktop dropdown sub-menu dark mode fix */
    .primary-menu .sub-menu {
        background: #2a2a2a;
        border-color: #333;
    }

    .primary-menu .sub-menu a {
        border-bottom-color: #333;
    }

    .author-bio,
    .related-posts,
    .comment-list .comment {
        background: #2a2a2a;
    }

    .site-footer {
        background: #2a2a2a;
        border-top-color: #333;
    }

    .comment-form input,
    .comment-form textarea {
        background: #2a2a2a;
        border-color: #444;
        color: #e1e1e1;
    }

    /* ActivityPub reactions dark mode */
    .activitypub-reactions {
        background: #2a2a2a;
        border-top-color: #333;
    }

    .activitypub-reactions h3 {
        color: #e1e1e1;
    }

    .ap-likes strong,
    .ap-boosts strong {
        color: #aaa;
    }

    .reaction-avatar {
        border-color: #2a2a2a;
    }

    .author-description {
        color: #d1d1d1;
    }

    .site-description {
        color: #aaa;
    }

    .author-name a {
        color: #e1e1e1;
    }
    
    .author-description {
        color: #d1d1d1;
    }
    
    .site-description {
        color: #aaa;
    }

    .related-posts h3 {
        color: #e1e1e1;
    }

    .post-thumbnail .wp-caption-text {
        color: #aaa;
    }
}
