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

:root {
    --blue: #0C9DDE;
    --blue-dim: rgba(12,157,222,0.45);
    --blue-faint: rgba(12,157,222,0.12);
    --red: #EA141D;
    --muted: #9aa8b3;
    --bg: #071018;
    --text: #e6eef3;
    --tile-bg: rgba(7,16,24,0.96);
    --tile-border: rgba(12,157,222,0.2);
    --tile-hover: rgba(11,16,19,0.98);
    --radius: 12px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--mono);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── NAV ── */
#site-nav {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    z-index: 100;
}

#nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

#nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--blue);
    border-radius: 2px;
    transition: opacity 0.2s;
}

#nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    flex-direction: column;
    background: var(--tile-bg);
    border: 0.5px solid var(--tile-border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 160px;
}

#site-nav.open #nav-links { display: flex; }

#nav-links a {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    color: var(--muted);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    transition: color 0.15s, background 0.15s;
    border-bottom: 0.5px solid rgba(12,157,222,0.08);
}

#nav-links a:last-child { border-bottom: none; }
#nav-links a:hover { color: var(--blue); background: var(--blue-faint); }
#nav-links a[aria-current="page"] { color: var(--blue); }

/* ── HERO ── */
#hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    min-height: 20vh;
}

#logo-wrap {
    width: min(520px, 88vw);
    margin-bottom: 0.75rem;
}

#logo-wrap img {
    width: 100%;
    height: auto;
}

/* Fallback text logo if image not loaded */
#logo-text {
    font-family: var(--sans);
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 0.08em;
    display: none;
}

.hero-sub {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

/* ── MAIN CONTENT ── */
#main {
    background: rgba(7,16,24,0.97);
    border-top: 1px solid rgba(12,157,222,0.15);
    padding: 0 0 4rem;
}

/* ── FILTER BAR ── */
#filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 1.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid rgba(12,157,222,0.12);
}

.filter-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    padding: 5px 14px;
    border-radius: 20px;
    border: 0.5px solid var(--tile-border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}
.filter-btn:hover { border-color: var(--blue-dim); color: var(--blue); }
.filter-btn.active {
    background: var(--blue-faint);
    border-color: var(--blue-dim);
    color: var(--blue);
}

/* ── SECTIONS ── */
.section {
    padding: 0 1.5rem;
}

.section-header {
    font-size: 0.68rem;
    letter-spacing: 0.28em;
    color: rgba(12,157,222,0.9);
    padding: 1.75rem 0 0.75rem;
    font-family: var(--mono);
    border-bottom: 1px solid rgba(12,157,222,0.15);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header::before {
    content: "//";
    color: var(--blue-dim);
}

/* ── TILE GRID ── */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 1120px) {
    .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .tile-grid { grid-template-columns: 1fr; }
    #filters { padding: 1rem 1rem 0.5rem; }
    .section { padding: 0 1rem; }
    #hero { padding: 2rem 1rem 1.5rem; }
}

/* ── TILE STACK ── */
.tile-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tile-stack .tile {
    flex: 1;
}

.tile-grid > .tile-compact {
    align-self: start;
}

@media (max-width: 560px) {
    .tile-stack { display: contents; }
}

/* ── TILE ── */
.tile {
    background: var(--tile-bg);
    border: 0.5px solid var(--tile-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.tile::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(12,157,222,0.04) 0%, transparent 60%);
    pointer-events: none;
}

.tile:hover {
    background: var(--tile-hover);
    border-color: var(--blue-dim);
    transform: translateY(-2px);
}

.tile-cat {
    font-size: 0.63rem;
    letter-spacing: 0.22em;
    color: var(--muted);
    opacity: 0.7;
}

.tile-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    opacity: 0.55;
    flex-shrink: 0;
    pointer-events: none;
}

.tile-img-wrap {
    width: 100%;
    aspect-ratio: 1200 / 630;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(7,16,24,0.95) 0%, rgba(4,10,16,0.95) 100%);
    flex-shrink: 0;
    position: relative;
}

/* ── AUDIO PLAYER ── */
.tile-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(4,10,16,0.82);
    border-radius: 4px;
    padding: 7px 10px;
    flex-shrink: 0;
}

.tile-img-audio { cursor: pointer; }

.tile-audio-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    border-radius: 0 0 8px 8px;
    backdrop-filter: blur(6px);
    background: rgba(4,10,16,0.65);
}

.audio-btn {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    flex-shrink: 0;
    width: 18px;
    line-height: 1;
}

.audio-bar {
    flex: 1;
    height: 4px;
    background: rgba(12,157,222,0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.audio-prog {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 2px;
    transition: width 0.1s linear;
    position: relative;
}

.audio-prog::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 8px 2px rgba(12,157,222,0.9), 0 0 3px rgba(12,157,222,1);
}

.audio-time {
    font-family: var(--mono);
    font-size: 0.58rem;
    color: var(--muted);
    flex-shrink: 0;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.tile-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tile-name {
    font-family: var(--sans);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tile-name-link {
    color: inherit;
    text-decoration: none;
}
.tile-name-link:hover { text-decoration: underline; }

.tile-desc {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.65;
    flex: 1;
    margin-top: 2px;
}

.tile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.63rem;
    letter-spacing: 0.15em;
}

.dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* dot and status label colors are set via inline styles from tiles.json statuses */

.tile-domain {
    font-size: 0.6rem;
    color: rgba(12,157,222,0.25);
    letter-spacing: 0.08em;
}

@keyframes share-pulse {
    0%, 100% { text-shadow: 0 0 4px rgba(12,157,222,0.3); opacity: 0.5; }
    50%       { text-shadow: 0 0 14px rgba(12,157,222,0.9), 0 0 4px rgba(12,157,222,1); opacity: 1; }
}

.share-btn {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    padding: 0;
    flex-shrink: 0;
    animation: share-pulse 2.5s ease-in-out infinite;
}

.share-btn:hover {
    animation: none;
    opacity: 1;
    text-shadow: 0 0 18px rgba(12,157,222,1), 0 0 6px rgba(12,157,222,1);
}

.tile-more {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    color: var(--blue);
    text-decoration: none;
    opacity: 0.5;
    animation: share-pulse 2.5s ease-in-out infinite;
}

.tile-more:hover {
    animation: none;
    opacity: 1;
    text-shadow: 0 0 18px rgba(12,157,222,1), 0 0 6px rgba(12,157,222,1);
}

/* ── TRACK PAGE ── */
.track-back-bar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(12,157,222,0.1);
}

.track-back {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}

.track-back:hover { color: var(--blue); }

.track-hero {
    width: 100%;
    max-width: 900px;
    margin: 1.5rem auto 0;
    line-height: 0;
    border-radius: 10px;
    overflow: hidden;
}

.track-hero img {
    width: 100%;
    height: auto;
    display: block;
}

.track-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.track-player-wrap {
    margin-bottom: 2rem;
}

.track-player-wrap .tile-audio {
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(12,157,222,0.06);
    border: 1px solid rgba(12,157,222,0.15);
    gap: 10px;
}

.track-player-wrap .audio-btn { font-size: 0.85rem; width: 20px; }
.track-player-wrap .audio-time { font-size: 0.6rem; }

.track-details { margin-bottom: 2rem; }

.track-cat {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.track-title {
    font-family: var(--sans);
    font-size: clamp(1.6rem, 5vw, 2.8rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.track-meta {
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.track-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.7;
}

.track-content {
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text);
    border-top: 1px solid rgba(12,157,222,0.1);
    padding-top: 2rem;
    margin-top: 2rem;
}

.track-content h2 {
    font-family: var(--sans);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
}

.track-content h3 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin: 1.2rem 0 0.4rem;
}

.track-content p { margin-bottom: 1rem; }
.track-content a { color: var(--blue); text-decoration: none; }
.track-content a:hover { text-decoration: underline; }
.track-content strong { font-weight: 700; }
.track-content em { color: var(--muted); font-style: italic; }
.track-content pre { white-space: pre-wrap; word-break: break-all; background: rgba(0,0,0,0.3); padding: 1rem 1.5rem; border-radius: 4px; margin: 0 2rem 1rem; }
.track-content hr { margin: 2rem 0; border-color: rgba(12,157,222,0.15); }
.track-content ul, .track-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.track-content li { margin-bottom: 0.25rem; }

/* hidden tiles when filtered */
.tile[data-hidden="true"] {
    display: none;
}

/* ── FOOTER ── */
#footer {
    text-align: left;
    padding: 2rem 1.5rem 1.5rem;
    font-size: 0.6rem;
    color: var(--muted);
    letter-spacing: 0.15em;
    line-height: 2.4;
    border-top: 1px solid rgba(12,157,222,0.12);
}

#footer a { color: rgba(12,157,222,0.35); text-decoration: none; }
#footer a:hover { color: rgba(12,157,222,0.7); }

#home-intro {
    padding: 1.5rem 3rem 0.5rem;
}
@media (max-width: 560px) {
    #home-intro { padding: 1.5rem 1.5rem 0.5rem; }
}
#home-intro h1 {
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 0.6rem;
}
#home-intro p {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.9;
    letter-spacing: 0.02em;
}

#scene-context {
    margin-bottom: 1.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    line-height: 1.9;
}
#scene-context h2 {
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
}
#scene-context p { color: rgba(154,168,179,0.7); }

/* ── PERSISTENT BOTTOM PLAYER ── */
body.has-player { padding-bottom: 84px; }

#player-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 84px;
    background: rgba(4,10,16,0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(12,157,222,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

#player-bar.active { transform: translateY(0); }

#player-img {
    aspect-ratio: 16 / 9;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(12,157,222,0.08);
}

#player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#player-track {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-artist {
    font-size: 0.6rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-sub {
    display: flex;
    align-items: center;
    gap: 8px;
}

#player-progress {
    flex: 1;
    height: 5px;
    background: rgba(12,157,222,0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

#player-prog {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 3px;
    transition: width 0.1s linear;
    position: relative;
}

#player-prog::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--blue);
}

#player-time {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    flex-shrink: 0;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

#player-btn {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: 1.4rem;
    flex-shrink: 0;
    padding: 0 4px;
    line-height: 1;
}

@media (max-width: 560px) {
    #player-img { height: 44px; }
}
#footer a:hover { color: rgba(12,157,222,0.7); }
