/* shared layout for project/server/service detail pages + rack.html.
   link before background.css so the shared chrome still wins cascade ties.
   accent color themed per page via body class: theme-cluster = cyan,
   theme-standalone / theme-service = purple */

:root {
    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --accent-text: #a78bfa;
    --accent-soft: rgba(139, 92, 246, 0.15);
    --accent-line: rgba(139, 92, 246, 0.25);
}

body.theme-cluster {
    --accent: #06B6D4;
    --accent-2: #0EA5E9;
    --accent-text: #67E8F9;
    --accent-soft: rgba(6, 182, 212, 0.15);
    --accent-line: rgba(6, 182, 212, 0.25);
}

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

body {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #0a0a0f;
    color: #e2e8f0;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 2rem;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 2.5rem 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.breadcrumb .sep {
    color: #475569;
}

.breadcrumb .current {
    color: #94a3b8;
}

.detail-hero {
    padding: 2.5rem 0 1rem;
}

.detail-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px var(--accent-soft));
}

.detail-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-text), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-tagline {
    font-size: 1.2rem;
    color: #94a3b8;
    max-width: 46rem;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.75rem;
}

.tag {
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid var(--accent-line);
}

.detail-section {
    padding: 2.5rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.detail-section:first-of-type {
    border-top: none;
}

.detail-section h2 {
    font-size: 1.8rem;
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.detail-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 70px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 10px var(--accent-soft);
}

.detail-section p {
    color: #94a3b8;
    line-height: 1.8;
    margin-bottom: 1rem;
    max-width: 46rem;
}

.detail-section p:last-child {
    margin-bottom: 0;
}

.detail-section strong {
    color: #e2e8f0;
    font-weight: 600;
}

.spec-list {
    list-style: none;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--accent-line);
    border-radius: 14px;
    padding: 0.5rem 1.5rem;
    backdrop-filter: blur(10px);
}

.spec-list li {
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
}

.spec-list li:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--accent-text);
    font-weight: 600;
    flex-shrink: 0;
}

.spec-value {
    color: #e2e8f0;
    text-align: right;
}

.callout {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.callout p {
    margin: 0;
    color: #cbd5e1;
}

/* timeline: centre spine, entries alternate left/right */
.timeline {
    list-style: none;
    position: relative;
    margin: 1.5rem auto 0;
    max-width: 820px;
    padding: 0;
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 0 2.5rem 2.75rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0.3rem;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.timeline-item:nth-child(odd)::before {
    right: -6.5px;
}

.timeline-item:nth-child(even)::before {
    left: -6.5px;
}

/* each item draws the spine down through its own height, which lands
   exactly on the next item's dot since they're all offset the same amount
   from their own top - no js measuring needed, last item just skips this */
.timeline-connector {
    position: absolute;
    top: calc(0.3rem + 6.5px);
    width: 2px;
    height: 100%;
    background: var(--accent-line);
}

.timeline-item:last-child .timeline-connector {
    display: none;
}

.timeline-item:nth-child(odd) .timeline-connector {
    right: -1px;
}

.timeline-item:nth-child(even) .timeline-connector {
    left: -1px;
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: calc(0.3rem + 5.5px);
    width: 2.5rem;
    height: 2px;
    background: var(--accent-line);
}

.timeline-item:nth-child(odd)::after {
    right: 0;
}

.timeline-item:nth-child(even)::after {
    left: 0;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--accent-text);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.timeline-item h3 {
    font-size: 1.15rem;
    color: #f1f5f9;
    margin: 0.35rem 0 0.5rem;
}

.timeline-item p {
    margin: 0;
    max-width: none;
}

@media (max-width: 768px) {
    .timeline {
        margin-left: 0;
    }

    .timeline-item:nth-child(odd) .timeline-connector,
    .timeline-item:nth-child(even) .timeline-connector {
        left: 6px;
        right: auto;
    }

    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100%;
        left: 0;
        text-align: left;
        padding: 0 0 2rem 2rem;
    }

    .timeline-item:nth-child(odd)::before,
    .timeline-item:nth-child(even)::before {
        left: 0;
        right: auto;
    }

    .timeline-item:nth-child(odd)::after,
    .timeline-item:nth-child(even)::after {
        left: 6px;
        right: auto;
        width: 0.9rem;
    }
}

.detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2.5rem 0 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.6rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.detail-link.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 30px var(--accent-soft);
}

.detail-link.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px var(--accent-soft);
}

.detail-link.secondary {
    background: rgba(30, 41, 59, 0.5);
    color: var(--accent-text);
    border: 1px solid var(--accent-line);
}

.detail-link.secondary:hover {
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-3px);
}

/* rack elevation - front/back, U1 at the bottom like the real rack */
.rack-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0.5rem 0 1.5rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.rack-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.rack-legend i {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    display: inline-block;
}

.rack-headers {
    display: grid;
    grid-template-columns: 42px 1fr 1fr;
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.rack-headers .front { grid-column: 2; }
.rack-headers .back  { grid-column: 3; }

.rack-elevation {
    --u: 26px;
    position: relative;
    display: grid;
    grid-template-columns: 42px 1fr 1fr 1fr 1fr;
    background: repeating-linear-gradient(
        to bottom,
        rgba(148, 163, 184, 0.05) 0,
        rgba(148, 163, 184, 0.05) calc(var(--u) - 1px),
        transparent calc(var(--u) - 1px),
        transparent var(--u)
    );
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.rack-elevation::before {
    content: '';
    grid-column: 3 / 4;
    grid-row: 1 / -1;
    border-right: 2px dashed rgba(148, 163, 184, 0.25);
}

.rack-u {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    color: #64748b;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.rack-slot {
    --accent: #8b5cf6;
    --accent-text: #a78bfa;
    --accent-soft: rgba(139, 92, 246, 0.15);
    --accent-line: rgba(139, 92, 246, 0.3);
    position: relative;
    margin: 1px;
    border-radius: 6px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0 0.4rem;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    overflow: hidden;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

/* stays inside the box on purpose - .rack-elevation clips overflow for its
   rounded corners, so scale()/outward box-shadow would get cut off on any
   slot near an edge */
.rack-slot:hover,
.rack-slot:focus-visible {
    filter: brightness(1.25);
    box-shadow: inset 0 0 0 2px var(--accent);
    z-index: 2;
}

.rack-slot .rack-slot-emoji {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.rack-slot .rack-slot-note {
    position: absolute;
    top: 1px;
    right: 3px;
    font-size: 0.6rem;
    opacity: 0.75;
}

.rack-caption {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.7;
}

.rack-info {
    display: none;
}

.rack-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 10, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 300;
}

.rack-modal-overlay[hidden] {
    display: none;
}

.rack-modal-card {
    background: rgba(20, 20, 28, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.rack-modal-card h2 {
    font-size: 1.5rem;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
}

.rack-modal-card p {
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.rack-modal-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.rack-modal-close:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .detail-title {
        font-size: 2.2rem;
    }

    .detail-section h2 {
        font-size: 1.5rem;
    }

    .spec-list li {
        flex-direction: column;
        gap: 0.25rem;
    }

    .spec-value {
        text-align: left;
    }

    .rack-elevation {
        --u: 22px;
        grid-template-columns: 32px 1fr 1fr 1fr 1fr;
    }

    .rack-slot {
        font-size: 0.62rem;
        padding: 0 0.2rem;
    }

    .rack-slot .rack-slot-emoji {
        display: none;
    }
}

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

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--accent-soft);
}
