/* tor.lt — visual language adapted from sarunasgrigaliunas.lt (Emacs / Zenburn) */

:root {
    --bg: #1c1c1c;
    --panel: #282828;
    --panel-soft: #2a2a2a;
    --panel-deep: #161616;
    --modeline: #343434;
    --header: #383838;
    --line: #696969;
    --line-soft: #484848;
    --text: #d0d0d0;
    --muted: #a9a9a9;
    --comment: #7f9f7f;
    --green: #6fb86f;
    --keyword: #f0dfaf;
    --string: #cc9393;
    --function: #7cb8bb;
    --link: #93e0e3;
    --white: #f7f7f7;
    --shadow: rgba(0, 0, 0, .42);
    --rail: 292px;
    --content: 1160px;
    --warn: #e8c06b;
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    scroll-behavior: smooth;
    scroll-padding-top: 1rem;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 0 var(--rail) 48px 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 14% 8%, rgba(124, 184, 187, .08), transparent 28rem),
        radial-gradient(circle at 85% 75%, rgba(111, 184, 111, .04), transparent 32rem),
        linear-gradient(rgba(255, 255, 255, .012) 1px, transparent 1px),
        var(--bg);
    background-size: auto, auto, 100% 28px, auto;
    font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.65;
}

body::before {
    content: "";
    position: fixed;
    inset: 0 var(--rail) 0 0;
    pointer-events: none;
    z-index: 40;
    opacity: .09;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, #000 4px);
    mix-blend-mode: multiply;
}

::selection { color: #121212; background: var(--link); }

a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
button { font: inherit; color: inherit; }

.skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: .6rem .9rem;
    color: #111;
    background: var(--keyword);
}
.skip-link:focus { top: 1rem; }

.emacs-header {
    height: 43px;
    padding: .45rem 1.5rem;
    overflow: hidden;
    color: var(--link);
    background: var(--header);
    border-bottom: 1px solid var(--line);
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}
.emacs-header span:first-child { color: var(--keyword); }
.emacs-header span:nth-child(2) { color: var(--string); }

.side-menu {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 60;
    display: flex;
    width: var(--rail);
    min-height: 100vh;
    flex-direction: column;
    padding: 1.15rem 1rem 3.2rem;
    background:
        linear-gradient(145deg, rgba(147, 224, 227, .05), transparent 16rem),
        #171717;
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 50px rgba(0, 0, 0, .28);
}

.side-brand {
    display: flex;
    gap: .8rem;
    align-items: center;
    color: var(--white);
}
.side-brand:hover { text-decoration: none; }
.side-brand .brand-mark {
    display: grid;
    width: 3.2rem;
    height: 3.2rem;
    flex: 0 0 3.2rem;
    place-items: center;
    color: var(--link);
    background: var(--panel);
    border: 1px solid var(--function);
    border-radius: .35rem;
    box-shadow: 0 0 0 3px rgba(124, 184, 187, .07), 0 10px 30px rgba(0, 0, 0, .3);
    font-size: 1.05rem;
    font-weight: 900;
}
.side-brand strong { display: block; font-size: .95rem; line-height: 1.15; letter-spacing: .02em; }
.side-brand small { display: block; margin-top: .35rem; color: var(--comment); font-size: .68rem; }

.menu-context {
    display: grid;
    gap: .55rem;
    margin: 1.5rem 0 .8rem;
    padding: .8rem .2rem;
    border-top: 1px dashed var(--line-soft);
    border-bottom: 1px dashed var(--line-soft);
    font-size: .72rem;
}
.comment { color: var(--comment); }
.menu-status { color: var(--muted); }
.menu-status i {
    display: inline-block;
    width: .48rem;
    height: .48rem;
    margin-right: .4rem;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(111, 184, 111, .1);
}

.side-nav { display: grid; gap: .25rem; overflow-y: auto; }
.side-nav a {
    position: relative;
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0 .55rem;
    padding: .55rem .55rem;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: .25rem;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.side-nav a::before {
    content: "";
    position: absolute;
    top: .45rem;
    bottom: .45rem;
    left: -.2rem;
    width: 2px;
    background: transparent;
}
.side-nav a:hover, .side-nav a:focus-visible, .side-nav a.active {
    color: var(--white);
    text-decoration: none;
    border-color: #454545;
    background: var(--panel);
    transform: translateX(-.15rem);
}
.side-nav a.active::before { background: var(--link); box-shadow: 0 0 12px rgba(147, 224, 227, .65); }
.side-nav a span { grid-row: span 2; color: var(--function); font-size: .72rem; }
.side-nav a strong { font-size: .82rem; line-height: 1.1; }
.side-nav a small { color: #777; font-size: .64rem; line-height: 1.2; }
.side-nav a.active small { color: var(--comment); }

.side-meta {
    margin-top: auto;
    padding-top: 1rem;
    font-size: .68rem;
    color: var(--muted);
}
.side-meta dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem .7rem;
    margin: .6rem 0 0;
}
.side-meta dt { color: var(--comment); }
.side-meta dd { margin: 0; color: var(--text); text-align: right; }

.menu-toggle, .menu-scrim { display: none; }

main { width: 100%; }

.section {
    width: min(calc(100% - 2.5rem), var(--content));
    margin: 1.25rem auto;
    background: rgba(40, 40, 40, .94);
    border: 1px solid var(--line);
    box-shadow: 0 18px 55px var(--shadow);
}

.buffer-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 47px;
    padding: .55rem .85rem;
    color: var(--function);
    background: var(--header);
    border-bottom: 1px solid var(--line);
    font-size: .78rem;
}
.buffer-path { color: var(--keyword); }
.section-inner { padding: clamp(1.2rem, 3vw, 2.4rem); }

.status-bar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem .85rem;
    color: #c0c0c0;
    background: var(--modeline);
    border-top: 1px solid var(--line);
    font-size: .72rem;
    flex-wrap: wrap;
}

/* hero */
.hero-section { margin-top: 1.4rem; }
.eyebrow, .section-kicker {
    margin: 0 0 .75rem;
    color: var(--keyword);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.hero-copy h1 {
    max-width: 16ch;
    margin: 0;
    color: var(--white);
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: -.06em;
}
.hero-copy h1 span { color: var(--link); }
.hero-lead {
    max-width: 62ch;
    margin: 1.3rem 0 .7rem;
    padding-top: 1.1rem;
    color: var(--white);
    border-top: 1px dashed var(--line-soft);
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.62;
}
.hero-note { max-width: 68ch; margin: 0; color: var(--muted); font-size: .88rem; }
.hero-actions { display: flex; gap: .65rem; margin-top: 1.35rem; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    gap: .7rem;
    justify-content: center;
    padding: .55rem .85rem;
    color: var(--text);
    background: #2f2f2f;
    border: 1px solid var(--line);
    border-radius: .35rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    cursor: pointer;
    font-size: .8rem;
}
.btn.primary { color: #111; background: var(--link); border-color: var(--link); font-weight: 700; }
.btn:hover, .btn:focus-visible { text-decoration: none; border-color: var(--function); transform: translateY(-1px); }
.btn.primary:hover, .btn.primary:focus-visible { background: #b2f1f3; }

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
}
.stats-strip div {
    padding: 1rem 1.15rem;
    border-right: 1px solid var(--line-soft);
}
.stats-strip div:last-child { border-right: 0; }
.stats-strip span {
    display: block;
    color: var(--comment);
    font-size: .62rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.stats-strip strong {
    display: block;
    margin-top: .35rem;
    color: var(--white);
    font-size: 1.55rem;
    letter-spacing: -.04em;
}
.stats-strip strong.up { color: var(--green); }
.stats-strip strong.down { color: var(--string); }

/* controls */
.controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}
.controls input[type="search"] {
    width: 100%;
    min-height: 2.6rem;
    padding: .55rem .8rem;
    color: var(--text);
    background: #222;
    border: 1px solid var(--line-soft);
    border-radius: .3rem;
    outline: none;
}
.controls input[type="search"]:focus {
    border-color: var(--function);
    box-shadow: 0 0 0 3px rgba(124, 184, 187, .12);
}
.filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-chip {
    padding: .35rem .6rem;
    color: var(--muted);
    background: #242424;
    border: 1px solid var(--line-soft);
    border-radius: .25rem;
    cursor: pointer;
    font-size: .68rem;
}
.filter-chip:hover, .filter-chip.active {
    color: var(--white);
    border-color: var(--function);
    background: var(--panel);
}
.filter-chip.active { color: var(--link); }

/* service cards */
.service-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}
.service-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 1rem 1.05rem 1.05rem;
    background: var(--panel-soft);
    border: 1px solid var(--line-soft);
    border-top: 3px solid var(--function);
}
.service-card.is-down { border-top-color: var(--string); }
.service-card.is-partial { border-top-color: var(--warn); }
.service-card.is-up { border-top-color: var(--green); }
.service-card.hidden { display: none; }

.service-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .75rem;
    padding-bottom: .7rem;
    border-bottom: 1px dashed var(--line-soft);
}
.service-head h3 {
    margin: 0;
    color: var(--white);
    font-size: 1rem;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.service-head .meta {
    color: var(--comment);
    font-size: .65rem;
    margin-top: .25rem;
}
.badge-row { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .45rem;
    border: 1px solid transparent;
    font-size: .62rem;
    letter-spacing: .06em;
    white-space: nowrap;
}
.badge-up {
    color: var(--green);
    border-color: rgba(111, 184, 111, .35);
    background: rgba(111, 184, 111, .1);
}
.badge-down {
    color: var(--string);
    border-color: rgba(204, 147, 147, .35);
    background: rgba(204, 147, 147, .1);
}
.badge-partial {
    color: var(--warn);
    border-color: rgba(232, 192, 107, .35);
    background: rgba(232, 192, 107, .1);
}
.badge-rec {
    color: var(--keyword);
    border-color: rgba(240, 223, 175, .35);
    background: rgba(240, 223, 175, .08);
}

.mirror-list {
    display: grid;
    gap: .35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mirror-list li {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: .55rem;
    align-items: center;
    padding: .28rem 0;
    border-bottom: 1px dashed rgba(241, 238, 227, .05);
    font-size: .72rem;
}
.mirror-list li:last-child { border-bottom: 0; }
.mirror-list a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--link);
}
.mirror-list .lat { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.2rem; text-align: right; }
.mirror-list .st {
    min-width: 4.6rem;
    text-align: right;
    font-size: .65rem;
    letter-spacing: .04em;
}
.mirror-list .st.online { color: var(--green); }
.mirror-list .st.down { color: var(--string); }
.mirror-list .st.unknown { color: var(--muted); }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.section-header h2 {
    margin: 0;
    color: var(--white);
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    letter-spacing: -.02em;
}
.section-header p {
    margin: .35rem 0 0;
    color: var(--muted);
    font-size: .8rem;
}
.section-count {
    color: var(--function);
    font-size: .72rem;
    white-space: nowrap;
}

.empty-state {
    display: none;
    padding: 1.5rem;
    color: var(--muted);
    border: 1px dashed var(--line-soft);
    text-align: center;
    font-size: .85rem;
}
.empty-state.show { display: block; }

.about-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 1.2rem;
}
.about-panel {
    padding: 1rem;
    background: #222;
    border: 1px solid var(--line-soft);
}
.about-panel h3 {
    margin: 0 0 .8rem;
    color: var(--keyword);
    font-size: .95rem;
}
.about-panel p, .about-panel li {
    color: var(--muted);
    font-size: .8rem;
}
.about-panel ul {
    margin: .5rem 0 0;
    padding-left: 1.1rem;
}
.about-panel code {
    color: var(--link);
    font-family: inherit;
    font-size: .75rem;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    color: var(--muted);
    border-top: 1px solid var(--line-soft);
    font-size: .68rem;
    flex-wrap: wrap;
}

.emacs-modeline {
    position: fixed;
    right: var(--rail);
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    min-height: 36px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem 1rem;
    color: var(--text);
    background: #2f2f2f;
    border-top: 1px solid var(--line);
    font-size: .68rem;
}
.emacs-modeline .green { color: var(--green); }
.emacs-modeline .amber { color: var(--keyword); }

@media (max-width: 1160px) {
    :root { --rail: 270px; }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .stats-strip div:nth-child(2) { border-right: 0; }
    .stats-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}

@media (max-width: 980px) {
    body { padding-right: 0; }
    body.menu-open { overflow: hidden; }
    body::before { right: 0; }
    .side-menu {
        width: min(86vw, 330px);
        transform: translateX(105%);
        transition: transform .24s ease;
    }
    body.menu-open .side-menu { transform: translateX(0); }
    .menu-scrim {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        background: rgba(0, 0, 0, .68);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    body.menu-open .menu-scrim { opacity: 1; pointer-events: auto; }
    .menu-toggle {
        position: fixed;
        top: .46rem;
        right: .55rem;
        z-index: 70;
        display: flex;
        min-height: 34px;
        align-items: center;
        gap: .55rem;
        padding: .35rem .55rem;
        color: var(--link);
        background: #282828;
        border: 1px solid var(--line);
        border-radius: .25rem;
        cursor: pointer;
        font-size: .7rem;
    }
    .menu-toggle-icon {
        position: relative;
        width: 1rem;
        height: 1px;
        background: currentColor;
    }
    .menu-toggle-icon::before,
    .menu-toggle-icon::after {
        content: "";
        position: absolute;
        left: 0;
        width: 1rem;
        height: 1px;
        background: currentColor;
    }
    .menu-toggle-icon::before { top: -.3rem; }
    .menu-toggle-icon::after { top: .3rem; }
    body.menu-open .menu-toggle-icon { background: transparent; }
    body.menu-open .menu-toggle-icon::before { top: 0; transform: rotate(45deg); }
    body.menu-open .menu-toggle-icon::after { top: 0; transform: rotate(-45deg); }
    .emacs-modeline { right: 0; }
}

@media (max-width: 780px) {
    .section { width: min(calc(100% - 1rem), var(--content)); margin: .75rem auto; }
    .service-grid, .about-grid { grid-template-columns: 1fr; }
    .controls { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    body { padding-bottom: 64px; }
    .emacs-header { padding-right: 5.5rem; font-size: .72rem; }
    .menu-toggle-label { display: none; }
    .section-inner { padding: 1.05rem; }
    .buffer-path { display: none; }
    .stats-strip { grid-template-columns: 1fr; }
    .stats-strip div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
    .stats-strip div:last-child { border-bottom: 0; }
    .mirror-list li { grid-template-columns: 1fr; gap: .15rem; }
    .mirror-list .lat, .mirror-list .st { text-align: left; }
    .mirror-list .upt { display: none; }
    .emacs-modeline { flex-wrap: wrap; min-height: 54px; font-size: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}


/* ── automation surface: uptime strips, trend panel, NEW badge ───────────── */

.badge-new {
    color: var(--function);
    border-color: rgba(124, 184, 187, .4);
    background: rgba(124, 184, 187, .1);
}

.mirror-list .upt {
    display: inline-flex;
    gap: 1px;
    align-items: center;
    height: .68rem;
}
.mirror-list .upt i {
    display: block;
    width: 2px;
    height: .68rem;
    background: var(--line-soft);
}
.mirror-list .upt i.ok { background: rgba(111, 184, 111, .75); }
.mirror-list .upt i.no { background: rgba(204, 147, 147, .7); }

.trend-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    padding-top: 1.2rem;
    padding-bottom: 0;
}
.trend-panel {
    border: 1px solid var(--line-soft);
    background: var(--panel-soft);
    padding: .7rem .85rem;
}
.trend-panel .comment {
    display: block;
    font-size: .7rem;
    margin-bottom: .45rem;
}
.trend-panel .spark { display: block; }

.trend-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .12rem .8rem;
    margin: 0;
    font-size: .72rem;
}
.trend-dl dt { color: var(--muted); }
.trend-dl dd { margin: 0; color: var(--keyword); text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
    .trend-row { grid-template-columns: 1fr; }
}


/* ── download panels ─────────────────────────────────────────────────────── */

.dl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}

.dl-card { display: flex; flex-direction: column; }
.dl-card ul { flex: 1 0 auto; }

.dl-kicker {
    margin: 0 0 .5rem;
    color: var(--function);
    font-size: .62rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dl-requires { margin: .9rem 0 .35rem; font-size: .72rem; }

.dl-install {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--muted);
    font-size: .74rem;
}
.dl-install li { margin-bottom: .15rem; }

.dl-verify { margin: 0; font-size: .72rem; }

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


.dl-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin: 1rem 0 .9rem;
    padding-top: .9rem;
    border-top: 1px dashed var(--line-soft);
}

.dl-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .12rem .8rem;
    margin: 0;
    font-size: .72rem;
}
.dl-meta dt { color: var(--comment); }
.dl-meta dd { margin: 0; color: var(--keyword); text-align: right; font-variant-numeric: tabular-nums; }

.dl-hash {
    margin: .3rem 0 .6rem;
    padding: .5rem .6rem;
    background: var(--panel-deep);
    border: 1px solid var(--line-soft);
    overflow-wrap: anywhere;
}
.dl-hash code { font-size: .68rem; letter-spacing: .01em; }

.note-line {
    max-width: 78ch;
    margin: 1.1rem 0 0;
    padding-top: .9rem;
    color: var(--muted);
    border-top: 1px dashed var(--line-soft);
    font-size: .78rem;
}
