/* ============================================================
   RetroTechCollection Archive: archive.retrotechcollection.com
   Theme for Directory Lister 4.

   Uses the tokens from retrotechcollection.com: a beige machine
   with a lit screen. --case is the plastic (edges, hairlines,
   folders), --phosphor is the signal (links, focus, the current
   path). Dark is the brand default; light is the same case in
   daylight.

   Loaded by /.customizations.html. Styles the templates in
   .rtc/views, which .rtc/reapply.sh copies into app/views.
   ============================================================ */

/* ---------- Tokens ---------- */
.rtc {
    /* Brand constants, as on retrotechcollection.com */
    --phosphor: oklch(0.72 0.15 240);
    --phosphor-dim: oklch(0.66 0.12 240);
    --phosphor-deep: oklch(0.5 0.1 240);
    --case: oklch(0.83 0.045 84);
    --case-edge: oklch(0.6 0.028 82);

    --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --shell: 1180px;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --radius: 14px;
    --radius-sm: 8px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);

    /* Light: all text pairs checked at 4.5:1 or better */
    --bg: oklch(0.972 0.008 84);
    --bg-deep: oklch(0.945 0.013 84);
    --surface: oklch(0.993 0.004 84);
    --surface-lift: oklch(0.962 0.014 84);
    --panel-bg: var(--surface);
    --inset-bg: oklch(0.955 0.012 84);
    --text: oklch(0.21 0.012 240);
    --text-2: oklch(0.37 0.012 240);
    --text-3: oklch(0.47 0.012 240);
    --accent: oklch(0.5 0.13 240);
    --accent-soft: oklch(0.5 0.13 240 / 0.07);
    --accent-line: oklch(0.5 0.13 240 / 0.35);
    --prompt: oklch(0.5 0.13 240 / 0.7);
    --glow: transparent;
    --folder: oklch(0.56 0.05 78);
    --file: oklch(0.5 0.1 240);
    --line: oklch(0.21 0.02 240 / 0.11);
    --line-warm: oklch(0.6 0.028 82 / 0.4);
    --header-bg: oklch(0.985 0.006 84 / 0.92);
    --crumbs-bg: oklch(0.955 0.012 84 / 0.95);
    --search-bg: oklch(1 0 0 / 0.75);
    --shadow: 0 1px 2px oklch(0.3 0.02 80 / 0.05), 0 14px 34px -22px oklch(0.3 0.02 80 / 0.4);
    --overlay: oklch(0.3 0.02 80 / 0.4);
    --mark-shadow: drop-shadow(0 1px 3px oklch(0.3 0.02 80 / 0.3));

    color-scheme: light;
}

.rtc.dark {
    --bg: oklch(0.155 0.008 240);
    --bg-deep: oklch(0.115 0.008 240);
    --surface: oklch(0.205 0.01 240);
    --surface-lift: oklch(0.245 0.014 240);
    --panel-bg: linear-gradient(180deg,
        oklch(0.245 0.014 240 / 0.55),
        oklch(0.205 0.01 240 / 0.9));
    --inset-bg: oklch(0.115 0.008 240 / 0.8);
    --text: oklch(0.96 0.006 90);
    --text-2: oklch(0.79 0.01 90);
    --text-3: oklch(0.71 0.01 90);
    --accent: var(--phosphor);
    --accent-soft: oklch(0.72 0.15 240 / 0.09);
    --accent-line: oklch(0.72 0.15 240 / 0.34);
    --prompt: var(--phosphor-deep);
    --glow: oklch(0.72 0.15 240 / 0.28);
    --folder: var(--case);
    --file: var(--phosphor-dim);
    --line: oklch(1 0 0 / 0.09);
    --line-warm: oklch(0.83 0.045 84 / 0.22);
    --header-bg: oklch(0.115 0.008 240 / 0.92);
    --crumbs-bg: oklch(0.135 0.008 240 / 0.94);
    --search-bg: oklch(0.115 0.008 240 / 0.6);
    --shadow: 0 16px 40px -18px oklch(0 0 0 / 0.9);
    --overlay: oklch(0.09 0.006 240 / 0.72);
    --mark-shadow: drop-shadow(0 0 16px oklch(0.72 0.15 240 / 0.24)) drop-shadow(0 2px 6px oklch(0 0 0 / 0.6));

    color-scheme: dark;
}

/* ---------- Page ---------- */
html,
body {
    background: oklch(0.155 0.008 240);
}

html:has(.rtc:not(.dark)),
html:has(.rtc:not(.dark)) body {
    background: oklch(0.972 0.008 84);
}

[x-cloak] {
    display: none !important;
}

.rtc {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.6;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    isolation: isolate;
}

/* The glass: aperture grille and scanlines, then the tube's corner
   falloff. Dark only, behind the content, never on top of text. */
.rtc::before,
.rtc::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}

.rtc.dark::before {
    opacity: 0.5;
    background:
        repeating-linear-gradient(90deg,
            oklch(0.72 0.15 240 / 0.028) 0 1px,
            transparent 1px 3px),
        repeating-linear-gradient(0deg,
            transparent 0 2px,
            oklch(0 0 0 / 0.22) 2px 4px);
}

.rtc.dark::after {
    opacity: 1;
    background:
        radial-gradient(120% 70% at 50% 0%,
            oklch(0.72 0.15 240 / 0.06) 0%,
            transparent 55%),
        radial-gradient(ellipse 105% 90% at 50% 50%,
            transparent 45%,
            oklch(0.115 0.008 240 / 0.5) 85%,
            oklch(0.09 0.006 240 / 0.8) 100%);
}

.rtc a {
    color: inherit;
    text-decoration: none;
}

.rtc :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

.rtc ::selection {
    background: var(--phosphor);
    color: oklch(0.115 0.008 240);
}

.rtc-shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.rtc-skip {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 60;
    transform: translate(-50%, -110%);
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--accent);
    border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--bg-deep);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    transition: transform 0.25s var(--ease);
}

.rtc-skip:focus-visible {
    transform: translate(-50%, 0);
}

/* ============================================================
   HEADER
   ============================================================ */

.rtc-header {
    position: sticky;
    top: 0;
    z-index: 30;
}

.rtc-header__bar {
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(1.2) blur(14px);
    backdrop-filter: saturate(1.2) blur(14px);
}

.rtc-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "brand search nav toggle";
    align-items: center;
    gap: 0.75rem clamp(1rem, 2.5vw, 2rem);
    padding-block: 0.75rem;
}

/* --- Lockup: the mark, the wordmark, and what this place is --- */
.rtc-brand {
    grid-area: brand;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: var(--radius-sm);
}

.rtc-brand__mark {
    flex: none;
    width: 42px;
    height: auto;
    filter: var(--mark-shadow);
}

.rtc-brand__wordmark {
    display: flex;
    flex-direction: column;
    gap: 0.08em;
    font-size: 0.74rem;
    line-height: 0.98;
}

.rtc-brand__wordmark span {
    display: block;
    font-variation-settings: 'wdth' 112;
    text-transform: uppercase;
    white-space: nowrap;
}

.rtc-brand__lead {
    font-weight: 800;
    letter-spacing: -0.005em;
    color: var(--text);
}

.rtc-brand__tail {
    font-weight: 300;
    letter-spacing: 0.055em;
    color: var(--text-2);
}

.rtc-brand__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    margin-left: 0.3rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.rtc-brand__tag::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: rtc-pulse 2.4s var(--ease-soft) infinite;
}

/* --- Search: a terminal prompt --- */
.rtc-header__search {
    grid-area: search;
    justify-self: center;
    width: 100%;
    max-width: 560px;
}

.rtc-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 42px;
    padding-inline: 0.95rem 0.6rem;
    border: 1px solid var(--line-warm);
    border-radius: var(--radius-sm);
    background: var(--search-bg);
    box-shadow: inset 0 0 24px var(--accent-soft);
    transition:
        border-color 0.3s var(--ease),
        box-shadow 0.3s var(--ease);
}

.rtc-search:focus-within {
    border-color: var(--accent-line);
    box-shadow:
        0 0 0 3px var(--accent-soft),
        inset 0 0 24px var(--accent-soft);
}

.rtc-search__prompt {
    flex: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    text-shadow: 0 0 12px var(--glow);
}

.rtc-search__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-variation-settings: 'wdth' 87.5;
    letter-spacing: 0.01em;
    caret-color: var(--accent);
}

.rtc-search__input::placeholder {
    color: var(--text-3);
    opacity: 1;
}

.rtc-search__input:focus,
.rtc-search__input:focus-visible {
    outline: none;
}

.rtc-search__icon {
    flex: none;
    width: 26px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-3);
}

.rtc-search__clear {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: var(--text-3);
    transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.rtc-search__clear:hover {
    color: var(--text);
    background: var(--accent-soft);
}

/* --- Links to the rest of RTC --- */
.rtc-nav {
    grid-area: nav;
    display: flex;
    gap: 0.1rem;
    margin-right: -0.25rem;
}

.rtc-nav a {
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    transition: color 0.3s var(--ease);
}

.rtc-nav a:hover {
    color: var(--accent);
}

/* --- Light/dark switch --- */
.rtc-header__toggle {
    grid-area: toggle;
    display: flex;
}

.rtc-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 48px;
    height: 26px;
    padding: 3px;
    border: 1px solid var(--line-warm);
    border-radius: 999px;
    background: var(--inset-bg);
    cursor: pointer;
}

.rtc-toggle__knob {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--case);
    color: oklch(0.36 0.04 80);
    font-size: 9px;
    box-shadow: 0 1px 3px oklch(0 0 0 / 0.3);
    transition:
        transform 0.35s var(--ease),
        background-color 0.35s var(--ease),
        box-shadow 0.35s var(--ease);
}

.rtc.dark .rtc-toggle__knob {
    transform: translateX(22px);
    background: oklch(0.205 0.01 240);
    color: var(--phosphor);
    box-shadow:
        inset 0 0 0 1px var(--accent-line),
        0 0 10px var(--glow);
}

.rtc-toggle__moon,
.rtc.dark .rtc-toggle__sun {
    display: none;
}

.rtc.dark .rtc-toggle__moon {
    display: inline-block;
}

/* --- Path bar --- */
.rtc-crumbs-bar {
    background: var(--crumbs-bg);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.rtc-crumbs-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 40px;
}

.rtc-crumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-block: 0.55rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-variation-settings: 'wdth' 87.5;
    letter-spacing: 0.02em;
}

.rtc-crumbs::-webkit-scrollbar {
    display: none;
}

.rtc-crumbs__prompt {
    color: var(--prompt);
}

.rtc-crumbs__link {
    border-radius: 3px;
    color: var(--text-2);
    transition: color 0.25s var(--ease);
}

.rtc-crumbs__link:hover {
    color: var(--accent);
}

.rtc-crumbs__link[aria-current="page"] {
    color: var(--accent);
    text-shadow: 0 0 12px var(--glow);
}

.rtc-crumbs__sep {
    color: var(--text-3);
}

.rtc-crumbs__caret {
    flex: none;
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    margin-left: -0.2rem;
    background: var(--accent);
    box-shadow: 0 0 10px var(--glow);
    animation: rtc-blink 1.1s steps(1) infinite;
}

.rtc-zip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--line-warm);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
    transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.rtc-zip:hover {
    color: var(--accent);
    border-color: var(--accent-line);
}

/* ============================================================
   LISTING
   ============================================================ */

.rtc-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3.5rem);
}

/* Heading with a drawn rule, as on the hub page */
.rtc-section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    min-width: 0;
}

.rtc-section-head h1 {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(1.15rem, 1rem + 0.7vw, 1.6rem);
    font-weight: 700;
    font-variation-settings: 'wdth' 105;
    letter-spacing: -0.015em;
    line-height: 1.3;
    color: var(--text);
}

.rtc-section-head__rule {
    flex: 1 1 2rem;
    height: 1px;
    align-self: center;
    background: linear-gradient(90deg,
        var(--line-warm),
        oklch(0.83 0.045 84 / 0.04) 70%,
        transparent);
}

.rtc-section-head__note {
    flex: none;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.63rem;
    letter-spacing: 0.1em;
    color: var(--text-3);
}

/* The panel: same surface as the hub's destination cards */
.rtc-listing {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    overflow: hidden;
    isolation: isolate;
}

/* Specular hairline along the top edge: plastic catching the light */
.rtc-listing::before,
.rtc-readme::before,
.rtc-modal__dialog::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    z-index: 1;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--line-warm) 18%,
        oklch(0.83 0.045 84 / 0.42) 50%,
        var(--line-warm) 82%,
        transparent);
    opacity: 0.8;
    pointer-events: none;
}

.rtc-listing__head,
.rtc-row {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 2rem 6.5rem 9rem;
    align-items: center;
    column-gap: 0.85rem;
    padding-inline: clamp(0.85rem, 2vw, 1.35rem);
}

.rtc-listing__head {
    padding-block: 0.8rem;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
}

.rtc-listing__col-name {
    grid-column: 2 / 4;
}

.rtc-listing__col-size {
    grid-column: 4;
    text-align: right;
}

.rtc-listing__col-date {
    grid-column: 5;
    text-align: right;
}

.rtc-listing__rows > li + li {
    border-top: 1px solid var(--line);
}

.rtc-listing__empty {
    padding: 2.75rem 1.25rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--text-3);
}

.rtc-row {
    position: relative;
    min-height: 54px;
    padding-block: 0.6rem;
    transition: background-color 0.25s var(--ease);
}

/* One line per row whatever order the columns are placed in */
.rtc-row > * {
    grid-row: 1;
}

/* A lit edge on the row under the pointer */
.rtc-row::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--accent);
    box-shadow: 0 0 10px var(--glow);
    opacity: 0;
    transform: scaleY(0.4);
    transition:
        opacity 0.3s var(--ease),
        transform 0.3s var(--ease);
}

.rtc-row:hover,
.rtc-row:focus-visible {
    background: linear-gradient(90deg, var(--accent-soft), transparent 75%);
}

.rtc-row:hover::before,
.rtc-row:focus-visible::before {
    opacity: 1;
    transform: none;
}

.rtc-row:focus-visible {
    outline-offset: -2px;
    border-radius: 0;
}

.rtc-row__icon {
    grid-column: 1;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--inset-bg);
    color: var(--file);
    font-size: 0.8rem;
    transition:
        border-color 0.3s var(--ease),
        box-shadow 0.3s var(--ease);
}

.rtc-row--dir .rtc-row__icon {
    color: var(--folder);
}

.rtc-row--up .rtc-row__icon {
    color: var(--text-3);
}

.rtc-row:hover .rtc-row__icon {
    border-color: var(--accent-line);
    box-shadow: 0 0 14px -6px var(--glow);
}

.rtc-row__name {
    grid-column: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    transition: color 0.25s var(--ease);
}

.rtc-row--dir .rtc-row__name {
    font-weight: 600;
}

.rtc-row--up .rtc-row__name {
    font-family: var(--font-mono);
    color: var(--text-3);
}

.rtc-row:hover .rtc-row__name {
    color: var(--accent);
}

.rtc-row__info {
    grid-column: 3;
    justify-self: center;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    color: var(--text-3);
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.2s var(--ease),
        color 0.2s var(--ease),
        background-color 0.2s var(--ease);
}

.rtc-row:hover .rtc-row__info,
.rtc-row:focus-within .rtc-row__info,
.rtc-row__info:focus-visible {
    opacity: 1;
}

.rtc-row__info:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

@media (hover: none) {
    .rtc-row__info {
        opacity: 1;
    }
}

.rtc-row__size,
.rtc-row__date {
    white-space: nowrap;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-variation-settings: 'wdth' 87.5;
    letter-spacing: 0.01em;
    color: var(--text-3);
}

.rtc-row__size {
    grid-column: 4;
}

.rtc-row__date {
    grid-column: 5;
}

/* ============================================================
   README
   ============================================================ */

.rtc-readme {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    overflow: hidden;
    scroll-margin-top: 8rem;
}

.rtc-readme--first {
    order: -1;
}

/* When the README comes first it sits above the heading too, so put the
   heading back on top: heading, README, then the files. */
.rtc-main:has(.rtc-readme--first) .rtc-section-head {
    order: -2;
}

.rtc-readme__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem clamp(0.85rem, 2vw, 1.35rem);
    border-bottom: 1px solid var(--line);
    background: var(--inset-bg);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.rtc-readme__head i {
    color: var(--accent);
}

.rtc-readme__body {
    padding: clamp(1.25rem, 3.5vw, 2.25rem) clamp(1.1rem, 4vw, 2.75rem);
    color: var(--text-2);
    font-size: 1rem;
    line-height: 1.72;
}

/* Plain-text READMEs keep their own spacing: rules, columns, ASCII art */
.rtc-readme__plain {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-variation-settings: 'wdth' 87.5;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 8;
}

/* Long READMEs: a preview that fades into the case, with a button */
.rtc-readme__viewport {
    position: relative;
}

.rtc-readme__viewport.is-clamped {
    max-height: 30rem;
    overflow: hidden;
}

.rtc-readme__viewport.is-clamped::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 7rem;
    background: linear-gradient(180deg, transparent, var(--surface) 92%);
    pointer-events: none;
}

.rtc-readme__more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--line);
    background: var(--inset-bg);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.25s var(--ease), text-shadow 0.25s var(--ease);
}

.rtc-readme__more:hover {
    background: var(--accent-soft);
    text-shadow: 0 0 12px var(--glow);
}

.rtc-readme__more i {
    font-size: 0.7em;
    transition: transform 0.3s var(--ease);
}

.rtc-readme__more i.is-flipped {
    transform: rotate(180deg);
}

/* --- Markdown --- */
.rtc .markdown > :is(p, ul, ol, blockquote, dl) {
    max-width: 75ch;
}

.rtc .markdown :is(h1, h2, h3, h4) {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    border-color: var(--line);
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 700;
    font-variation-settings: 'wdth' 105;
    letter-spacing: -0.015em;
    line-height: 1.25;
    text-wrap: balance;
}

.rtc .markdown h1 {
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line-warm);
    font-size: clamp(1.45rem, 1.2rem + 1.1vw, 1.95rem);
}

.rtc .markdown h2 {
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--line);
    font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.45rem);
}

.rtc .markdown h3 {
    font-size: 1.12rem;
}

.rtc .markdown h4 {
    font-size: 1rem;
}

.rtc .markdown :is(h5, h6) {
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
}

.rtc .markdown > :first-child {
    margin-top: 0;
}

.rtc .markdown a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.25s var(--ease);
}

.rtc .markdown a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

.rtc .markdown strong {
    color: var(--text);
    font-weight: 600;
}

.rtc .markdown li + li {
    margin-top: 0.3rem;
}

.rtc .markdown ul li::marker {
    color: var(--folder);
}

.rtc .markdown ol li::marker {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.8em;
}

.rtc .markdown code {
    padding: 0.12em 0.4em;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--inset-bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.78em;
    font-variation-settings: 'wdth' 87.5;
}

.rtc .markdown pre {
    padding: 1rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--inset-bg);
    box-shadow: inset 0 0 24px var(--accent-soft);
    overflow-x: auto;
    line-height: 1.65;
}

.rtc .markdown pre code {
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.72rem;
}

.rtc .markdown blockquote {
    padding-left: 1rem;
    border-left: 3px solid var(--accent-line);
    color: var(--text-2);
}

.rtc .markdown hr {
    height: 1px;
    margin-block: 2rem;
    border: 0;
    background: linear-gradient(90deg, var(--line-warm), transparent 80%);
}

.rtc .markdown table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rtc .markdown :is(th, td) {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.rtc .markdown th {
    background: var(--inset-bg);
    color: var(--text);
    font-weight: 600;
}

.rtc .markdown img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* highlight.js tokens in the phosphor-and-case palette */
.rtc .markdown .hljs {
    background: transparent;
    color: var(--text);
}

.rtc .markdown :is(.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name, .hljs-section) {
    color: var(--accent);
}

.rtc .markdown :is(.hljs-string, .hljs-attr, .hljs-attribute, .hljs-template-variable, .hljs-addition) {
    color: var(--folder);
}

.rtc .markdown :is(.hljs-number, .hljs-literal, .hljs-variable, .hljs-type, .hljs-title) {
    color: var(--text);
    font-weight: 600;
}

.rtc .markdown :is(.hljs-comment, .hljs-quote, .hljs-meta, .hljs-deletion) {
    color: var(--text-3);
    font-style: italic;
}

/* ============================================================
   FILE INFO
   ============================================================ */

.rtc-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--overlay);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.rtc-modal__dialog {
    position: relative;
    width: min(760px, 100%);
    max-height: calc(100svh - 2rem);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 30px 80px -30px oklch(0 0 0 / 0.8);
    color: var(--text);
}

.rtc-modal__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.85rem 1.15rem;
    border-bottom: 1px solid var(--line);
    background: var(--inset-bg);
}

.rtc-modal__head > i {
    color: var(--accent);
}

.rtc-modal__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-variation-settings: 'wdth' 87.5;
}

.rtc-modal__close {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-3);
    cursor: pointer;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.rtc-modal__close:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.rtc-modal__body {
    padding: 0.6rem 1.15rem 1rem;
}

.rtc-modal__error {
    padding-block: 0.75rem;
    color: var(--text-2);
}

.rtc-hashes {
    width: 100%;
    border-collapse: collapse;
}

.rtc-hashes th {
    padding: 0.7rem 1rem 0.7rem 0;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 2;
    text-transform: uppercase;
    color: var(--text-3);
}

.rtc-hashes td {
    padding: 0.7rem 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-variation-settings: 'wdth' 87.5;
    line-height: 1.7;
    word-break: break-all;
    color: var(--text);
    -webkit-user-select: all;
    user-select: all;
}

.rtc-hashes tr + tr :is(th, td) {
    border-top: 1px solid var(--line);
}

.rtc-modal__spinner {
    font-size: 2.25rem;
    color: var(--accent);
    filter: drop-shadow(0 0 12px var(--glow));
}

/* ============================================================
   ERROR AND EMPTY SEARCH
   ============================================================ */

.rtc-error {
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding-block: clamp(3rem, 12vh, 7rem);
    text-align: center;
}

.rtc-error__label {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 18px var(--glow);
}

.rtc-error__label .rtc-crumbs__caret {
    margin-left: 0;
}

.rtc-error__message {
    max-width: 24ch;
    font-size: clamp(1.5rem, 1.1rem + 2vw, 2.4rem);
    font-weight: 700;
    font-variation-settings: 'wdth' 105;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    text-wrap: balance;
}

.rtc-error__subtext {
    max-width: 48ch;
    color: var(--text-2);
}

.rtc-error__home {
    margin-top: 0.75rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--line-warm);
    border-radius: var(--radius-sm);
    background: var(--search-bg);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--accent);
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.rtc-error__home::before {
    content: '> ';
    color: var(--prompt);
}

.rtc-error__home:hover {
    border-color: var(--accent-line);
    box-shadow: 0 0 18px -6px var(--glow);
}

/* ============================================================
   FOOTER AND BACK-TO-TOP
   ============================================================ */

.rtc-footer {
    border-top: 1px solid var(--line);
    padding-block: clamp(1.25rem, 3vw, 1.75rem) clamp(1.75rem, 4.5vw, 2.75rem);
}

.rtc-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.rtc-footer__legal {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    color: var(--text-3);
}

.rtc-footer__legal a {
    color: var(--text-2);
    transition: color 0.3s var(--ease);
}

.rtc-footer__legal a:hover {
    color: var(--accent);
}

.rtc-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    margin-inline: -0.5rem;
    list-style: none;
}

/* Padded to a 24px-tall hit area */
.rtc-footer__nav a {
    display: inline-block;
    padding: 0.4rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
    color: var(--text-3);
    transition: color 0.3s var(--ease);
}

.rtc-footer__nav a:hover {
    color: var(--accent);
}

.rtc-top {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    pointer-events: none;
}

.rtc-top__inner {
    display: flex;
    justify-content: flex-end;
    padding-block: 1.5rem;
}

.rtc-top__button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-warm);
    border-radius: 10px;
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--accent);
    box-shadow: var(--shadow), inset 0 0 18px var(--accent-soft);
    cursor: pointer;
    pointer-events: auto;
    transition:
        transform 0.3s var(--ease),
        border-color 0.3s var(--ease),
        box-shadow 0.3s var(--ease);
}

.rtc-top__button:hover {
    transform: translateY(-2px);
    border-color: var(--accent-line);
    box-shadow: 0 0 20px -4px var(--glow), var(--shadow);
}

/* ============================================================
   MOTION
   ============================================================ */

@keyframes rtc-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@keyframes rtc-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.8); }
}

/* ============================================================
   SMALL SCREENS
   ============================================================ */

@media (max-width: 959px) {
    /* Too tall to pin on a phone; let it scroll away. */
    .rtc-header {
        position: relative;
    }

    .rtc-header__inner {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "brand . toggle"
            "search search search";
        padding-block: 0.7rem 0.8rem;
    }

    .rtc-header__search {
        max-width: none;
    }

    .rtc-nav {
        display: none;
    }
}

@media (max-width: 640px) {
    .rtc-listing__head,
    .rtc-row {
        grid-template-columns: 2rem minmax(0, 1fr) auto 2rem;
        column-gap: 0.7rem;
    }

    .rtc-listing__col-name {
        grid-column: 2;
    }

    .rtc-listing__col-size,
    .rtc-row__size {
        grid-column: 3;
    }

    .rtc-row__info {
        grid-column: 4;
    }

    .rtc-listing__col-date,
    .rtc-row__date {
        display: none;
    }

    /* 16px stops iOS zooming the page when the field takes focus */
    .rtc-search__input {
        font-size: 16px;
        font-variation-settings: 'wdth' 75;
    }

    .rtc-section-head__note {
        max-width: 45%;
    }
}

@media (max-width: 380px) {
    .rtc-brand__tag {
        display: none;
    }
}

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

    .rtc-crumbs__caret {
        animation: none;
        opacity: 1;
    }
}
