/* ===========================
   BASE
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&family=Share+Tech+Mono&family=Cinzel:wght@400;600&display=swap');

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

body {
    background: #0a0a0a;
    color: #c8c8c8;
    font-family: 'Rajdhani', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-x: hidden;
    position: relative;
}

/* Grain overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
    opacity: 0.35;
    animation: staticShift 0.1s steps(1) infinite;
}

@keyframes staticShift {
    0%   { transform: translate(0, 0); }
    10%  { transform: translate(-1px, 1px); }
    20%  { transform: translate(1px, -1px); }
    30%  { transform: translate(-1px, 0); }
    40%  { transform: translate(1px, 1px); }
    50%  { transform: translate(0, -1px); }
    60%  { transform: translate(-1px, 1px); }
    70%  { transform: translate(0, 1px); }
    80%  { transform: translate(1px, 0); }
    90%  { transform: translate(-1px, -1px); }
    100% { transform: translate(0, 0); }
}

/* Scanlines */
.scanlines {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.07) 2px,
        rgba(0, 0, 0, 0.07) 4px
    );
    pointer-events: none;
    z-index: 999;
}

::selection {
    background: #333;
    color: #e8e8e8;
}

/* ===========================
   BOOT SEQUENCE
   =========================== */

#boot-screen {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#boot-screen.boot-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.boot-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.88em;
    line-height: 2.4;
    color: #555;
    letter-spacing: 0.1em;
}

.boot-text p {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ===========================
   MAIN CONTAINER
   =========================== */

#monitor {
    width: 100%;
    max-width: 720px;
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 3px;
    padding: 40px;
    position: relative;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}

#monitor.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Internal scanline element unused — we use the fixed overlay instead */
#scanline {
    display: none;
}

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

header {
    margin-bottom: 28px;
}

h1 {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2em;
    font-weight: 400;
    color: #d0d0d0;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    position: relative;
}

/* Glitch — re-enabled for dark theme */
.glitch {
    position: relative;
}

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

.glitch::before {
    color: #666;
    animation: glitchTop 7s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 38%, 0 38%);
}

.glitch::after {
    color: #2d2d2d;
    animation: glitchBot 7s infinite;
    clip-path: polygon(0 62%, 100% 62%, 100% 100%, 0 100%);
}

@keyframes glitchTop {
    0%, 91%, 100% { transform: translate(0); opacity: 0; }
    92%  { transform: translate(-3px, 0); opacity: 0.7; }
    93%  { transform: translate(2px, 0); opacity: 0.5; }
    94%  { opacity: 0; }
}

@keyframes glitchBot {
    0%, 93%, 100% { transform: translate(0); opacity: 0; }
    94%  { transform: translate(3px, 0); opacity: 0.6; }
    95%  { transform: translate(-2px, 0); opacity: 0.35; }
    96%  { opacity: 0; }
}

.subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78em;
    color: #3a3a3a;
    letter-spacing: 0.18em;
    font-style: normal;
    opacity: 1;
}

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

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #1a1a1a;
}

nav a {
    font-family: 'Share Tech Mono', monospace;
    color: #3a3a3a;
    text-decoration: none;
    font-size: 0.76em;
    padding: 5px 12px;
    border: 1px solid transparent;
    letter-spacing: 0.15em;
    transition: color 0.2s ease, border-color 0.2s ease;
}

nav a:hover {
    color: #aaa;
    border-color: #2a2a2a;
}

nav a.nav-active {
    color: #c8c8c8;
    border-color: #333;
}

/* ===========================
   CONTENT BOXES
   =========================== */

.content-box {
    background: rgba(13, 13, 13, 0.95);
    border: 1px solid #1e1e1e;
    border-radius: 2px;
    padding: 22px;
    margin-bottom: 14px;
    transition: border-color 0.3s ease;
}

.content-box:hover {
    border-color: #2a2a2a;
}

.content-box h2 {
    font-family: 'Share Tech Mono', monospace;
    color: #484848;
    font-size: 0.76em;
    font-weight: 400;
    margin-bottom: 14px;
    letter-spacing: 0.38em;
    text-transform: uppercase;
}

.content-box p {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 6px;
    color: #808080;
}

/* ===========================
   TERMINAL LOG
   =========================== */

.terminal-log {
    font-size: 0.9em;
}

.log-entries p {
    margin-bottom: 6px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.83em;
    color: #484848;
}

.log-time {
    color: #333;
}

.status-green {
    color: #22c55e;
}

.status-amber {
    color: #f59e0b;
}

.log-current {
    color: #666 !important;
}

/* ===========================
   CURSOR
   =========================== */

.cursor {
    color: #484848;
}

.cursor.blink {
    animation: blink 1s step-end infinite;
}

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

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

footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #1a1a1a;
}

.footer-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7em;
    color: #272727;
    text-align: center;
    letter-spacing: 0.1em;
}

/* ===========================
   PROFILE IMAGE
   =========================== */

.profile-image-section {
    padding: 0;
    overflow: hidden;
}

.profile-glitch-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.profile-img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    object-position: center top;
    filter: grayscale(40%) brightness(0.65) contrast(1.1);
    transition: filter 0.3s ease;
}

.profile-glitch-wrap:hover .profile-img {
    animation: img-glitch 0.4s steps(2) infinite;
}

.profile-glitch-wrap::before,
.profile-glitch-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.profile-glitch-wrap:hover::before {
    opacity: 0.45;
    background: url('profile-img.png') center/cover;
    animation: glitch-layer-1 0.3s steps(2) infinite;
    mix-blend-mode: screen;
}

.profile-glitch-wrap:hover::after {
    opacity: 0.35;
    background: url('profile-img.png') center/cover;
    animation: glitch-layer-2 0.3s steps(2) infinite;
    mix-blend-mode: multiply;
}

@keyframes img-glitch {
    0%   { filter: grayscale(40%) brightness(0.65); transform: translate(0); }
    20%  { filter: grayscale(70%) brightness(0.45); transform: translate(-2px, 1px); }
    40%  { filter: grayscale(20%) brightness(0.75); transform: translate(2px, -1px); }
    60%  { filter: grayscale(55%) brightness(0.55); transform: translate(1px, 2px); }
    80%  { filter: grayscale(30%) brightness(0.70); transform: translate(-1px, -2px); }
    100% { filter: grayscale(40%) brightness(0.65); transform: translate(0); }
}

@keyframes glitch-layer-1 {
    0%   { clip-path: inset(20% 0 60% 0); transform: translate(-4px, 0); }
    25%  { clip-path: inset(50% 0 10% 0); transform: translate(3px, 0); }
    50%  { clip-path: inset(10% 0 70% 0); transform: translate(-2px, 0); }
    75%  { clip-path: inset(70% 0 5% 0);  transform: translate(4px, 0); }
    100% { clip-path: inset(30% 0 40% 0); transform: translate(-3px, 0); }
}

@keyframes glitch-layer-2 {
    0%   { clip-path: inset(60% 0 10% 0); transform: translate(3px, 0); }
    25%  { clip-path: inset(5% 0 50% 0);  transform: translate(-4px, 0); }
    50%  { clip-path: inset(40% 0 20% 0); transform: translate(2px, 0); }
    75%  { clip-path: inset(15% 0 60% 0); transform: translate(-3px, 0); }
    100% { clip-path: inset(50% 0 20% 0); transform: translate(3px, 0); }
}

/* ===========================
   LINK GRID (profile page)
   =========================== */

.link-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.link-card {
    display: block;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid #1e1e1e;
    border-radius: 2px;
    padding: 16px;
    text-decoration: none;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.link-card:hover {
    border-color: #3a3a3a;
    background: rgba(22, 22, 22, 0.95);
}

.link-name {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    color: #c0c0c0;
    font-weight: 400;
    font-size: 0.85em;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.link-desc {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    color: #484848;
    font-size: 0.82em;
    font-weight: 400;
}

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

.universe-block {
    margin-bottom: 14px;
    padding: 22px;
    background: rgba(11, 11, 11, 0.98);
    border: 1px solid #1e1e1e;
    border-radius: 2px;
    transition: border-color 0.3s ease;
}

.universe-block:hover {
    border-color: #2a2a2a;
}

.universe-icon {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid #2a2a2a;
    flex: 0 0 auto;
    margin-bottom: 10px;
    filter: grayscale(40%) brightness(0.7);
}

.universe-titles {
    margin-bottom: 14px;
}

.universe-titles h2 {
    font-family: 'Share Tech Mono', monospace;
    color: #777;
    font-size: 0.82em;
    font-weight: 400;
    letter-spacing: 0.3em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.universe-sub {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72em;
    color: #333;
    letter-spacing: 0.15em;
}

.universe-desc {
    background: rgba(8, 8, 8, 0.9);
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.universe-desc p {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #606060;
}

/* Character grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.character-card {
    background: rgba(11, 11, 11, 0.95);
    border: 1px solid #1e1e1e;
    border-radius: 2px;
    overflow: hidden;
    transition: border-color 0.3s ease, transform 0.25s ease;
}

.character-card:hover {
    border-color: #3a3a3a;
    transform: translateY(-3px);
}

.character-image-link {
    display: block;
    overflow: hidden;
}

.character-card img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    filter: grayscale(35%) brightness(0.7) contrast(1.05);
    transition: filter 0.35s ease, transform 0.35s ease;
}

.character-card:hover img {
    filter: grayscale(0%) brightness(0.9) contrast(1.05);
    transform: scale(1.04);
}

.character-meta {
    padding: 12px 14px 14px;
}

.character-name {
    display: inline-block;
    font-family: 'Share Tech Mono', monospace;
    color: #999;
    text-decoration: none;
    font-size: 0.82em;
    letter-spacing: 0.08em;
    transition: color 0.2s ease;
}

.character-name:hover {
    color: #e0e0e0;
}

.character-tagline {
    margin-top: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.78em;
    color: #3d3d3d;
    line-height: 1.4;
}

/* ===========================
   WORLDS HUB
   =========================== */

.worlds-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.world-portal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(11, 11, 11, 0.95);
    border: 1px solid #1e1e1e;
    border-radius: 2px;
    padding: 30px 20px;
    text-decoration: none;
    text-align: center;
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.25s ease;
}

.world-portal:hover {
    border-color: #3a3a3a;
    background: rgba(18, 18, 18, 0.98);
    transform: translateY(-2px);
}

.world-portal-name {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    color: #999;
    font-size: 0.88em;
    letter-spacing: 0.3em;
    transition: color 0.2s ease;
}

.world-portal:hover .world-portal-name {
    color: #d0d0d0;
}

.world-portal-enter {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    color: #2d2d2d;
    font-size: 0.68em;
    letter-spacing: 0.2em;
}

/* Placeholder world — dimmed, not interactive */
.world-portal-placeholder {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}

/* ===========================
   WORLD SUBPAGES — BACK LINK
   =========================== */

.world-back-link {
    display: inline-block;
    font-family: 'Share Tech Mono', monospace;
    color: #333;
    text-decoration: none;
    font-size: 0.76em;
    letter-spacing: 0.2em;
    margin-bottom: 18px;
    padding: 4px 8px;
    border: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.world-back-link:hover {
    color: #888;
    border-color: #2a2a2a;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 600px) {
    body {
        padding: 16px 12px;
    }

    #monitor {
        padding: 24px 18px;
    }

    h1 {
        font-size: 1em;
    }

    nav {
        gap: 4px;
    }

    nav a {
        font-size: 0.72em;
        padding: 4px 8px;
    }

    .worlds-grid {
        grid-template-columns: 1fr;
    }

    .character-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .character-card img {
        height: 180px;
    }
}

@media (max-width: 400px) {
    .character-grid {
        grid-template-columns: 1fr;
    }

    .character-card img {
        height: 240px;
    }
}