/* ==========================================================================
   qDotNet Ghost Theme
   A dark, modern theme matching qDotNet website design
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables & Reset
   -------------------------------------------------------------------------- */
:root {
    --bg: #0a0a0a;
    --fg: #ffffff;
    --muted: #666666;
    --accent: #ff3d00;
    --accent-dark: #cc3100;
    --line: #222222;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    --max-width: 1400px;
    --max-width-narrow: 720px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   2. Base Styles
   -------------------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--line);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* --------------------------------------------------------------------------
   3. Animated Background
   -------------------------------------------------------------------------- */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(rgba(255, 61, 0, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 61, 0, .04) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.bg-dots {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image: radial-gradient(circle, rgba(255, 61, 0, .15) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.bg-lines {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    opacity: .3;
    pointer-events: none;
}

.bg-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 61, 0, .4), transparent);
    animation: lineMove 8s linear infinite;
}

.bg-line:nth-child(1) { top: 20%; width: 100%; animation-delay: 0s; }
.bg-line:nth-child(2) { top: 40%; width: 80%; left: 10%; animation-delay: 2s; }
.bg-line:nth-child(3) { top: 60%; width: 60%; left: 20%; animation-delay: 4s; }
.bg-line:nth-child(4) { top: 80%; width: 90%; left: 5%; animation-delay: 6s; }

@keyframes lineMove {
    0% { transform: translateX(-100%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(100vw); opacity: 0; }
}

.bg-noise {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: .025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

@media (min-width: 768px) {
    .container {
        padding: 0 48px;
    }
}

.container-narrow {
    max-width: var(--max-width-narrow);
}

.main {
    min-height: 50vh;
}

/* --------------------------------------------------------------------------
   5. Navigation
   -------------------------------------------------------------------------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 24px 0;
    background: linear-gradient(to bottom, var(--bg) 50%, transparent);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg);
    text-decoration: none;
    transition: color .15s ease;
}

.logo:hover {
    color: var(--accent);
}

.logo span {
    color: var(--accent);
}

.nav-links {
    display: none;
    gap: 32px;
    align-items: center;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-link {
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color .15s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--fg);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width .2s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-cta {
    padding: 8px 20px;
    background: var(--accent);
    color: var(--bg);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform .15s ease, background .15s ease;
}

.nav-cta:hover {
    background: var(--fg);
    transform: translateY(-2px);
}

/* Mobile Menu Button */
.menu-btn {
    display: block;
    width: 24px;
    height: 20px;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
}

@media (min-width: 768px) {
    .menu-btn {
        display: none;
    }
}

.menu-btn span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--fg);
    transition: transform .2s ease, opacity .2s ease;
}

.menu-btn span:nth-child(1) { top: 0; }
.menu-btn span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.menu-btn span:nth-child(3) { bottom: 0; }

.menu-btn.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.menu-btn.active span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 99;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu a {
    font-size: 32px;
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
    text-transform: uppercase;
}

.mobile-menu a:hover {
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   6. Hero Section
   -------------------------------------------------------------------------- */
.hero {
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 140px 0 80px;
}

.hero h1 {
    font-size: clamp(48px, 10vw, 96px);
    font-weight: 900;
    line-height: .9;
    letter-spacing: -0.04em;
}

.hero p {
    max-width: 480px;
    font-size: 18px;
    color: var(--muted);
    margin-top: 24px;
}

.section-label {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.archive-count {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--muted);
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all .15s ease;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--fg);
    transform: translateY(-3px);
}

.btn-secondary {
    background: transparent;
    color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--line);
}

.btn-secondary:hover {
    box-shadow: inset 0 0 0 1px var(--accent);
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   8. Blog Section
   -------------------------------------------------------------------------- */
.blog-section {
    padding: 0 0 120px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1px;
    background: var(--line);
}

@media (max-width: 400px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

.blog-card {
    background: var(--bg);
    transition: background .2s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    background: #111;
}

.blog-card-link {
    padding: 40px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.blog-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.blog-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
    transition: color .2s ease;
}

.blog-card:hover .blog-title {
    color: var(--accent);
}

.blog-excerpt {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
    flex-grow: 1;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.blog-tag {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.blog-read {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color .2s ease;
}

.blog-card:hover .blog-read {
    color: var(--fg);
}

/* No Posts */
.no-posts {
    text-align: center;
    padding: 80px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   9. Post Single
   -------------------------------------------------------------------------- */
.post {
    padding-bottom: 80px;
}

.post-header {
    padding: 140px 0 60px;
}

.post-tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    margin-bottom: 24px;
}

.post-tag:hover {
    color: var(--fg);
}

.post-title {
    font-size: clamp(32px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 24px;
}

.post-meta {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
}

.post-meta-separator {
    margin: 0 8px;
}

.post-feature-image {
    margin: 0 0 60px;
    width: 100%;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Post Content */
.post-content {
    font-size: 18px;
    line-height: 1.8;
}

.post-content > * + * {
    margin-top: 1.5em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2em;
}

.post-content h1 { font-size: 2em; }
.post-content h2 { font-size: 1.75em; }
.post-content h3 { font-size: 1.5em; }
.post-content h4 { font-size: 1.25em; }

.post-content p {
    color: var(--muted);
}

.post-content strong,
.post-content b {
    color: var(--fg);
    font-weight: 600;
}

.post-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .15s ease;
}

.post-content a:hover {
    border-color: var(--accent);
}

.post-content ul,
.post-content ol {
    padding-left: 1.5em;
    color: var(--muted);
}

.post-content li + li {
    margin-top: 0.5em;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 24px;
    margin: 2em 0;
    font-style: italic;
    color: var(--fg);
}

.post-content code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--line);
    padding: 2px 6px;
    border-radius: 3px;
}

.post-content pre {
    background: var(--line);
    padding: 24px;
    overflow-x: auto;
    border-radius: 4px;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.post-content figcaption {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-top: 12px;
}

.post-content hr {
    border: none;
    height: 1px;
    background: var(--line);
    margin: 3em 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
}

.post-content th,
.post-content td {
    padding: 12px;
    border: 1px solid var(--line);
    text-align: left;
}

.post-content th {
    font-weight: 600;
    background: var(--line);
}

/* Post Footer */
.post-footer {
    padding: 48px 0;
    margin-top: 64px;
    border-top: 1px solid var(--line);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.post-tag-link {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    transition: color .15s ease;
}

.post-tag-link:hover {
    color: var(--accent);
}

.post-share {
    display: flex;
    align-items: center;
    gap: 16px;
}

.post-share-label {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-share-link {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--fg);
    text-decoration: none;
    transition: color .15s ease;
}

.post-share-link:hover {
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   10. Page Template
   -------------------------------------------------------------------------- */
.page-header {
    padding: 140px 0 60px;
}

.page-title {
    font-size: clamp(32px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.page-content {
    font-size: 18px;
    line-height: 1.8;
    padding-bottom: 80px;
}

.page-content > * + * {
    margin-top: 1.5em;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2em;
}

.page-content p {
    color: var(--muted);
}

.page-content a {
    color: var(--accent);
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   11. Post Navigation
   -------------------------------------------------------------------------- */
.post-navigation {
    padding: 64px 0;
    border-top: 1px solid var(--line);
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 600px) {
    .post-nav {
        grid-template-columns: 1fr;
    }
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--line);
    text-decoration: none;
    transition: border-color .2s ease, background .2s ease;
}

.post-nav-link:hover {
    border-color: var(--accent);
    background: #111;
}

.post-nav-prev {
    text-align: right;
}

.post-nav-label {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.post-nav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--fg);
}

/* --------------------------------------------------------------------------
   12. Related Posts
   -------------------------------------------------------------------------- */
.related-posts {
    padding: 80px 0;
    background: #111;
}

.related-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 48px;
}

/* --------------------------------------------------------------------------
   13. Pagination
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 64px;
}

.page-btn {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--fg);
    font-family: inherit;
    font-size: 14px;
    text-decoration: none;
    transition: all .15s ease;
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.page-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.footer {
    padding: 48px 0;
    border-top: 1px solid var(--line);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-copy {
    font-size: 14px;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color .15s ease;
}

.footer-link:hover {
    color: var(--fg);
}

/* --------------------------------------------------------------------------
   15. Error Page
   -------------------------------------------------------------------------- */
.hero-error {
    text-align: center;
    min-height: 70vh;
}

.error-code {
    font-size: clamp(80px, 20vw, 200px);
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 24px;
}

.hero-error h1 {
    font-size: clamp(24px, 5vw, 48px);
}

.hero-error .btn {
    margin-top: 48px;
}

/* --------------------------------------------------------------------------
   16. Koenig Editor Cards
   -------------------------------------------------------------------------- */
.kg-card {
    margin: 2em 0;
}

.kg-image-card img {
    width: 100%;
    height: auto;
}

.kg-gallery-container {
    display: grid;
    gap: 1px;
}

.kg-gallery-row {
    display: grid;
    gap: 1px;
}

.kg-bookmark-card {
    background: var(--line);
    border-radius: 4px;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-content {
    flex: 1;
    padding: 24px;
}

.kg-bookmark-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.kg-bookmark-description {
    font-size: 14px;
    color: var(--muted);
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-family: var(--mono);
    font-size: 12px;
}

.kg-bookmark-thumbnail {
    width: 120px;
    min-height: 120px;
    object-fit: cover;
}

.kg-button-card {
    display: flex;
    gap: 16px;
}

.kg-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: var(--bg);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
}

.kg-callout-card {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: var(--line);
    border-radius: 4px;
}

.kg-callout-emoji {
    font-size: 24px;
    line-height: 1;
}

/* --------------------------------------------------------------------------
   17. Koenig Image Width Options - REQUIRED
   -------------------------------------------------------------------------- */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
}

.kg-width-wide img {
    width: 100%;
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.kg-width-full img {
    width: 100%;
    border-radius: 0;
}

/* --------------------------------------------------------------------------
   18. Members & Subscribe
   -------------------------------------------------------------------------- */
.subscribe-form {
    max-width: 500px;
    margin: 0 auto;
    padding: 48px 0;
}

.subscribe-form-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.subscribe-form-description {
    color: var(--muted);
    text-align: center;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--fg);
    font-family: inherit;
    font-size: 16px;
    transition: border-color .15s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   19. Utilities
   -------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --------------------------------------------------------------------------
   20. Author Profile
   -------------------------------------------------------------------------- */
.author-profile {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 48px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-top: 64px;
}

.author-profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-profile-content {
    flex: 1;
}

.author-profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.author-profile-bio {
    color: var(--muted);
    font-size: 15px;
}
