/* ============================================================
   C.P. James — Shared Stylesheet
   ============================================================ */

/* ── Reset & Tokens ── */

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

:root {
    --primary: #0a0e27;
    --secondary: #141b35;
    --tertiary: #1a2647;
    --accent: #00d9ff;
    --accent-warm: #ff6b35;
    --text: #f0f4f8;
    --text-dim: #a0aac0;
    --border: rgba(0, 217, 255, 0.1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse 80% 80% at 50% 0%, rgba(0, 217, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ── Navigation ── */

nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    z-index: 1000;
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--accent);
    text-decoration: none;
}

.nav-links {
    display: none;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-links a:hover::after {
    width: 100%;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.mobile-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (min-width: 768px) {
    .mobile-toggle {
        display: none;
    }
}

.mobile-menu {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 2rem;
    display: none;
    flex-direction: column;
    gap: 1rem;
    z-index: 999;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.3s;
}

.mobile-menu a:hover {
    color: var(--accent);
}

/* ── Footer ── */

footer {
    background: var(--secondary);
    border-top: 1px solid var(--border);
    padding: 2.5rem 2rem 1.5rem;
    margin-top: 4rem;
    font-size: 0.9rem;
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-warm);
    margin-bottom: 1rem;
    font-weight: 700;
}

.footer-section a {
    display: block;
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: 1600px;
    margin: 0 auto;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.footer-tagline {
    font-style: italic;
    color: var(--accent-warm);
    margin-bottom: 0.5rem;
}

/* ── Social Icons ── */

.footer-social {
    display: flex;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0, 217, 255, 0.2);
    color: var(--accent);
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
    text-decoration: none;
}

.footer-social a:hover {
    color: var(--accent-warm);
    border-color: var(--accent-warm);
    background: rgba(255, 107, 53, 0.08);
    transform: translateY(-3px);
}

.footer-social svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

/* ── Blog / Essay Post Layout ── */

.post-wrapper {
    max-width: 780px;
    margin: 0 auto;
    padding: 7rem 2rem 5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2.5rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-warm);
}

.post-header {
    margin-bottom: 3rem;
    padding: 2rem 2rem 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.07), rgba(255, 107, 53, 0.07));
}

.post-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-warm);
    font-weight: 700;
    margin-bottom: 1rem;
}

.post-header h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.post-read-time {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.post-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-links {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-links h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-warm);
    font-weight: 700;
    margin-bottom: 1rem;
}

.post-links ul {
    list-style: none;
}

.post-links li {
    margin-bottom: 0.5rem;
}

.post-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.post-links a:hover {
    color: var(--accent-warm);
}

/* ── Inline Image Utilities ── */

.inline-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.inline-img.float-left {
    float: left;
    margin: 0.25rem 2rem 1.25rem 0;
    max-width: 280px;
}

.inline-img.float-right {
    float: right;
    margin: 0.25rem 0 1.25rem 2rem;
    max-width: 280px;
}

.inline-img.hero {
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    object-fit: cover;
    object-position: center top;
    margin-bottom: 2rem;
}

.inline-img.centered {
    margin: 1.5rem auto;
    max-width: 480px;
}

.inline-img-caption {
    display: block;
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 0.4rem;
    font-style: italic;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

@media (max-width: 600px) {
    .inline-img.float-left,
    .inline-img.float-right {
        float: none;
        max-width: 100%;
        margin: 0 0 1.25rem 0;
    }
}
