/* ── Custom Properties ── */

:root {
    --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --max-width: 680px;
    --color-bg: #ffffff;
    --color-text: #1d1d1f;
    --color-link: #007aff;
    --color-link-hover: #0056b3;
    --color-nav: #1d1d1f;
    --color-nav-hover: #424245;
    --color-border: #d2d2d7;
    --color-link-secondary: #6e6e73;
    --color-link-secondary-hover: #86868b;
    --color-text-secondary: #424245;
    --spacing: 1.5rem;
    --font-size: 16px;
}

/* ── Reset & Base ── */

html {
    font-size: var(--font-size);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

ol, ul {
    padding: 0 0 1rem 2rem;
}

a {
    color: var(--color-link);
}

a:visited {
    color: var(--color-link);
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    padding: 0 1.5rem;
}

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

/* ── Layout ── */

#site-wrapper {
    animation: pageEnter 0.4s ease;
    max-width: var(--max-width);
    margin: 1rem auto;
    padding: 0;
    display: grid;
    gap: 0;
}

#site-banner { order: 5; }
#site-header { order: 10; }
#site-nav    { order: 20; }
#site-main   { order: 30; }
#site-plugins { order: 40; }
#site-social { order: 50; }
#site-footer { order: 60; }

/* ── Site Banner ── */

#site-banner {
    order: 5;
    line-height: 0;
    margin-bottom: 1rem;
}

#site-banner img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: .6rem;
}

/* ── Header ── */

#site-header {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

#site-identity {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#site-identity hgroup {
    padding-bottom: .5rem;
}

#site-logo-wrapper {
    margin-bottom: auto;
}

#site-logo {
    max-width: 120px;
    max-height: 80px;
    height: auto;
    width: auto;
    border-radius: .6rem;
}

#site-title {
    font-weight: 600;
}

#site-title a {
    text-decoration: none;
    color: var(--color-text);
}

#site-title a:hover {
    text-decoration: underline;
}

#site-slogan {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-top: -0.2rem;
}

/* ── Navigation ── */

#site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
}

#site-nav a {
    color: var(--color-nav);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.2rem;
}

#site-nav a:hover {
    border-bottom-color: var(--color-nav-hover);
}

#site-nav a[aria-current="page"] {
    border-bottom-color: var(--color-text);
    font-weight: 500;
}

/* ── Social Links ── */

#site-social {
    justify-content: center;
    margin-bottom: 1rem;
}

.site-social {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem 1.5rem;
}

.site-social a.social {
    color: var(--color-link-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom-style: dotted;
}

.site-social a.social:hover {
    color: var(--color-link-secondary-hover);
    border-bottom-color: var(--color-link-secondary-hover);
}

.site-social a.rss {
    color: var(--color-link-secondary);
}

.site-social a.rss:hover {
    color: var(--color-link-secondary-hover);
}

/* ── Page Transitions ── */

@keyframes pageEnter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Main Content ── */

#site-main {
    min-height: 60vh;
    margin-bottom: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* ── Post List / Homepage ── */

.list-heading {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.home-intro {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.category-description {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.post-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.post-item:last-of-type {
    border-bottom: none;
}

.post-item-title {
    font-weight: 500;
    margin-bottom: 0.2rem;
}

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

.post-item-title a:hover {
    text-decoration: underline;
}

.post-item-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

.post-item-description {
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.post-item-excerpt {
    color: var(--color-text);
}

.post-item-readmore {
    margin-top: 0.6rem;
}

.post-item-readmore a {
    font-size: 0.9rem;
    color: var(--color-link);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
}

.post-item-readmore a:hover {
    border-bottom-color: var(--color-text);
}

/* ── Breadcrumbs ── */

#post-breadcrumbs {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

#post-breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

#post-breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

#post-breadcrumbs li + li::before {
    content: "/";
    margin: 0 0.5rem;
    color: var(--color-text-secondary);
}

#post-breadcrumbs a {
    color: var(--color-link-secondary);
    text-decoration: none;
}

#post-breadcrumbs a:hover {
    color: var(--color-link-secondary-hover);
    text-decoration: underline;
}

#post-breadcrumbs [aria-current="page"] {
    color: var(--color-text);
}

/* ── Single Post / Page ── */

#post-title, #page-title {
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

#post-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    display: block;
}

/* ── Page Cover Image ── */

.page-cover-image {
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

.page-cover-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ── Post & Page Content ── */

#post-content, #page-content {
    margin-top: 1.5rem;
}

#post-content a, #page-content a {
    color: var(--color-link);
    text-decoration: underline;
}

#post-content a:hover, #page-content a:hover {
    color: var(--color-link-hover);
}

#post-content h3, #page-content h3 { margin-top: 1.5rem; }
#post-content p, #page-content p { margin-bottom: 1.2rem; }

#post-content img, #page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

#post-content blockquote, #page-content blockquote {
    border-left: 4px solid var(--color-border);
    padding-left: 1.2rem;
    font-style: italic;
    color: var(--color-text-secondary);
}

/* ── Tags & Taxonomies ── */

#page-tags {
    margin-top: 2rem;
}

#page-tags span {
    margin-right: .6rem;
}

.taxonomy-tag + .taxonomy-tag {
    margin-left: .6rem;
}

.taxonomy-badge {
    color: var(--color-link);
    text-decoration: none;
}

.taxonomy-badge:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* ── Post Actions ── */

#post-actions {
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    margin: 2rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.post-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.8rem 1.2rem;
    font-size: 0.96rem;
    font-family: inherit;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    transition: background 0.15s, border-color 0.15s;
}

.post-action-btn:hover {
    background: var(--color-border);
}

.reply-email-btn {
    transform: none;
}

/* ── Post Reactions ── */

.post-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1.5rem;
    justify-content: center;
}

.pr-btn {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-bg);
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    transition: opacity 0.15s;
    opacity: 0.8;
}

.pr-btn:hover {
    opacity: 1;
}

.pr-btn.active {
    border-color: var(--color-link);
    opacity: 1;
}

.pr-emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.pr-count {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    min-width: 1.5em;
    text-align: center;
}

/* ── Webmentions ── */

#webmentions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

#webmentions h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--color-text-secondary);
}

.webmention-group {
    margin-bottom: 1.5rem;
}

.webmention-type-label {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.webmention-likes .webmention-type-label::before {
    content: "❤️ ";
}

.webmention-reposts .webmention-type-label::before {
    content: "🔁 ";
}

.webmention-replies .webmention-type-label::before {
    content: "💬 ";
}

.webmention-mentions .webmention-type-label::before {
    content: "🔗 ";
}

.webmention-author-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.webmention-author-list a {
    line-height: 0;
}

.webmention-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.webmention-group ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.webmention-group li {
    margin-bottom: 0.25rem;
}

.webmention-reply {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto auto;
    gap: 4px 10px;
    align-items: start;
}

.webmention-reply:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.webmention-reply .webmention-photo {
    grid-row: 1 / span 2;
}

.webmention-author-name {
    font-weight: 600;
    color: var(--color-text);
    grid-column: 2;
}

.webmention-reply time {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    grid-column: 2;
}

.webmention-content {
    grid-column: 2;
    font-size: 0.95rem;
    color: var(--color-text);
}

.webmention-content p {
    margin: 0;
}

.webmention-source-link {
    grid-column: 2;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.webmention-source-domain {
    grid-column: 2;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}


#edit-fab {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 999;
    width: 44px;
    height: 44px;
    border-radius: 24%;
    background: #ebebeb;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

#edit-fab:hover {
    opacity: 1;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    color: var(--color-text);
}

[data-theme="dark"] #edit-fab {
    background: #2a2a48;
    border-color: var(--color-border);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] #edit-fab:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.55);
    color: var(--color-text);
}

#dashboard-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    width: 44px;
    height: 44px;
    border-radius: 24%;
    background: #ebebeb;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

#dashboard-fab:hover {
    opacity: 1;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    color: var(--color-text);
}

[data-theme="dark"] #dashboard-fab {
    background: #2a2a48;
    border-color: var(--color-border);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] #dashboard-fab:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.55);
    color: var(--color-text);
}

/* ── Pagination ── */

#pagination {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
}

.pagination-prev,
.pagination-next {
    color: var(--color-link);
    text-decoration: none;
    font-size: 0.95rem;
}

.pagination-prev:hover,
.pagination-next:hover {
    text-decoration: underline;
}

/* ── Sidebar Plugins ── */

.plugin {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#site-plugins {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* ── Footer ── */

#site-footer {
    display: flex;
    justify-content: center;
    gap: 1rem 2rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    text-align: center;
}

/* ── Accessibility ── */

#skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 1000;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
}

#skip-link:focus {
    top: 0;
}

/* ── Utility ── */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

/* ── Search ── */

body > .container {
    display: none;
}

.search-results-header {
    padding: 2rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.search-results-header h1 { font-size: 1.75rem; margin: 0 0 0.5rem 0; }
.search-results-header .search-query { color: var(--color-link); font-weight: 600; }
.search-results-header .search-count { color: var(--color-nav); font-size: 0.9375rem; margin: 0; }

.search-no-results { text-align: center; padding: 3rem 1rem; }
.search-no-results h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.search-no-results p { color: var(--color-nav); margin-bottom: 1.5rem; }
.search-no-results .search-suggestions { text-align: left; max-width: 400px; margin: 0 auto; }
.search-no-results .search-suggestions ul { padding-left: 1.25rem; color: var(--color-nav); }

.search-result-excerpt { color: var(--color-text); line-height: 1.6; margin-top: 0.5rem; }

.search-highlight {
    background-color: rgba(255, 230, 0, 0.4);
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

[data-theme="dark"] .search-highlight { background-color: rgba(255, 214, 10, 0.3); }

.search-inline-form { max-width: 400px; margin: 1.5rem auto 0; }

.search-inline-form input[type="search"],
.plugin-search .search-plugin-form input[type="search"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
}

.search-inline-form input[type="search"]:focus,
.plugin-search .search-plugin-form input[type="search"]:focus {
    outline: none;
    border-color: var(--color-link);
}

.plugin-search .search-plugin-form { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.plugin-search .search-plugin-form input[type="search"] {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    max-width: 100%;
}

/* ── Feedroll ── */

.feedroll-entry {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.feedroll-entry:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.feedroll-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 0.2rem;
}

.feedroll-source {
    color: var(--color-link-secondary);
    text-decoration: none;
    font-weight: 500;
}

.feedroll-source:hover {
    color: var(--color-link-secondary-hover);
    text-decoration: underline;
}

.feedroll-excerpt {
    margin-top: 0.25rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.feedroll-intro {
    margin-bottom: 2.5rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    font-size: 1.15rem;
}

/* ── Dark Theme ── */

/* ── Variables ── */

[data-theme="dark"] {
    --color-bg: #0c0c0e;
    --color-text: #ffffff;
    --color-link: #007aff;
    --color-link-hover: #0056b3;
    --color-link-secondary: #a1a1a6;
    --color-link-secondary-hover: #68686f;
    --color-border: #38383a;
    --color-text-secondary: #c7c7cc;
}

/* ── Body ── */

[data-theme="dark"] body {
    background-color: var(--color-bg);
    color: var(--color-text);
}

/* ── Header ── */

[data-theme="dark"] #site-title a {
    color: var(--color-text);
}

[data-theme="dark"] #site-slogan {
    color: var(--color-text-secondary);
}

/* ── Navigation ── */

[data-theme="dark"] #site-nav a {
    color: var(--color-link);
}

[data-theme="dark"] #site-nav a:hover,
[data-theme="dark"] #site-nav a[aria-current="page"] {
    border-bottom-color: var(--color-link);
    color: var(--color-link-hover);
}

/* ── Social Links ── */

[data-theme="dark"] .site-social a.social {
    color: var(--color-link-secondary);
}

[data-theme="dark"] .site-social a.social:hover {
    color: var(--color-link-secondary-hover);
}

[data-theme="dark"] .site-social a.rss {
    color: var(--color-link-secondary);
}

[data-theme="dark"] .site-social a.rss:hover {
    color: var(--color-link-secondary-hover);
}

/* ── Post List ── */

[data-theme="dark"] .list-heading {
    color: var(--color-text);
}

[data-theme="dark"] .category-description {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .post-item-title a {
    color: var(--color-text);
}

[data-theme="dark"] .post-item-description {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .post-item-readmore a {
    color: var(--color-link);
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .post-item-readmore a:hover {
    border-bottom-color: var(--color-link);
}

/* ── Single Post / Page ── */

[data-theme="dark"] #post-title,
[data-theme="dark"] #page-title {
    color: var(--color-text);
}

/* ── Content ── */

[data-theme="dark"] #post-content,
[data-theme="dark"] #page-content {
    color: var(--color-text);
}

[data-theme="dark"] #post-content blockquote,
[data-theme="dark"] #page-content blockquote {
    border-left-color: var(--color-border);
    color: var(--color-text-secondary);
}

/* ── Taxonomies ── */

[data-theme="dark"] .taxonomy-badge {
    color: var(--color-link);
}

[data-theme="dark"] .taxonomy-badge:hover {
    color: var(--color-link-hover);
}

/* ── Pagination ── */

[data-theme="dark"] #pagination a,
[data-theme="dark"] .pagination-prev,
[data-theme="dark"] .pagination-next {
    color: var(--color-link);
}

/* ── Skip Link ── */

[data-theme="dark"] #skip-link {
    background: var(--color-link);
    color: #1a1a2e;
}
