/* ============================================================
   style.css — viewpag
   Visual values intentionally match the original design.
   ============================================================ */


/* ── Fonts ── */
@font-face {
    font-family: "JM";
    src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "JM";
    src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}


/* ── Cursor art ── */
:root {
    --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Ccircle cx='6' cy='6' r='4' fill='%23111113' stroke='%23ffffff' stroke-width='1.5'/%3E%3C/svg%3E") 6 6, auto;
    --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Ccircle cx='6' cy='6' r='4' fill='%23111113' stroke='%23ffffff' stroke-width='1.5'/%3E%3Ccircle cx='6' cy='6' r='1.5' fill='%23ffffff'/%3E%3C/svg%3E") 6 6, pointer;
}


/* ── Animation ── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes itemIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes unavailablePulse {
    0%,
    100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

@keyframes signal-blink {
    0%,
    100% {
        opacity: 0.25;
    }
    50% {
        opacity: 1;
    }
}

@keyframes signal-sweep {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes glitch-top {
    0%,
    92%,
    100% {
        opacity: 0;
        transform: translate(0, 0);
    }
    93% {
        opacity: 0.8;
        transform: translate(-2px, -1px);
    }
    95% {
        opacity: 0.8;
        transform: translate(2px, 0);
    }
    97% {
        opacity: 0;
    }
}

@keyframes glitch-bottom {
    0%,
    88%,
    100% {
        opacity: 0;
        transform: translate(0, 0);
    }
    89% {
        opacity: 0.7;
        transform: translate(2px, 1px);
    }
    91% {
        opacity: 0.7;
        transform: translate(-2px, 0);
    }
    93% {
        opacity: 0;
    }
}

@keyframes sheet-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


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

::selection {
    background: var(--text);
    color: var(--bg);
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 999px;
}

:focus-visible {
    outline: 1.5px solid var(--muted);
    outline-offset: 3px;
    border-radius: 10px;
}


/* ── Variables: dark (default) ── */
:root {
    --bg: #0e0e0f;
    --surface: #161618;
    --border: #2a2a2e;
    --text: #e8e8e8;
    --muted: #77777f;
    --highlight: #ffffff;
    --hover-bg: #1c1c1f;
    --hover-bd: #4a4a52;
    --footer: #383840;
    --mono: "JM", "Courier New", monospace;
    --radius: 10px;
    --max-width: 520px;
    --trans: 0.2s ease;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --backdrop: rgb(0 0 0 / 0.62);
    --shadow: 0 24px 60px rgb(0 0 0 / 0.45);
    --glitch-a: #b9b9c2;
    --glitch-b: #4a4a52;
}


/* ── Variables: light ── */
:root.light {
    --bg: #f4f4f5;
    --surface: #ffffff;
    --border: #e2e2e5;
    --text: #1a1a1a;
    --muted: #888892;
    --highlight: #000000;
    --hover-bg: #f0f0f2;
    --hover-bd: #c0c0c8;
    --footer: #b0b0b8;
    --backdrop: rgb(14 14 15 / 0.28);
    --shadow: 0 24px 60px rgb(14 14 15 / 0.18);
    --glitch-a: #6a6a74;
    --glitch-b: #c8c8d0;
}


/* ── Transitions ── */
body,
a,
button,
.port-card,
.link-icon,
.social-pill,
.sheet-close,
.to-top {
    transition:
        background-color var(--trans),
        border-color var(--trans),
        color var(--trans),
        opacity var(--trans),
        transform var(--trans);
}


/* ── Noscript warning ── */
.noscript-warn {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 2px solid var(--muted);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    margin: 0.75rem auto;
    max-width: var(--max-width);
}


/* ── Body ── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1.25rem;
    overscroll-behavior-y: contain;
    cursor: var(--cursor-default);
}

a,
button,
[role="button"] {
    cursor: var(--cursor-pointer);
}


/* ── Card / page wrapper ── */
.card {
    width: 100%;
    max-width: var(--max-width);
    margin-block: auto;
    display: flex;
    flex-direction: column;
    gap: 1.85rem;
    animation: fadeIn 0.3s ease;
}


/* ── Theme toggle ── */
.toggle-btn {
    position: fixed;
    top: 1.1rem;
    right: 1.1rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--muted);
}

.toggle-btn:hover {
    border-color: var(--hover-bd);
    color: var(--text);
}


/* ── Menu button ── */
.menu-btn {
    position: fixed;
    top: 1.1rem;
    right: 3.6rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--muted);
}

.menu-btn:hover {
    border-color: var(--hover-bd);
    color: var(--text);
}


/* ── Divider ── */
.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--border) 20%,
        var(--border) 80%,
        transparent
    );
}


/* ── Section label ── */
.section-label {
    font-size: 0.65rem;
    color: var(--text);
    font-weight: 600;
    opacity: 0.65;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}


/* ── Footer ── */
.footer {
    font-size: 0.62rem;
    color: var(--footer);
    text-align: center;
    letter-spacing: 0.06em;
    padding-top: 0.25rem;
}


/* ── Header ── */
.handle {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
    font-weight: bolder;
}

.name {
    font-size: clamp(2rem, 8vw, 2.75rem);
    font-weight: 700;
    color: var(--highlight);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.subheading {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.4rem;
    letter-spacing: 0.03em;
    font-weight: bolder;
}

.pgp {
    font-size: 0.58rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    margin-top: 0.3rem;
    display: block;
    opacity: 0.4;
}


/* ── Intro ── */
.intro {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.8;
}

.intro strong {
    color: var(--text);
    font-weight: 500;
}


/* ── Social pills ── */
.socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.social-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.social-pill:hover {
    border-color: var(--hover-bd);
    color: var(--text);
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.pill-icon {
    width: 12px;
    height: 12px;
    opacity: 0.55;
    transition:
        opacity var(--trans),
        transform var(--trans);
}

.social-pill:hover .pill-icon {
    opacity: 1;
    transform: translateY(-1px);
}


/* ── Profile link rows ── */
.links {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 2px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}

.link-item:hover {
    border-color: var(--hover-bd);
    border-left-color: var(--highlight);
    background: var(--hover-bg);
    transform: translateX(2px);
}

.link-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.link-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    flex-shrink: 0;
}

.link-icon img {
    width: 16px;
    height: 16px;
    opacity: 0.5;
    transition: opacity var(--trans);
}

.link-item:hover .link-icon img {
    opacity: 1;
}

.link-info {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.link-name {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--text);
}

.link-handle {
    font-size: 0.68rem;
    color: var(--muted);
}

.link-arrow {
    color: var(--border);
    font-size: 0.9rem;
    transition:
        color var(--trans),
        transform var(--trans);
}

.link-item:hover .link-arrow {
    color: var(--muted);
    transform: translateX(2px);
}


/* ── Sub-page cards ── */
.port-grid {
    display: block;
    columns: 2;
    column-gap: 0.45rem;
}

.port-card {
    display: flex;
    break-inside: avoid;
    margin-bottom: 0.45rem;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}

.port-card:hover {
    border-color: var(--hover-bd);
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.port-title {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--text);
}

.port-desc {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.15rem;
}


/* ── Disabled cards ── */
.port-card[data-unavailable] {
    opacity: 0.48;
    border-style: dashed;
    background: transparent;
    cursor: not-allowed;
}

.port-card[data-unavailable]:hover {
    border-color: var(--border);
    background: transparent;
    transform: none;
}

.port-card[data-unavailable] .port-title {
    color: var(--muted);
}

.port-card[data-unavailable]::after {
    content: attr(data-unavailable);
    margin-top: 0.4rem;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    animation: unavailablePulse 2.4s ease-in-out infinite;
}


/* ── Staggered entrance ── */
.social-pill,
.link-item,
.port-card {
    animation: itemIn 0.32s var(--ease-out) backwards;
}

.socials .social-pill:nth-child(2) {
    animation-delay: 0.04s;
}

.socials .social-pill:nth-child(3) {
    animation-delay: 0.08s;
}

.links .link-item:nth-child(2) {
    animation-delay: 0.04s;
}

.links .link-item:nth-child(3) {
    animation-delay: 0.08s;
}

.port-grid .port-card:nth-child(2) {
    animation-delay: 0.04s;
}

.port-grid .port-card:nth-child(3) {
    animation-delay: 0.08s;
}


/* ── Contact sheet ── */
.sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    padding: 1.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sheet:target {
    display: flex;
}

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.18s ease both;
}

.sheet-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
    margin: auto;
    padding: 1.15rem 1.15rem 1.05rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    animation: sheet-in 0.28s var(--ease-out) both;
}

.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.sheet-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--highlight);
    letter-spacing: -0.01em;
}

.sheet-copy {
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 0.9rem;
}

.sheet-links {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sheet-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1;
}

.sheet-close:hover {
    color: var(--text);
    border-color: var(--hover-bd);
    background: var(--hover-bg);
    transform: rotate(90deg);
}

.sheet-foot {
    margin-top: 0.9rem;
    font-size: 0.58rem;
    color: var(--footer);
    letter-spacing: 0.06em;
}


/* ── Back to top ── */
.to-top {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 40;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.95rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
}

.to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.to-top:hover {
    border-color: var(--hover-bd);
    color: var(--text);
    transform: translateY(-2px);
}


/* ── Scroll progress indicator ── */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--highlight);
    width: 0%;
    z-index: 100;
    pointer-events: none;
}


/* ── 404 page ── */
.card--center {
    justify-content: center;
    min-height: 60vh;
}

.subheading--mt {
    margin-top: 0.75rem;
}

.name--sm {
    font-size: clamp(1.5rem, 6vw, 2rem);
}

.glitch {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.glitch::before {
    color: var(--glitch-a);
    clip-path: inset(0 0 54% 0);
    animation: glitch-top 5s steps(1) infinite;
}

.glitch::after {
    color: var(--glitch-b);
    clip-path: inset(54% 0 0 0);
    animation: glitch-bottom 5s steps(1) infinite;
}

.signal {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.95rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.signal-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.signal-dots {
    display: inline-flex;
    gap: 3px;
}

.signal-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    animation: signal-blink 1.8s ease-in-out infinite;
}

.signal-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.signal-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.signal-code {
    margin-left: auto;
    font-size: 0.55rem;
    color: var(--footer);
    letter-spacing: 0.08em;
}

.signal-bar {
    height: 2px;
    overflow: hidden;
    background: var(--border);
    border-radius: 999px;
}

.signal-bar span {
    display: block;
    width: 45%;
    height: 100%;
    background: var(--muted);
    opacity: 0.8;
    animation: signal-sweep 3.2s ease-in-out infinite;
}

.error-copy {
    max-width: 44ch;
    font-size: 0.82rem;
    line-height: 1.75;
    color: var(--muted);
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.error-actions .btn:first-child {
    color: var(--text);
}

.diagnostics {
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 0.68rem;
}

.diagnostics summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    list-style: none;
    color: var(--muted);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.diagnostics summary::-webkit-details-marker {
    display: none;
}

.diagnostics summary::before {
    content: "+";
    color: var(--footer);
    transition: color var(--trans);
}

.diagnostics[open] summary::before {
    content: "−";
    color: var(--text);
}

.diagnostics summary:hover {
    color: var(--text);
}

.diagnostics dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.9rem;
    margin-top: 0.65rem;
    color: var(--muted);
}

.diagnostics dt {
    color: var(--footer);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}



/* ── Back / action button (blends with theme) ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.78rem;
    font-family: var(--mono);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.btn:hover {
    border-color: var(--hover-bd);
    background: var(--hover-bg);
    color: var(--highlight);
    opacity: 1;
}


/* ── Mobile ── */
@media (max-width: 400px) {
    .link-item,
    .port-card {
        padding: 0.75rem 0.85rem;
    }

    .social-pill {
        font-size: 0.65rem;
        padding: 0.32rem 0.75rem;
    }

    .sheet {
        padding: 0.75rem;
    }

    .sheet-panel {
        padding: 1rem;
    }

    .signal-code {
        font-size: 0.5rem;
    }
}


/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
