/*
Theme Name: AlgorithmDevZ Hub
Theme URI: https://xi0.in
Author: AlgorithmDevZ
Author URI: https://t.me/algorithmdevZ
Description: High-performance personal hub and blog theme with particle network animation, light/dark mode, and a clean minimal single post layout optimised for speed and indexing.
Version: 1.1.0
Requires at least: 5.9
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: algorithmdevz
Tags: blog, dark-mode, full-width-template, custom-header, custom-logo
*/

/* ==========================================================
   SINGLE POST — ULTRA-MINIMAL STYLES (GeneratePress-inspired)
   Zero frameworks, critical CSS only, max performance.
   ========================================================== */

:root {
    --sp-font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sp-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Light mode */
    --sp-bg:          #ffffff;
    --sp-bg-alt:      #f8fafc;
    --sp-text:        #0f172a;
    --sp-text-muted:  #64748b;
    --sp-text-light:  #94a3b8;
    --sp-border:      #e2e8f0;
    --sp-accent:      #06b6d4;
    --sp-accent-dark: #0891b2;
    --sp-card-bg:     #f1f5f9;
    --sp-nav-bg:      rgba(255,255,255,0.92);
    --sp-code-bg:     #f1f5f9;
    --sp-max:         780px;
    --sp-nav-h:       46px;
}

html.dark {
    --sp-bg:          #030303;
    --sp-bg-alt:      #0d0d0d;
    --sp-text:        #e5e7eb;
    --sp-text-muted:  #9ca3af;
    --sp-text-light:  #6b7280;
    --sp-border:      rgba(255,255,255,0.08);
    --sp-accent:      #22d3ee;
    --sp-accent-dark: #06b6d4;
    --sp-card-bg:     #111111;
    --sp-nav-bg:      rgba(3,3,3,0.92);
    --sp-code-bg:     #111111;
}

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

html { scroll-behavior: smooth; }

html, body {
    font-family: var(--sp-font);
    background: var(--sp-bg);
    color: var(--sp-text);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--sp-accent); text-decoration: none; }
a:hover { color: var(--sp-accent-dark); }
img { max-width: 100%; height: auto; display: block; }


/* ── Sticky nav ── */
.sp-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--sp-nav-h);
    background: var(--sp-nav-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--sp-border);
    display: flex;
    align-items: center;
}

.sp-nav-inner {
    max-width: var(--sp-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sp-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.sp-nav-brand img,
.sp-nav-brand .sp-brand-ico {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--sp-border);
    object-fit: cover;
}

.sp-nav-brand .sp-brand-name {
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff, #ff6b6b);
    background-size: 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShift 8s linear infinite;
    will-change: background-position;
}

.sp-nav-right { display: flex; align-items: center; gap: 0.625rem; }

.sp-nav-back {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sp-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.sp-nav-back:hover { color: var(--sp-text); }
.sp-nav-back svg { width: 13px; height: 13px; flex-shrink: 0; }

.sp-theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--sp-border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-text-muted);
    transition: background 0.15s, color 0.15s;
}
.sp-theme-btn:hover { background: var(--sp-card-bg); color: var(--sp-text); }
.sp-theme-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Breadcrumb ── */
.sp-breadcrumb {
    max-width: var(--sp-max);
    margin: 0 auto;
    padding: 0.5rem 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-text-light);
    flex-wrap: wrap;
}
.sp-breadcrumb a { color: var(--sp-text-muted); text-decoration: none; transition: color 0.15s; }
.sp-breadcrumb a:hover { color: var(--sp-accent); }
.sp-breadcrumb span { opacity: 0.5; }
.sp-breadcrumb .sp-bc-current { color: var(--sp-text-muted); }

/* ── Article wrapper ── */
.sp-article {
    max-width: var(--sp-max);
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

/* ── Featured image ── */
.sp-featured-img {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.125rem;
    aspect-ratio: 16/9;
    background: var(--sp-card-bg);
    border: 1px solid var(--sp-border);
}
.sp-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Category pill ── */
.sp-cat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(6,182,212,0.1);
    color: var(--sp-accent);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    text-decoration: none;
    transition: background 0.15s;
    margin-bottom: 0.625rem;
}
.sp-cat:hover { background: rgba(6,182,212,0.2); color: var(--sp-accent); }
.sp-cat::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sp-accent);
    animation: pulse 2s ease infinite;
}

/* ── Post title ── */
.sp-title {
    font-size: clamp(1.35rem, 4vw, 2rem);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--sp-text);
    margin-bottom: 0.875rem;
}

/* ── Post meta ── */
.sp-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--sp-text-muted);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sp-border);
    flex-wrap: wrap;
}
.sp-meta-item { display: flex; align-items: center; gap: 0.3rem; }
.sp-meta svg { width: 12px; height: 12px; opacity: 0.7; flex-shrink: 0; }
.sp-meta-sep { opacity: 0.3; }

.sp-author-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--sp-border);
    flex-shrink: 0;
}
.sp-author-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Article content ── */
.sp-content {
    font-size: 0.975rem;
    line-height: 1.75;
    color: var(--sp-text);
}
.sp-content > * + * { margin-top: 1.1em; }

.sp-content h1,
.sp-content h2,
.sp-content h3,
.sp-content h4,
.sp-content h5,
.sp-content h6 {
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--sp-text);
    margin-top: 1.75em;
    margin-bottom: 0.5em;
}
.sp-content h2 { font-size: 1.35rem; }
.sp-content h3 { font-size: 1.15rem; }
.sp-content h4 { font-size: 1rem; }

.sp-content p { margin-top: 0; margin-bottom: 1.1em; }

.sp-content a {
    color: var(--sp-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s;
}
.sp-content a:hover { color: var(--sp-accent-dark); }

.sp-content ul,
.sp-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.4em;
}
.sp-content li { margin-bottom: 0.4em; }
.sp-content li::marker { color: var(--sp-accent); }

.sp-content blockquote {
    margin: 1.8em 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--sp-accent);
    background: var(--sp-card-bg);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--sp-text-muted);
    font-size: 1.05rem;
}
.sp-content blockquote cite {
    display: block;
    margin-top: 0.5em;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 700;
    color: var(--sp-text-light);
}

.sp-content pre {
    background: var(--sp-code-bg);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--sp-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 1.8em 0;
}
.sp-content code {
    font-family: var(--sp-mono);
    font-size: 0.875em;
    background: var(--sp-code-bg);
    border: 1px solid var(--sp-border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: var(--sp-accent);
}
.sp-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--sp-text);
    font-size: inherit;
}

.sp-content hr {
    border: none;
    border-top: 1px solid var(--sp-border);
    margin: 2.5em 0;
}

.sp-content figure { margin: 1.8em 0; }
.sp-content figure img { border-radius: 10px; border: 1px solid var(--sp-border); }
.sp-content figcaption {
    margin-top: 0.5em;
    font-size: 0.8rem;
    text-align: center;
    color: var(--sp-text-light);
}

.sp-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 1.8em 0;
}
.sp-content th,
.sp-content td {
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--sp-border);
    text-align: left;
}
.sp-content th {
    background: var(--sp-card-bg);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Tags ── */
.sp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.75rem;
    padding-top: 1.125rem;
    border-top: 1px solid var(--sp-border);
}
.sp-tag {
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--sp-border);
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-text-muted);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.sp-tag:hover { border-color: var(--sp-accent); color: var(--sp-accent); }

/* ── Share buttons ── */
.sp-share {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--sp-card-bg);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.sp-share-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sp-text-muted);
    margin-right: 0.2rem;
}
.sp-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.12s;
}
.sp-share-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.sp-share-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.sp-share-btn.twitter  { background: #1d9bf0; color: #fff; }
.sp-share-btn.telegram { background: #2aabee; color: #fff; }
.sp-share-btn.copy     { background: var(--sp-border); color: var(--sp-text-muted); }

/* ── Post navigation ── */
.sp-postnav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sp-border);
}
.sp-postnav-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.sp-postnav-item:hover { border-color: var(--sp-accent); background: var(--sp-card-bg); }
.sp-postnav-item.prev { align-items: flex-start; }
.sp-postnav-item.next { align-items: flex-end; text-align: right; }
.sp-postnav-dir {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sp-text-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.sp-postnav-dir svg { width: 10px; height: 10px; }
.sp-postnav-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sp-text);
    line-height: 1.35;
}

/* ── Comments ── */
.sp-comments {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--sp-border);
}
.sp-comments-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sp-comments-title::before {
    content: '';
    width: 3px;
    height: 1em;
    background: var(--sp-accent);
    border-radius: 2px;
    display: inline-block;
}

/* Comment list */
.comment-list { list-style: none; }
.comment { padding: 1rem 0; border-bottom: 1px solid var(--sp-border); }
.comment-author { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.comment-author img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--sp-border); }
.comment-author .fn { font-weight: 700; font-size: 0.85rem; }
.comment-author .says { display: none; }
.comment-meta { font-size: 0.68rem; color: var(--sp-text-light); margin-bottom: 0.4rem; }
.comment-content p { font-size: 0.9rem; color: var(--sp-text-muted); }
.reply a { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sp-accent); }

/* Comment form */
.comment-respond { margin-top: 1.5rem; }
.comment-respond h3 { font-size: 0.9rem; font-weight: 800; margin-bottom: 1rem; }
.comment-form label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-text-muted);
    margin-bottom: 0.3rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    background: var(--sp-card-bg);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-family: var(--sp-font);
    font-size: 0.9rem;
    color: var(--sp-text);
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 0.75rem;
}
.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--sp-accent); }
.comment-form textarea { min-height: 100px; resize: vertical; }
.comment-form p.form-submit { margin-top: 0.375rem; }
.comment-form input[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    background: var(--sp-accent);
    color: #fff;
    border: none;
    font-family: var(--sp-font);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}
.comment-form input[type="submit"]:hover {
    background: var(--sp-accent-dark);
    transform: translateY(-1px);
}

/* ── Footer ── */
.sp-footer {
    text-align: center;
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--sp-border);
    font-size: 0.7rem;
    color: var(--sp-text-light);
    font-weight: 600;
    letter-spacing: 0.06em;
}
.sp-footer a { color: var(--sp-text-light); }
.sp-footer a:hover { color: var(--sp-accent); }

/* ── Animations ── */
@keyframes rainbowShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.8); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .sp-postnav { grid-template-columns: 1fr; }
    .sp-postnav-item.next { align-items: flex-start; text-align: left; }
    .sp-meta { gap: 0.5rem; }
    .sp-share { flex-direction: column; align-items: flex-start; }
}
