/* ============================================================
   theme.css — Sankalan Data System
   Shared across all pages: reset, variables, topnav, sidebar,
   breadcrumbs, author box, share bar, footer, back-to-top.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

:root {
    --navy: #1d3557; --navy-dark: #142544; --navy-light: #2c5282;
    --gold: #DAA520; --gold-dark: #b8831a; --gold-light: #fff9e6;
    --blue: #0056b3;
    --bg-primary: #f0f6ff; --bg-secondary: #f7f9fc;
    --bg-code: #1d3557;
    --text-primary: #1a1a1a; --text-body: #334155; --text-muted: #6b7280;
    --border: #e6ecf3; --border-gold: #f0e0a8;
    --radius: 14px;
    --shadow-sm: 0 2px 8px rgba(29,53,87,0.06);
    --shadow-md: 0 8px 24px rgba(29,53,87,0.08);
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
    --sidebar-width: 320px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 17px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
body.sidebar-open { overflow: hidden; }
img { max-width: 100%; display: block; height: auto; }
a { text-decoration: none; color: inherit; }
code, pre { font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace; }
button { font-family: inherit; }

/* ---------- Top navigation ---------- */
.topnav {
    position: sticky; top: 0; z-index: 1100;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(230,236,243,0.9);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.topnav-inner {
    max-width: 1440px; margin: 0 auto;
    display: flex; align-items: center; gap: 14px; padding: 12px 20px;
}
.hamburger {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; width: 42px; height: 42px; padding: 0;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border: none; border-radius: 10px; cursor: pointer;
    box-shadow: 0 4px 10px rgba(29,53,87,0.2);
    transition: all var(--transition); flex-shrink: 0;
}
.hamburger:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(29,53,87,0.3); }
.hamburger:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hamburger span {
    display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
body.sidebar-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sidebar-open .hamburger span:nth-child(2) { opacity: 0; }
body.sidebar-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.brand {
    font-size: 1.15rem; font-weight: 800; color: var(--navy);
    letter-spacing: -0.3px; white-space: nowrap;
    display: flex; align-items: center; gap: 8px;
}
.brand span { color: var(--gold); }
.brand-tag {
    font-size: 0.72rem; font-weight: 700; color: var(--gold);
    background: var(--gold-light); border: 1px solid var(--border-gold);
    padding: 2px 8px; border-radius: 10px;
    letter-spacing: 0.5px; text-transform: uppercase; display: none;
}
@media (min-width: 640px) { .brand-tag { display: inline-block; } }

.nav-links { display: none; gap: 4px; align-items: center; list-style: none; margin-left: auto; flex-wrap: wrap; }
.nav-links > li > a {
    display: inline-block; padding: 8px 14px; color: var(--navy);
    font-size: 0.96rem; font-weight: 600; border-radius: 8px; transition: all var(--transition);
}
.nav-links > li > a:hover { background: rgba(218,165,32,0.12); color: var(--blue); transform: translateY(-1px); }
@media (min-width: 1200px) { .nav-links { display: flex; } }

.nav-cta {
    margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; font-size: 0.9rem; font-weight: 700;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #fff; border-radius: 10px;
    box-shadow: 0 4px 12px rgba(218,165,32,0.25);
    transition: all var(--transition); flex-shrink: 0;
}
.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(218,165,32,0.35); }
@media (min-width: 1200px) { .nav-cta { margin-left: 12px; } }

/* ---------- Sidebar ---------- */
.sidebar-overlay {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(10, 25, 41, 0.55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

.sidebar {
    position: fixed; top: 0; left: 0; z-index: 1300;
    width: var(--sidebar-width); max-width: 88vw; height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 40px rgba(29,53,87,0.15);
    overflow-y: auto; transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}
body.sidebar-open .sidebar { transform: translateX(0); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #d1d9e6; border-radius: 3px; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: #fff; z-index: 2;
}
.sidebar-header h2 { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.sidebar-header h2::before { content: '🐘'; font-size: 1.2rem; }
.sidebar-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
    color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; line-height: 1; transition: all var(--transition);
}
.sidebar-close:hover { background: rgba(255,255,255,0.25); transform: rotate(90deg); }
.sidebar-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.sidebar-body { padding: 20px 18px 32px; flex: 1; }
.sidebar .subtitle {
    color: #8B6914; font-size: 0.88rem; margin-bottom: 16px;
    font-weight: 600; padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-gold);
}
.sidebar ul { list-style: none; }
.sidebar a {
    display: block; padding: 10px 12px; color: var(--navy);
    font-size: 0.95rem; border-radius: 8px; margin-bottom: 2px;
    transition: all var(--transition); line-height: 1.45;
}
.sidebar a:hover, .sidebar a:focus-visible {
    color: var(--blue); padding-left: 16px;
    background: linear-gradient(90deg, rgba(218,165,32,0.08) 0%, rgba(218,165,32,0.02) 100%);
    border-left: 3px solid var(--gold); outline: none;
}
.sidebar a.active {
    background: rgba(218,165,32,0.10); color: var(--blue);
    border-left: 3px solid var(--gold); font-weight: 700;
}
.sidebar-contact { margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--border); }
.sidebar-contact h3 { color: var(--navy); font-size: 0.95rem; margin-bottom: 8px; font-weight: 700; }
.sidebar-contact a { border-bottom: none; color: var(--blue); padding: 6px 0; word-break: break-all; font-size: 0.94rem; }
.sidebar-contact a:hover { padding-left: 0; background: none; border-left: none; text-decoration: underline; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
    max-width: 1360px; margin: 0 auto; padding: 18px 24px 0;
    font-size: 0.9rem; color: var(--text-muted);
}
.breadcrumbs a { color: var(--blue); font-weight: 600; }
.breadcrumbs a:hover { color: var(--gold); }
.breadcrumbs .sep { margin: 0 8px; color: #ccc; }
.breadcrumbs .current { color: var(--navy); font-weight: 700; }

/* ---------- Author box ---------- */
.author-section {
    max-width: 1360px; margin: 20px auto 0; padding: 20px 26px;
    background: linear-gradient(135deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border); border-radius: 14px;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.author-avatar-large {
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--gold); display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(29,53,87,0.2);
    font-weight: 800; letter-spacing: 0.5px;
}
.author-info { flex: 1; min-width: 220px; }
.author-name {
    font-weight: 800; color: var(--navy); font-size: 1.05rem;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.verified-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e8f5e9; color: #2e7d32; padding: 2px 8px;
    border-radius: 10px; font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.author-title { font-size: 0.9rem; color: var(--text-muted); margin: 4px 0 6px; }
.author-bio-text { font-size: 0.94rem; color: var(--text-body); line-height: 1.65; }
.author-credentials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cred-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #f0f6ff 0%, #e0eefa 100%);
    border: 1px solid #d0e0f0; color: var(--navy);
    border-radius: 20px; font-size: 0.78rem; font-weight: 700;
    letter-spacing: 0.2px; transition: all var(--transition);
}
.cred-badge:hover {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #fff; border-color: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(218,165,32,0.25);
}

/* ---------- Share bar ---------- */
.share-section {
    max-width: 1360px; margin: 20px auto 0; padding: 18px 26px;
    background: linear-gradient(135deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border); border-radius: 14px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.share-label {
    font-size: 0.94rem; font-weight: 700; color: var(--navy);
    display: flex; align-items: center; gap: 6px;
}
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 15px; font-size: 0.86rem; font-weight: 700;
    border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--text-body);
    transition: all var(--transition);
}
.share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.share-twitter:hover  { background: #1da1f2; color: #fff; border-color: #1da1f2; }
.share-linkedin:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.share-facebook:hover { background: #1877f2; color: #fff; border-color: #1877f2; }
.share-whatsapp:hover { background: #25d366; color: #fff; border-color: #25d366; }
.share-reddit:hover   { background: #ff4500; color: #fff; border-color: #ff4500; }
.share-telegram:hover { background: #0088cc; color: #fff; border-color: #0088cc; }
.share-copy:hover     { background: var(--gold); color: #fff; border-color: var(--gold); }

/* ---------- Back to top ---------- */
.back-top {
    position: fixed; bottom: 30px; right: 30px;
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #fff; border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 8px 24px rgba(218,165,32,0.4);
    opacity: 0; pointer-events: none;
    transition: all var(--transition); z-index: 999;
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(218,165,32,0.5); }

/* ---------- Footer ---------- */
.site-footer {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: #cbd5e0; padding: 40px 24px 30px; margin-top: 80px;
    text-align: center; font-size: 0.92rem; position: relative;
}
.site-footer::before {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%); width: 60px; height: 3px;
    background: var(--gold); border-radius: 2px;
}
.site-footer p { margin: 6px 0; }
.site-footer strong { color: var(--gold); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .sidebar { transition: none; }
    body.sidebar-open .hamburger span { transition: none; }
}