/*
Theme Name: Gate of Latency
Theme URI: https://kurenaihanabooks.com
Author: Kazivier
Author URI: https://kurenaihanabooks.com
Description: A dark, arcane WordPress theme themed with flag colors (magenta, pink, white, gold, red) and featuring an animated spell circle that follows the cursor.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gate-of-latency
Tags: dark, custom-background, custom-menu, featured-images, threaded-comments
*/

/* ================================================================
   CSS CUSTOM PROPERTIES — FLAG PALETTE
   Left→Right vertical stripes: Magenta · Pink · White · Gold · Red
   ================================================================ */

:root {
    /* Flag colours */
    --magenta:   #d6368b;
    --pink:      #f2a1c4;
    --white:     #f5f0f0;
    --gold:      #d4a017;
    --red:       #c0272d;

    /* Derived palette */
    --bg-deep:       #0c0a10;
    --bg-surface:    #15121c;
    --bg-card:       #1c1726;
    --border-subtle: #2a2235;
    --text-primary:  var(--white);
    --text-muted:    #9a8fac;
    --accent:        var(--magenta);
    --accent-hover:  var(--pink);
    --link:          var(--gold);
    --link-hover:    var(--red);

    /* Typography */
    --font-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
    --font-heading: 'Cinzel', Georgia, serif;
    --font-body:    'Cormorant Garamond', 'Garamond', Georgia, serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 5rem;

    /* Sizing */
    --content-width: 860px;
    --wide-width: 1140px;
}


/* ================================================================
   RESET & BASE
   ================================================================ */

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

html {
    font-size: 18px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
    background-color: var(--bg-deep);
    overflow-x: hidden;
    min-height: 100vh;
}


/* ================================================================
   FLAG GRADIENT STRIPE — left-edge accent
   ================================================================ */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 5px;
    height: 100vh;
    z-index: 9999;
    background: linear-gradient(
        to bottom,
        var(--magenta)  0%,
        var(--magenta)  20%,
        var(--pink)     20%,
        var(--pink)     40%,
        var(--white)    40%,
        var(--white)    60%,
        var(--gold)     60%,
        var(--gold)     80%,
        var(--red)      80%,
        var(--red)      100%
    );
    pointer-events: none;
}

/* Subtle top-edge gradient bar */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 9999;
    background: linear-gradient(
        to right,
        var(--magenta),
        var(--pink),
        var(--white),
        var(--gold),
        var(--red)
    );
    pointer-events: none;
}


/* ================================================================
   BACKGROUND TEXTURE — arcane atmosphere
   ================================================================ */

.site-wrapper {
    position: relative;
    min-height: 100vh;
}

.site-wrapper::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(214,54,139,0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(212,160,23,0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(192,39,45,0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}


/* ================================================================
   LINKS
   ================================================================ */

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover, a:focus {
    color: var(--link-hover);
    text-shadow: 0 0 8px rgba(192,39,45,0.4);
}


/* ================================================================
   TYPOGRAPHY
   ================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--white);
    letter-spacing: 0.02em;
}

h1 { font-size: 2.4rem; margin-bottom: var(--space-lg); }
h2 { font-size: 1.8rem; margin-bottom: var(--space-md); }
h3 { font-size: 1.4rem; margin-bottom: var(--space-md); }
h4 { font-size: 1.15rem; margin-bottom: var(--space-sm); }

p  { margin-bottom: var(--space-md); }
ul, ol { margin-bottom: var(--space-md); padding-left: var(--space-lg); }
li { margin-bottom: var(--space-xs); }

blockquote {
    border-left: 3px solid var(--magenta);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    font-style: italic;
    color: var(--pink);
    background: rgba(214,54,139,0.05);
    border-radius: 0 6px 6px 0;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--gold);
}

pre {
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    margin-bottom: var(--space-lg);
}

pre code {
    background: none;
    padding: 0;
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--magenta), var(--gold), transparent);
    margin: var(--space-xl) 0;
}

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


/* ================================================================
   LAYOUT
   ================================================================ */

.site-content {
    position: relative;
    z-index: 1;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-lg) var(--space-lg);
}

.site-content.has-sidebar {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-xl);
    max-width: var(--wide-width);
}

@media (max-width: 900px) {
    .site-content.has-sidebar {
        grid-template-columns: 1fr;
    }
}


/* ================================================================
   HEADER
   ================================================================ */

.site-header {
    position: relative;
    z-index: 100;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(12,10,16,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
}

.site-branding {}

.site-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.06em;
    margin: 0;
}

.site-title a {
    color: var(--white);
    text-decoration: none;
    background: linear-gradient(90deg, var(--magenta), var(--pink), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-description {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 2px;
}


/* ================================================================
   NAVIGATION
   ================================================================ */

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: var(--space-lg);
    margin: 0;
    padding: 0;
}

.main-navigation a {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 4px;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(to right, var(--magenta), var(--gold));
    transition: width 0.3s ease;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    color: var(--white);
    text-shadow: none;
}

.main-navigation a:hover::after,
.main-navigation .current-menu-item > a::after,
.main-navigation .current_page_item > a::after {
    width: 100%;
}

/* Sub-menus */
.main-navigation li { position: relative; }

.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: var(--space-sm) 0;
    min-width: 200px;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 200;
}

.main-navigation li:hover > ul {
    display: flex;
}

.main-navigation ul ul a {
    padding: var(--space-sm) var(--space-md);
    display: block;
    white-space: nowrap;
}

.main-navigation ul ul a::after { display: none; }

/* Mobile toggle */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: var(--space-lg);
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 6px;
        padding: var(--space-sm) 0;
        min-width: 220px;
        box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    }

    .main-navigation.toggled ul { display: flex; }

    .main-navigation ul a {
        padding: var(--space-sm) var(--space-md);
        display: block;
    }

    .main-navigation ul ul {
        position: static;
        border: none;
        box-shadow: none;
        padding-left: var(--space-md);
    }
}


/* ================================================================
   POSTS & ENTRIES
   ================================================================ */

.entry {
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
}

.entry:last-child {
    border-bottom: none;
}

.entry-header { margin-bottom: var(--space-lg); }

.entry-title {
    font-family: var(--font-heading);
    font-size: 2rem;
}

.entry-title a {
    color: var(--white);
}

.entry-title a:hover {
    color: var(--gold);
}

.entry-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
}

.entry-meta a { color: var(--pink); }
.entry-meta a:hover { color: var(--magenta); }

.entry-meta .sep {
    color: var(--border-subtle);
}

.entry-thumbnail {
    margin-bottom: var(--space-lg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.entry-thumbnail img {
    display: block;
    width: 100%;
    border-radius: 0;
}

.entry-content {
    font-size: 1rem;
    line-height: 1.8;
}

.entry-content > *:last-child { margin-bottom: 0; }

.entry-footer {
    margin-top: var(--space-lg);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.entry-footer a { color: var(--gold); }

/* Tag / category pills */
.tag-links a,
.cat-links a {
    display: inline-block;
    padding: 2px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 0.72rem;
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
    margin-right: 4px;
    margin-bottom: 4px;
    transition: border-color 0.3s, background 0.3s;
}

.tag-links a:hover,
.cat-links a:hover {
    border-color: var(--magenta);
    background: rgba(214,54,139,0.1);
}


/* ================================================================
   SINGLE POST
   ================================================================ */

.single .entry-title {
    font-size: 2.4rem;
    text-align: center;
}

.single .entry-meta {
    justify-content: center;
    margin-bottom: var(--space-lg);
}


/* ================================================================
   PAGE
   ================================================================ */

.page-header {
    margin-bottom: var(--space-xl);
    text-align: center;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    background: linear-gradient(90deg, var(--magenta), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ================================================================
   SIDEBAR / WIDGETS
   ================================================================ */

.widget-area {}

.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.widget-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

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

.widget li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid rgba(42,34,53,0.5);
}

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

.widget a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.widget a:hover {
    color: var(--magenta);
}


/* ================================================================
   COMMENTS
   ================================================================ */

.comments-area {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
}

.comments-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: var(--space-lg);
}

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

.comment-body {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.comment-author img {
    border-radius: 50%;
    border: 2px solid var(--magenta);
}

.comment-author .fn {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--pink);
}

.comment-metadata {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-content { font-size: 0.95rem; }

.comment-reply-link {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold);
}

/* Comment form */
.comment-respond { margin-top: var(--space-xl); }

.comment-form label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: block;
    margin-bottom: var(--space-xs);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    margin-bottom: var(--space-md);
    transition: border-color 0.3s;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--magenta);
    box-shadow: 0 0 0 2px rgba(214,54,139,0.15);
}

.comment-form .submit {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--magenta), var(--red));
    color: var(--white);
    border: none;
    padding: var(--space-sm) var(--space-xl);
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
}

.comment-form .submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}


/* ================================================================
   PAGINATION
   ================================================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin: var(--space-xl) 0;
    font-family: var(--font-heading);
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 var(--space-sm);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.3s;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    border-color: var(--magenta);
    color: var(--white);
    background: rgba(214,54,139,0.1);
}


/* ================================================================
   FOOTER
   ================================================================ */

.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border-subtle);
    background: rgba(12,10,16,0.6);
    padding: var(--space-xl) var(--space-lg);
    margin-top: var(--space-2xl);
}

.site-footer__inner {
    max-width: var(--wide-width);
    margin: 0 auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-footer a { color: var(--gold); }
.site-footer a:hover { color: var(--magenta); }

.footer-flag-bar {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: var(--space-lg);
}

.footer-flag-bar span {
    display: block;
    width: 28px;
    height: 4px;
    border-radius: 2px;
}

.footer-flag-bar .f-magenta { background: var(--magenta); }
.footer-flag-bar .f-pink    { background: var(--pink); }
.footer-flag-bar .f-white   { background: var(--white); }
.footer-flag-bar .f-gold    { background: var(--gold); }
.footer-flag-bar .f-red     { background: var(--red); }


/* ================================================================
   SPELL CIRCLE CURSOR FOLLOWER
   ================================================================ */

#spell-circle-follower {
    position: fixed;
    width: 120px;
    height: 120px;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    opacity: 0.6;
    transition: opacity 0.4s ease;
    will-change: left, top;
}

#spell-circle-follower img {
    width: 100%;
    height: 100%;
    animation: spell-spin 12s linear infinite;
}

@keyframes spell-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Hide on touch devices by default — it's a cursor effect */
@media (hover: none) and (pointer: coarse) {
    #spell-circle-follower { display: none; }
}


/* ================================================================
   SEARCH FORM
   ================================================================ */

.search-form {
    display: flex;
    gap: var(--space-sm);
}

.search-form .search-field {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.search-form .search-field:focus {
    outline: none;
    border-color: var(--magenta);
}

.search-form .search-submit {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
}

.search-form .search-submit:hover {
    border-color: var(--magenta);
    color: var(--white);
}


/* ================================================================
   404
   ================================================================ */

.error-404 {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.error-404 h1 {
    font-family: var(--font-display);
    font-size: 4rem;
    background: linear-gradient(90deg, var(--magenta), var(--pink), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ================================================================
   UTILITY
   ================================================================ */

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

.alignleft   { float: left; margin-right: var(--space-lg); margin-bottom: var(--space-md); }
.alignright  { float: right; margin-left: var(--space-lg); margin-bottom: var(--space-md); }
.aligncenter { display: block; margin-left: auto; margin-right: auto; margin-bottom: var(--space-md); }

.wp-caption {
    max-width: 100%;
    margin-bottom: var(--space-md);
}

.wp-caption-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--space-xs);
}

/* Gutenberg block alignment */
.alignwide {
    max-width: var(--wide-width);
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}
