/* ============================================================
   VARS
   ============================================================ */
:root {
    --bg:          #080a08;
    --surface:     rgba(12, 16, 12, 0.92);
    --border:      #1e241e;
    --primary:     #3ba935;
    --primary-dim: rgba(59, 169, 53, 0.12);
    --primary-glow:rgba(59, 169, 53, 0.35);
    --amber:       #c9820a;
    --amber-dim:   rgba(201, 130, 10, 0.12);
    --red:         #c0392b;
    --red-dim:     rgba(192, 57, 43, 0.12);
    --text:        #c8d0c8;
    --text-dim:    #556055;
    --text-faint:  #2a342a;
    --mono:        'DM Mono', monospace;
    --serif:       'Playfair Display', serif;
    --sans:        'DM Sans', sans-serif;
    --radius:      2px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.noise {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.03;
    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)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 10, 8, 0.96);
    backdrop-filter: blur(20px);
    padding: 0 28px; height: 56px;
    display: flex; align-items: center;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.wordmark { display: flex; align-items: baseline; gap: 1px; }
.wordmark-main {
    font-family: var(--mono); font-weight: 500; font-size: 1.05rem;
    letter-spacing: 0.2em; color: #fff; text-transform: uppercase;
}
.cursor { font-family: var(--mono); color: var(--primary); animation: blink 1.1s step-end infinite; font-size: 1.05rem; }
@keyframes blink { 50% { opacity: 0; } }
.header-meta { display: flex; align-items: center; gap: 10px; }
.meta-tag { font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }
.meta-sep { color: var(--text-faint); }
.status-dot::before {
    content: ''; display: inline-block; width: 6px; height: 6px;
    background: var(--primary); border-radius: 50%; margin-right: 6px;
    box-shadow: 0 0 6px var(--primary); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--primary); }
    50%       { opacity: 0.5; box-shadow: 0 0 14px var(--primary); }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
    position: fixed; top: 56px; bottom: 0; left: 0; right: 0;
    display: grid; grid-template-columns: 230px 1fr 270px; overflow: hidden; z-index: 1;
}
.col {
    overflow-y: auto; overflow-x: hidden; padding: 24px 20px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
    animation: fadeUp 0.4s ease both;
}
.col-left  { border-right: 1px solid var(--border); animation-delay: 0.05s; }
.col-main  { padding: 28px 36px; animation-delay: 0.1s; }
.col-right { border-left: 1px solid var(--border); animation-delay: 0.15s; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.col::-webkit-scrollbar { width: 3px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================
   SHARED
   ============================================================ */
.block-label {
    font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.22em;
    color: var(--text-dim); text-transform: uppercase; margin-bottom: 14px;
}
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ============================================================
   LEFT NAV
   ============================================================ */
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
    background: none; border: none; cursor: pointer; width: 100%; text-align: left;
    display: flex; align-items: center; gap: 12px; padding: 9px 10px;
    border-radius: var(--radius); color: var(--text-dim);
    font-family: var(--sans); font-size: 0.88rem; font-weight: 400;
    transition: color 0.15s, background 0.15s;
}
.nav-btn:hover, .nav-btn.active { color: #fff; background: var(--primary-dim); }
.nav-btn.active { color: var(--primary); }
.nav-num { font-family: var(--mono); font-size: 0.63rem; color: var(--text-faint); min-width: 18px; }
.nav-btn.active .nav-num, .nav-btn:hover .nav-num { color: var(--primary); }
.link-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.link-list a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; color: var(--text-dim); text-decoration: none;
    font-size: 0.88rem; border-radius: var(--radius); transition: color 0.15s, background 0.15s;
}
.link-list a:hover { color: #fff; background: var(--primary-dim); }
.link-list.small a { font-size: 0.8rem; padding: 6px 10px; }
.arrow { color: var(--text-faint); font-size: 0.75rem; }
.link-list a:hover .arrow { color: var(--primary); }

/* ============================================================
   CONTENT (MAIN)
   ============================================================ */
.content { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.content-eyebrow {
    font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.25em;
    color: var(--primary); text-transform: uppercase; margin-bottom: 12px;
}
.content-title {
    font-family: var(--serif); font-size: 2rem; font-weight: 700;
    color: #fff; line-height: 1.2; margin-bottom: 22px; letter-spacing: -0.01em;
}
.content-body p {
    color: var(--text); font-size: 0.9rem; line-height: 1.75;
    margin-bottom: 14px; max-width: 60ch;
}
.content-body p:last-child { margin-bottom: 0; }

/* ── TERMINAL ─────────────────────────────────────────── */
.terminal {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 28px;
    background: rgba(4, 6, 4, 0.95);
}
.terminal-bar {
    background: #141a14;
    border-bottom: 1px solid var(--border);
    padding: 9px 14px;
    display: flex; align-items: center; gap: 7px;
}
.t-dot { width: 11px; height: 11px; border-radius: 50%; }
.t-dot.r { background: #ff5f57; }
.t-dot.y { background: #ffbd2e; }
.t-dot.g { background: #28c840; }
.t-title {
    font-family: var(--mono); font-size: 0.68rem;
    color: var(--text-dim); margin-left: 6px; letter-spacing: 0.05em;
}
.terminal-body { padding: 14px 18px; min-height: 120px; max-height: 160px; overflow-y: auto; }
.term-line {
    font-family: var(--mono); font-size: 0.75rem; line-height: 1.8;
    animation: termFade 0.2s ease both;
}
@keyframes termFade { from { opacity: 0; } to { opacity: 1; } }
.term-cmd  { color: #fff; }
.term-ok   { color: var(--primary); }
.term-warn { color: var(--amber); }
.term-out  { color: var(--text-dim); font-style: italic; }

.content-below {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ── GRAPH (Canvas) ───────────────────────────────────── */
.graph-wrap {
    position: relative;
    margin-bottom: 16px;
    width: 100%;
}
#principleGraph {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}
.principle-desc {
    font-family: var(--sans); font-size: 0.85rem; color: var(--text);
    line-height: 1.65; min-height: 48px; padding: 10px 0;
    border-top: 1px solid var(--border);
    opacity: 0; transition: opacity 0.2s ease;
}
.principle-desc.visible { opacity: 1; }
.principle-desc strong { color: #fff; display: block; margin-bottom: 4px; font-size: 0.9rem; }
.principle-desc span { color: var(--text-dim); font-size: 0.83rem; }
.principle-desc-hint { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); font-style: italic; }

/* ── SERVICES ─────────────────────────────────────────── */
.service-item { padding: 18px 0; border-bottom: 1px solid var(--border); }
.service-item:first-child { padding-top: 0; }
.service-item:last-child { border-bottom: none; }
.service-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.service-num { font-family: var(--mono); font-size: 0.63rem; color: var(--text-dim); }
.service-header h2 { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; color: #fff; }
.service-item p { font-size: 0.87rem; color: var(--text); line-height: 1.7; max-width: 56ch; margin-bottom: 10px; }
.service-link { font-family: var(--mono); font-size: 0.73rem; color: var(--primary); text-decoration: none; letter-spacing: 0.05em; transition: opacity 0.15s; }
.service-link:hover { opacity: 0.7; }

.flow-toggle {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.flow-toggle:hover { color: var(--primary); border-color: var(--primary); }
.flow-toggle.active { color: var(--primary); border-color: var(--primary); background: var(--primary-dim); }

.service-flow { padding: 8px 0; }
.service-flow canvas { display: block; width: 100%; border-radius: 2px; }
.service-badge {
    font-family: var(--mono); font-size: 0.52rem; letter-spacing: 0.15em;
    color: var(--amber); background: var(--amber-dim); border: 1px solid rgba(201,130,10,0.3);
    padding: 2px 6px; border-radius: 2px; vertical-align: middle; margin-left: 8px;
    text-transform: uppercase;
}
.service-unavailable { font-family: var(--mono); font-size: 0.72rem; color: var(--text-dim); font-style: italic; }

/* ── CONTACT ──────────────────────────────────────────── */
.contact-grid { display: flex; flex-direction: column; gap: 18px; margin-top: 6px; }
.contact-item { display: flex; flex-direction: column; gap: 4px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.contact-item:last-child { border-bottom: none; }
.contact-label { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em; color: var(--text-dim); }
.contact-value { font-size: 0.95rem; color: #fff; font-weight: 300; }

/* ============================================================
   RIGHT — STATUS
   ============================================================ */
.status-list { display: flex; flex-direction: column; gap: 0; }
.status-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 0; border-bottom: 1px solid var(--border);
}
.status-item:last-child { border-bottom: none; }
.status-info { display: flex; flex-direction: column; gap: 2px; }
.status-name { font-size: 0.85rem; color: var(--text); font-weight: 500; }
.status-url  { font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim); }
.status-right { display: flex; align-items: center; gap: 8px; }
.status-latency { font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim); min-width: 36px; text-align: right; }
.status-badge {
    font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
    padding: 3px 8px; border-radius: 2px; text-transform: uppercase; font-weight: 500;
    transition: all 0.3s ease;
}
.status-badge.pending { color: var(--text-dim); background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.status-badge.online  { color: var(--primary); background: var(--primary-dim); border: 1px solid rgba(59,169,53,0.3); }
.status-badge.offline { color: var(--red); background: var(--red-dim); border: 1px solid rgba(192,57,43,0.3); }

.status-footer {
    margin-top: 14px; display: flex; justify-content: space-between; align-items: center;
}
.status-updated { font-family: var(--mono); font-size: 0.6rem; color: var(--text-faint); }
.status-interval { font-family: var(--mono); font-size: 0.6rem; color: var(--text-faint); }

.footnote { display: flex; flex-direction: column; gap: 3px; }
.footnote span { font-family: var(--mono); font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.1em; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    html, body { overflow: auto; height: auto; }
    .layout { position: static; display: flex; flex-direction: column; overflow: visible; }
    .col { overflow: visible; border: none !important; padding: 20px 16px; }
    .col-left  { order: 1; border-bottom: 1px solid var(--border) !important; }
    .col-main  { order: 2; padding: 20px 16px; }
    .col-right { order: 3; border-top: 1px solid var(--border) !important; }
    .content-title { font-size: 1.6rem; }
    .header-meta { display: none; }
    html, body { overflow-y: auto; }
}