/* Minimal, quiet open-source panel anchored to the bottom-right over Arp 244. */
:root {
    --ink: #f1f4f9;
    --ink-2: rgba(214, 223, 238, 0.68);
    --ink-3: rgba(186, 198, 218, 0.44);
    --accent: #b8d4ff;
    --surface: rgba(8, 11, 18, 0.58);
    --surface-hover: rgba(255, 255, 255, 0.045);
    --hairline: rgba(255, 255, 255, 0.09);
    --hairline-soft: rgba(255, 255, 255, 0.06);
    --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.site-header, .restore-pill, .catalog-sheet, .site-footer {
    position: fixed;
    z-index: 2;
    color: var(--ink);
    font-family: var(--sans);
    -webkit-user-select: text;
    user-select: text;
    transition: opacity 0.3s ease, transform 0.3s var(--ease);
}
.site-header a, .catalog-sheet a { color: inherit; text-decoration: none; }
.site-header :focus-visible, .restore-pill:focus-visible, .catalog-sheet :focus-visible {
    outline: 1.5px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------- Top bar */
.site-header {
    top: max(22px, env(safe-area-inset-top));
    left: max(32px, env(safe-area-inset-left));
    right: max(32px, env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}
.wordmark, .header-nav { pointer-events: auto; }
.wordmark {
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.04em;
    text-shadow: 0 2px 18px rgba(2, 4, 8, 0.8);
}
.wordmark span { color: var(--ink-2); font-weight: 400; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--ink-2);
    text-shadow: 0 2px 16px rgba(2, 4, 8, 0.8);
}
.header-nav a, .quiet-toggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: color 0.18s ease;
}
.header-nav a:hover, .quiet-toggle:hover { color: var(--ink); }

/* ---------------------------------------------------------------- Hidden / Zen state */
.restore-pill {
    top: max(20px, env(safe-area-inset-top));
    right: max(32px, env(safe-area-inset-right));
    z-index: 3;
    padding: 6px 14px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
}
.restore-pill:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.18); }

html.is-hidden .site-header,
html.is-hidden .site-footer { opacity: 0; pointer-events: none; }
html.is-hidden .wordmark,
html.is-hidden .header-nav { pointer-events: none; }
html.is-hidden .catalog-sheet { opacity: 0; pointer-events: none; transform: translateY(14px); }
html.is-hidden .restore-pill { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---------------------------------------------------------------- Right-anchored project panel */
.catalog-sheet {
    right: max(32px, env(safe-area-inset-right));
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px));
    width: min(370px, calc(100vw - 40px));
    border: 1px solid var(--hairline);
    border-radius: 14px;
    background: var(--surface);
    backdrop-filter: blur(22px) saturate(115%);
    -webkit-backdrop-filter: blur(22px) saturate(115%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
    overflow: hidden;
    pointer-events: auto;
}

.sheet-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease;
}
.sheet-bar:hover { background: var(--surface-hover); }

.sheet-title {
    font-size: 13px;
    font-weight: 450;
    color: var(--ink-2);
    letter-spacing: -0.005em;
    transition: color 0.16s ease;
}
.sheet-bar:hover .sheet-title { color: var(--ink); }

.sheet-chevron {
    width: 15px;
    height: 15px;
    stroke: var(--ink-3);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: rotate(180deg);
    transition: transform 0.34s var(--ease), stroke 0.16s ease;
}
.catalog-sheet.is-collapsed .sheet-chevron { transform: rotate(0deg); }
.sheet-bar:hover .sheet-chevron { stroke: var(--ink); }

/* Smooth 0fr <-> 1fr accordion without layout jumps or width reflow */
.sheet-body {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    border-top: 1px solid var(--hairline-soft);
    transition: grid-template-rows 0.34s var(--ease), opacity 0.24s ease, border-color 0.24s ease;
}
.sheet-body-inner {
    overflow: hidden;
    min-height: 0;
}
.catalog-sheet.is-collapsed .sheet-body {
    grid-template-rows: 0fr;
    opacity: 0;
    border-top-color: transparent;
    pointer-events: none;
}

/* ---------------------------------------------------------------- Clean 1-col project list */
.project-grid {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: min(64dvh, 500px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px 18px 16px;
    border-top: 1px solid var(--hairline-soft);
    transition: background 0.18s ease;
}
.project-card:first-child { border-top: none; }
.project-card:hover { background: var(--surface-hover); }

.card-link {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }

.card-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.card-title {
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: -0.015em;
    color: var(--ink);
    transition: color 0.18s ease;
}
.project-card:hover .card-title { color: var(--accent); }

.card-cat {
    font-size: 11.5px;
    color: var(--ink-3);
}
.card-arrow {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--ink-3);
    transition: color 0.18s ease, transform 0.18s ease;
}
.project-card:hover .card-arrow { color: var(--accent); transform: translate(2px, -2px); }

.card-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-2);
}

.card-repo {
    position: relative;
    z-index: 2;
    align-self: flex-start;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--ink-3) !important;
    transition: color 0.16s ease;
}
.card-repo:hover { color: var(--ink) !important; text-decoration: underline; text-underline-offset: 3px; }

.sheet-status {
    margin: 0;
    padding: 12px 18px;
    font-size: 12px;
    color: var(--ink-3);
}
.sheet-status[hidden] { display: none; }

/* ---------------------------------------------------------------- Quiet footer */
.site-footer {
    left: max(32px, env(safe-area-inset-left));
    bottom: max(20px, env(safe-area-inset-bottom));
    font-size: 11.5px;
    color: var(--ink-3);
    pointer-events: none;
    text-shadow: 0 1px 12px rgba(2, 4, 8, 0.85);
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 640px) {
    .site-header { left: 20px; right: 20px; top: max(18px, env(safe-area-inset-top)); }
    .header-nav { gap: 14px; font-size: 12px; }
    .restore-pill { right: 20px; top: max(16px, env(safe-area-inset-top)); }
    .catalog-sheet { left: 16px; right: 16px; width: auto; bottom: max(42px, calc(env(safe-area-inset-bottom) + 34px)); }
    .project-grid { max-height: min(56dvh, 420px); }
    .site-footer { left: 20px; bottom: max(14px, env(safe-area-inset-bottom)); font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .site-header, .restore-pill, .catalog-sheet, .site-footer,
    .sheet-body, .sheet-chevron, .project-card, .card-title, .card-arrow { transition: none; }
}
