/* ==========================================================================
   555n.net — Global Styles
   Machine intelligence aesthetic. Dark, immersive, terminal.
   ========================================================================== */

/* --- DESIGN TOKENS --- */
:root {
    /* Palette */
    --bg: #030303;
    --bg-elevated: #0a0a0a;
    --bg-surface: #111111;
    --text: #c8c8c8;
    --text-dim: #666666;
    --text-bright: #e0e0e0;
    --accent: #00ff00;
    --accent-dim: rgba(0, 255, 0, 0.4);
    --accent-glow: rgba(0, 255, 0, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    --scan: rgba(0, 255, 0, 0.3);
    --hud: #3a5a3a;

    /* Typography */
    --font-mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', monospace;
    --font-display: 'IBM Plex Mono', monospace;
    --fs-hero: clamp(3rem, 10vw, 8rem);
    --fs-section: clamp(2rem, 6vw, 5rem);
    --fs-heading: clamp(1.2rem, 3vw, 2rem);
    --fs-body: clamp(0.85rem, 1.2vw, 1rem);
    --fs-meta: clamp(0.65rem, 0.9vw, 0.8rem);
    --fs-hud: 0.6rem;
    --lh-body: 1.6;
    --ls-wide: 0.15em;
    --ls-ultra: 0.3em;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
    --gutter: clamp(1rem, 4vw, 3rem);

    /* Z-index scale */
    --z-bg: 1;
    --z-content: 10;
    --z-hud: 100;
    --z-overlay: 500;
    --z-player: 800;
    --z-modal: 1000;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 600ms;
    --duration-page: 800ms;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    line-height: var(--lh-body);
    overflow-x: hidden;
    cursor: crosshair;
    min-height: 100svh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text);
    text-decoration: none;
    cursor: crosshair;
}

button {
    font-family: var(--font-mono);
    cursor: crosshair;
    border: none;
    background: none;
    color: var(--text);
}

img {
    display: block;
    max-width: 100%;
}

/* --- SCANLINE OVERLAY --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-hud);
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    opacity: 0.5;
}

/* Animated scan line */
.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--scan);
    z-index: var(--z-hud);
    animation: scan 6s linear infinite;
    opacity: 0;
    pointer-events: none;
}

@keyframes scan {
    0% { transform: translateY(-10vh); opacity: 0; }
    5% { opacity: 0.6; }
    95% { opacity: 0.6; }
    100% { transform: translateY(110vh); opacity: 0; }
}

/* --- HUD NAVIGATION --- */
.hud-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100svh;
    pointer-events: none;
    z-index: var(--z-hud);
    padding: var(--gutter);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-logo {
    pointer-events: auto;
    font-size: var(--fs-meta);
    font-weight: 500;
    letter-spacing: var(--ls-ultra);
    text-transform: uppercase;
    color: var(--text-bright);
    border-left: 2px solid var(--accent);
    padding-left: var(--space-sm);
    line-height: 1.4;
    transition: color var(--duration-normal) var(--ease-out);
}

.hud-logo:hover {
    color: var(--accent);
}

.hud-logo .version {
    display: block;
    font-size: var(--fs-hud);
    color: var(--hud);
    letter-spacing: var(--ls-wide);
    margin-top: 2px;
}

.hud-links {
    display: flex;
    gap: var(--space-md);
    pointer-events: auto;
}

.hud-link {
    font-size: var(--fs-hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--hud);
    padding: var(--space-xs) 0;
    position: relative;
    transition: color var(--duration-normal) var(--ease-out);
}

.hud-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--duration-normal) var(--ease-out);
}

.hud-link:hover,
.hud-link.active {
    color: var(--text-bright);
}

.hud-link:hover::after,
.hud-link.active::after {
    width: 100%;
}

.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.hud-status {
    font-size: var(--fs-hud);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    line-height: 1.6;
}

.hud-status .accent {
    color: var(--accent);
}

.hud-coords {
    font-size: var(--fs-hud);
    color: var(--hud);
    text-align: right;
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
}

/* --- MOBILE NAV TOGGLE --- */
.hud-menu-toggle {
    display: none;
    pointer-events: auto;
    font-size: var(--fs-meta);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    padding: var(--space-xs);
    border: 1px solid var(--border);
    transition: all var(--duration-normal) var(--ease-out);
}

.hud-menu-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- SITE SECTIONS (single-scroll layout) --- */
.site-section {
    position: relative;
    z-index: var(--z-content);
    scroll-margin-top: var(--gutter);
}

.site-section:not(.hero-section) {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--border);
}

.section-inner {
    padding: 0 var(--gutter);
    max-width: 1200px;
    margin: 0 auto;
}

/* --- SECTION TYPOGRAPHY --- */
.section-label {
    font-size: var(--fs-hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--accent);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.section-label::before {
    content: '//';
    color: var(--hud);
}

.section-title {
    font-size: var(--fs-section);
    font-weight: 300;
    letter-spacing: var(--ls-wide);
    color: var(--text-bright);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
}

.section-body {
    font-size: var(--fs-body);
    color: var(--text);
    max-width: 60ch;
    line-height: var(--lh-body);
}

.section-body p + p {
    margin-top: var(--space-sm);
}

/* --- HERO (Landing) --- */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100svh;
    text-align: center;
    padding: var(--space-xl) var(--gutter);
}

.hero-title {
    font-size: var(--fs-hero);
    font-weight: 300;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-bright);
    margin-bottom: var(--space-sm);
    line-height: 1;
}

.hero-sub {
    font-size: var(--fs-meta);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    margin-bottom: var(--space-lg);
}

.hero-prompt {
    font-size: var(--fs-body);
    color: var(--accent);
    letter-spacing: var(--ls-wide);
    animation: pulse-opacity 3s ease-in-out infinite;
}

.hero-prompt .cursor {
    animation: blink 0.7s step-end infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

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

/* --- CARD GRID --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: var(--space-md);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--duration-normal) var(--ease-out);
}

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-index {
    font-size: var(--fs-hud);
    color: var(--accent);
    letter-spacing: var(--ls-ultra);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
}

.card-title {
    font-size: var(--fs-body);
    color: var(--text-bright);
    font-weight: 500;
    margin-bottom: var(--space-xs);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
}

.card-desc {
    font-size: var(--fs-meta);
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: var(--space-sm);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-hud);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
}

.card-action {
    display: inline-block;
    font-size: var(--fs-hud);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    border-bottom: 1px solid transparent;
    transition: border-color var(--duration-normal) var(--ease-out);
}

.card:hover .card-action {
    border-bottom-color: var(--accent);
}

/* --- APPLET OVERLAY --- */
.applet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    background: var(--bg);
    display: none;
    flex-direction: column;
}

.applet-overlay.active {
    display: flex;
}

.applet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.applet-title {
    font-size: var(--fs-hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--hud);
}

.applet-close {
    font-size: var(--fs-body);
    color: var(--hud);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    transition: all var(--duration-fast) var(--ease-out);
}

.applet-close:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.applet-frame {
    flex: 1;
    border: none;
    width: 100%;
    height: 100%;
}

/* --- GALLERY PLACEHOLDER --- */
.gallery-viewport {
    position: relative;
    width: 100%;
    height: calc(100svh - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    overflow: hidden;
}

.gallery-placeholder {
    text-align: center;
}

.gallery-placeholder-text {
    font-size: var(--fs-heading);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    animation: pulse-opacity 3s ease-in-out infinite;
}

.gallery-viewport .scanlines-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 255, 0, 0.03) 3px,
        rgba(0, 255, 0, 0.03) 6px
    );
}

/* --- MUSIC SECTION --- */
.album-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.album-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    transition: border-color var(--duration-normal) var(--ease-out);
}

.album-item:hover {
    border-color: var(--border-hover);
}

.album-art {
    width: 120px;
    height: 120px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-hud);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
}

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

.album-title {
    font-size: var(--fs-body);
    color: var(--text-bright);
    font-weight: 500;
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.album-meta {
    font-size: var(--fs-hud);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    margin-bottom: var(--space-sm);
}

.track-list {
    list-style: none;
}

.track-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-meta);
    color: var(--text-dim);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out);
}

.track-item:hover {
    color: var(--text-bright);
}

.track-item:last-child {
    border-bottom: none;
}

.track-item.playing,
.track-item.paused {
    color: var(--text-bright);
}

.track-item.playing .track-duration::before {
    content: '\25B6\00a0\00a0';
    color: var(--accent);
}

.track-item.paused .track-duration::before {
    content: '\275A\275A\00a0\00a0';
    color: var(--accent);
}

.track-item.preview .track-name::after {
    content: 'preview';
    font-size: var(--fs-hud);
    color: var(--hud);
    border: 1px solid var(--border);
    padding: 1px 5px;
    margin-left: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
}

.track-num {
    color: var(--accent);
    width: 2em;
    flex-shrink: 0;
}

.track-name {
    flex: 1;
}

.track-duration {
    color: var(--hud);
    margin-left: var(--space-sm);
}

.streaming-links {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.stream-link {
    font-size: var(--fs-hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--hud);
    border: 1px solid var(--border);
    padding: 4px 10px;
    transition: all var(--duration-normal) var(--ease-out);
}

.stream-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- CONTACT --- */
.contact-form {
    max-width: 500px;
    margin-top: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: var(--fs-hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--hud);
}

.form-input,
.form-textarea {
    font-family: var(--font-mono);
    font-size: var(--fs-meta);
    color: var(--text-bright);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: var(--space-xs) var(--space-sm);
    outline: none;
    transition: border-color var(--duration-normal) var(--ease-out);
    cursor: crosshair;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--accent);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-submit {
    font-size: var(--fs-meta);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    color: var(--bg);
    background: var(--accent);
    border: 1px solid var(--accent);
    padding: var(--space-xs) var(--space-md);
    transition: all var(--duration-normal) var(--ease-out);
    align-self: flex-start;
}

.form-submit:hover {
    background: transparent;
    color: var(--accent);
}

/* --- AUDIO DRAWER --- */
.audio-drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    max-width: 700px;
    width: 95%;
    background: rgba(5, 5, 5, 0.95);
    border: 1px solid var(--border);
    border-bottom: none;
    z-index: var(--z-player);
    transition: transform var(--duration-normal) var(--ease-out);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.audio-drawer.active {
    transform: translateX(-50%) translateY(0);
}

.audio-drawer-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    cursor: crosshair;
    user-select: none;
    font-size: var(--fs-hud);
    color: var(--hud);
    text-transform: uppercase;
    letter-spacing: var(--ls-ultra);
    opacity: 0.7;
    transition: opacity var(--duration-normal);
}

.audio-drawer-handle:hover {
    opacity: 1;
}

.audio-drawer-handle .chevron {
    display: inline-block;
    transition: transform var(--duration-normal) var(--ease-out);
}

.audio-drawer.expanded .audio-drawer-handle .chevron {
    transform: rotate(180deg);
}

.audio-progress {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    cursor: crosshair;
    position: relative;
}

.audio-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--accent);
    pointer-events: none;
    transition: width 100ms linear;
}

.audio-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--space-sm);
}

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

.audio-info .album {
    font-size: 7px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.audio-info .track {
    font-size: var(--fs-meta);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.audio-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all var(--duration-fast) var(--ease-out);
}

.audio-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.audio-btn.play {
    width: 32px;
    height: 32px;
    border-color: var(--accent);
    color: var(--accent);
}

.audio-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.audio-volume-label {
    font-size: 7px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.audio-volume-slider {
    width: 50px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    cursor: crosshair;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border: none;
}

.audio-volume-slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border: none;
}

.audio-tracklist {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-slow) var(--ease-out);
    border-top: 1px solid transparent;
}

.audio-drawer.expanded .audio-tracklist {
    max-height: 250px;
    border-top-color: var(--border);
    overflow-y: auto;
}

.audio-tracklist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px var(--space-sm);
    font-size: var(--fs-meta);
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    transition: all var(--duration-fast) var(--ease-out);
    cursor: crosshair;
}

.audio-tracklist-item:hover {
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.02);
}

.audio-tracklist-item.playing {
    color: var(--accent);
}

.audio-tracklist-item:last-child {
    border-bottom: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .hud-links {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 60vw;
        max-width: 280px;
        height: 100svh;
        background: rgba(3, 3, 3, 0.97);
        border-left: 1px solid var(--border);
        flex-direction: column;
        padding: 5rem var(--gutter) var(--gutter);
        gap: var(--space-md);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .hud-links.open {
        display: flex;
    }

    .hud-menu-toggle {
        display: block;
    }

    .hud-link {
        font-size: var(--fs-meta);
    }

    .hud-bottom {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .hud-coords {
        text-align: left;
    }

    .album-item {
        flex-direction: column;
    }

    .album-art {
        width: 100%;
        height: 160px;
    }

    .audio-volume {
        display: none;
    }

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

    /* Fixed bottom readout collides with content on phones. */
    .hud-bottom {
        display: none;
    }

    /* 16px stops iOS Safari auto-zooming into fields. */
    .form-input,
    .form-textarea {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        letter-spacing: 0.1em;
    }

    .section-inner {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
}

/* --- UTILITY --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-accent {
    color: var(--accent);
}

.text-dim {
    color: var(--text-dim);
}

.text-hud {
    color: var(--hud);
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--hud);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
