/* ==========================================================================
   sweg Bio Page — Midnight Intelligence (Mobile-First)
   Typography: Syne (display) + Manrope (body)
   ========================================================================== */

:root {
    --midnight: #08090d;
    --surface: #0f1117;
    --surface-raised: #151820;
    --border: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(0, 212, 255, 0.15);

    --cyan: #00d4ff;
    --cyan-dim: rgba(0, 212, 255, 0.5);
    --cyan-glow: rgba(0, 212, 255, 0.08);
    --violet: #7c5cfc;
    --violet-glow: rgba(124, 92, 252, 0.12);

    --text: #e8eaed;
    --text-dim: #8b8fa3;
    --text-faint: #505368;

    --font-display: 'Syne', 'Helvetica Neue', sans-serif;
    --font-body: 'Manrope', 'Helvetica Neue', sans-serif;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--midnight);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
a, button { -webkit-tap-highlight-color: transparent; }

.nav-cta { min-height: 44px; }

.nav-links a,
.footer-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ==========================================================================
   Grid Background
   ========================================================================== */
.grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse 70% 50% at 50% 30%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 30%, black 20%, transparent 70%);
    opacity: 0.5;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 max(1rem, env(safe-area-inset-right));
    padding-left: max(1rem, env(safe-area-inset-left));
    transition: background 0.4s ease, border-color 0.4s ease;
    border-bottom: 1px solid transparent;
}

.nav.scrolled {
    background: rgba(8, 9, 13, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom-color: var(--border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2.2rem;
}

.nav-links a {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.3s ease;
}

.nav-links a:not(.nav-cta) { display: none; }

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

.nav-cta {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    padding: 0.4rem 1.2rem !important;
    border-radius: 8px;
    color: var(--text) !important;
    transition: border-color 0.3s ease, background 0.3s ease !important;
}

.nav-cta:hover {
    border-color: var(--border-glow) !important;
    background: var(--surface) !important;
}

/* ==========================================================================
   Back Link Bar
   ========================================================================== */
.back-bar {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4.5rem 1rem 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.3s ease, gap 0.3s var(--ease-out-quart);
}

.back-link:hover {
    color: var(--cyan);
    gap: 0.7rem;
}

/* ==========================================================================
   Bio Hero
   ========================================================================== */
.bio-hero {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.bio-hero-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Photo column */
.bio-photo-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.bio-photo {
    width: 160px;
    height: 160px;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.bio-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bio-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-faint);
}

.bio-social {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    transition: border-color 0.3s ease, color 0.3s ease;
}

.social-link:hover {
    border-color: var(--border-glow);
    color: var(--cyan);
}

/* Info column */
.bio-info-col {
    text-align: center;
}

.bio-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 0.75rem;
}

.bio-name {
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.bio-body {
    text-align: left;
}

.bio-body p {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

.bio-body p:last-child {
    margin-bottom: 0;
}

/* Highlights */
.bio-highlights {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.highlight {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.highlight-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.highlight-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

/* ==========================================================================
   Bio Quote
   ========================================================================== */
.bio-quote {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
    text-align: center;
}

.bio-quote blockquote {
    border: none;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    position: relative;
}

.bio-quote blockquote::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 0%, var(--violet-glow) 0%, transparent 60%);
    pointer-events: none;
}

.bio-quote blockquote p {
    position: relative;
    font-family: var(--font-display);
    font-size: clamp(1rem, 3vw, 1.35rem);
    font-weight: 500;
    font-style: italic;
    line-height: 1.6;
    color: var(--text);
}

/* ==========================================================================
   Related Leaders
   ========================================================================== */
.related {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
    border-top: 1px solid var(--border);
}

.section-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.section-title em {
    font-style: italic;
    font-weight: 700;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 0.05em 0.15em;
    display: inline-block;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.3s ease, transform 0.3s var(--ease-out-quart);
}

.related-card:hover {
    border-color: var(--border-glow);
    transform: translateX(4px);
}

.related-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.related-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-raised);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-faint);
}

.related-info {
    flex: 1;
    min-width: 0;
}

.related-info h3 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.related-info span {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.related-arrow {
    flex-shrink: 0;
    color: var(--text-faint);
    transition: color 0.3s ease, transform 0.3s var(--ease-out-quart);
}

.related-card:hover .related-arrow {
    color: var(--cyan);
    transform: translateX(3px);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--border);
    padding: 2rem max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.footer-logo .nav-icon {
    width: 22px;
    height: 22px;
}

.footer-copy {
    font-size: 0.72rem;
    color: var(--text-faint);
}

.footer-nav {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.footer-nav a {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.3s ease;
}

.footer-nav a:hover { color: var(--text); }

.footer-pgp {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.pgp-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.footer-pgp code {
    font-family: 'Manrope', monospace;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    word-break: break-all;
}

/* ==========================================================================
   Pull-to-Refresh (mobile)
   ========================================================================== */
.ptr {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: height 0.3s var(--ease-out-quart);
    perspective: 600px;
}

.ptr.ptr-active {
    transition: none;
}

.ptr-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 12px;
    opacity: var(--ptr-progress, 0);
    transform: scale(calc(0.3 + 0.7 * var(--ptr-progress, 0)));
    transform-style: preserve-3d;
    flex-shrink: 0;
}

.ptr-icon.flipping {
    opacity: 1;
    animation: ptrFlip 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes ptrFlip {
    0%   { transform: scale(1) rotateY(0deg); }
    100% { transform: scale(1) rotateY(360deg); }
}

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.related-grid .reveal:nth-child(1) { transition-delay: 0s; }
.related-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.related-grid .reveal:nth-child(3) { transition-delay: 0.16s; }

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes orbSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; }
    .ptr { display: none; }
}

@media (hover: none) {
    .nav-links a:hover { color: var(--text-dim); }
    .nav-cta:hover { border-color: var(--border) !important; background: var(--surface-raised) !important; }
    .social-link:hover { border-color: var(--border); color: var(--text-dim); }
    .related-card:hover { border-color: var(--border); transform: none; }
    .related-card:hover .related-arrow { color: var(--text-faint); transform: none; }
    .back-link:hover { color: var(--text-dim); gap: 0.5rem; }
    .footer-nav a:hover { color: var(--text-dim); }
}

/* ==========================================================================
   Responsive — min-width: 481px
   ========================================================================== */
@media (min-width: 481px) {
    .nav { padding: 0 max(1.5rem, env(safe-area-inset-right)); padding-left: max(1.5rem, env(safe-area-inset-left)); }
    .nav-inner { height: 64px; }
    .nav-brand { font-size: 1.1rem; }
    .ptr { top: 64px; }

    .back-bar { padding: 5rem 1.5rem 0; }

    .bio-hero { padding: 2.5rem 1.5rem 4rem; }
    .bio-photo { width: 200px; height: 200px; border-radius: 24px; }
    .bio-photo-placeholder { font-size: 3rem; }
    .bio-name { font-size: clamp(2.5rem, 6vw, 3.5rem); }

    .bio-highlights { grid-template-columns: repeat(3, 1fr); }

    .bio-quote { padding: 3rem 1.5rem 4rem; }
    .bio-quote blockquote { padding: 2.5rem; }
    .bio-quote blockquote p { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }

    .related { padding: 3rem 1.5rem 4rem; }
    .section-header { margin-bottom: 3rem; }

    .site-footer { padding: 3rem max(2rem, env(safe-area-inset-right)) max(3rem, env(safe-area-inset-bottom)); padding-left: max(2rem, env(safe-area-inset-left)); }
    .footer-brand { flex-direction: row; align-items: baseline; gap: 1.5rem; }
}

/* ==========================================================================
   Responsive — min-width: 769px
   ========================================================================== */
@media (min-width: 769px) {
    .nav-links a:not(.nav-cta) { display: inline-flex; }

    .back-bar { padding: 5.5rem 1.5rem 0; }

    .bio-hero-inner {
        grid-template-columns: auto 1fr;
        gap: 4rem;
        align-items: start;
    }

    .bio-photo-col { align-items: flex-start; position: sticky; top: 6rem; }
    .bio-info-col { text-align: left; }
    .bio-photo { width: 220px; height: 220px; }

    .related-grid { grid-template-columns: repeat(3, 1fr); }

    .section-title { font-size: clamp(2rem, 4vw, 3.2rem); }
    .section-label { font-size: 0.7rem; }

    .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; }
    .footer-nav { gap: 1.8rem; flex-wrap: nowrap; }
    .footer-pgp { align-items: flex-end; }
    .footer-pgp code { font-size: 0.68rem; word-break: normal; }
}

/* ==========================================================================
   Responsive — min-width: 1024px
   ========================================================================== */
@media (min-width: 1024px) {
    .nav { padding: 0 max(3rem, env(safe-area-inset-right)); padding-left: max(3rem, env(safe-area-inset-left)); }

    .back-bar { padding: 6rem 2rem 0; }

    .bio-hero { padding: 3rem 2rem 6rem; }
    .bio-hero-inner { gap: 5rem; }
    .bio-photo { width: 260px; height: 260px; }
    .bio-body p { font-size: 0.95rem; }

    .bio-quote { padding: 3rem 2rem 5rem; }

    .related { padding: 4rem 2rem 6rem; }
}
