* {
    margin: 0;
}

/* Light blue theme, after the default Silica icon. */
:root {
    --bg: #EEF6FD;
    --text: #14304A;
    --muted: #6B8199;
    --chip: #DDEBF8;
    --chip-text: #3E5A75;
    --sileo: linear-gradient(135deg, #2EB6FF, #3D8BE8);
    --zebra: linear-gradient(135deg, #2F5478, #14304A);
    --zebra-text: #FFFFFF;
    --link: #1F7FD1;
    --card: #FFFFFF;
    --card-border: #D7E7F5;
    --hero: linear-gradient(135deg, #22B2FF, #3D86E0);
}

/* Dark: the system setting, or Sileo's dark mode (set by index.js). */
:root.dark {
    --bg: #0E1A26;
    --text: #E3EEF8;
    --muted: #8EA3B8;
    --chip: #1A2B3B;
    --chip-text: #B5C7D8;
    --sileo: linear-gradient(135deg, #3CC0FF, #2F7FD8);
    --zebra: linear-gradient(135deg, #EAF4FC, #C3D9EC);
    --zebra-text: #14304A;
    --link: #5EC2FF;
    --card: #142333;
    --card-border: #1F3346;
    --hero: linear-gradient(135deg, #1A9BE6, #2F6FC4);
}

body {
    background: var(--bg);
    color: var(--text);
}

a, .tint {
    color: var(--link);
}

.body {
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    margin-top: 20px;
    margin-bottom: 20px;

}

@media only screen and (max-width: 600px) {
    .body {
        margin-left: 20px;
        margin-right: 20px;
    }
    .scroll_view {
        width: calc(100vw - 60px);
    }
}
@media only screen and (min-width: 601px) {
    .body {
        width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    .scroll_view {
        width: calc(500px - 40px);
    }
}

h1, h2, h3, h4, h5, h6, p {
    margin: 2px;
}

.caption {
    color: var(--muted);
    font-size: 16px;
}

.header {
    margin-top: 40px;
    margin-bottom: 25px;
}

.scroll_view {
    overflow-x: scroll;
    overflow-y: hidden;
    margin: 10px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.scroll_view > .card {
    background-color: #ccc;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    padding: 10px;
    margin: 10px;
    border-radius: 10px;
    font-weight: bold;
    height: 125px;
    width: 275px;
    position: relative;
    display: inline-block;
}

.scroll_view > .img_card {
    background-color: #ccc;
    width: 250px;
    margin: 5px;
    border-radius: 10px;
    font-weight: bold;
    position: relative;
    display: inline-block;
}

/* A lone screenshot has nothing to scroll to, so centre it. */
.scroll_view > .img_card:only-child {
    display: block;
    margin: 5px auto;
}

.card > p {
    color: white;
    bottom: 15px;
    left: 15px;
    font-size: 25px;
    position: absolute;
    text-shadow: 0 0 10px rgba(0,0,0,0.8); 
}

.center {
    text-align: center;
}

.left_float {
    float: left;
}

.right_float { 
    float: right;
}

/* Hero card at the top of the index. */
.hero {
    position: relative;
    overflow: hidden;
    margin-top: 24px;
    padding: 22px 20px 24px;
    border-radius: 20px;
    background: var(--hero);
    color: white;
}

.hero:before, .hero:after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.hero:before {
    width: 220px;
    height: 220px;
    top: -90px;
    right: -60px;
}

.hero:after {
    width: 140px;
    height: 140px;
    bottom: -70px;
    left: -40px;
}

.hero > * {
    position: relative;
}

.hero_links {
    position: absolute;
    /* Above the prompt and title, which also span the card's width. */
    z-index: 2;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 0;
}

.hero_link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    /* The transparent border widens the tap target to 44px without changing the look. */
    border: 4px solid transparent;
    background: rgba(255, 255, 255, 0.18) padding-box;
    border-radius: 50%;
    color: white !important;
}

.hero_link svg {
    width: 18px;
    height: 18px;
}

.hero_prompt {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
}

.repo_name {
    font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 38px;
    letter-spacing: -0.5px;
    margin: 6px 0 0;
    line-height: 1.1;
}

.repo_mono {
    font-weight: 600;
}

.repo_word {
    font-weight: 400;
    opacity: 0.8;
}

.cursor {
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.repo_desc {
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    margin: 4px 0 0;
}

.add_buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.add_btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    color: white !important;
}

.add_btn_icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    margin-right: 2px;
}

.add_btn_sileo {
    background: var(--sileo);
}

.add_btn_zebra {
    background: var(--zebra);
    color: var(--zebra-text) !important;
}

.repo_url_row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 10px;
}

.repo_url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--muted);
    background: var(--chip);
    padding: 7px 10px;
    border-radius: 8px;
}

.pill_btn {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--chip-text);
    background: var(--chip);
    border: none;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.add_btn:hover, .pill_btn:hover, a:hover {
    opacity: 0.8;
    cursor: pointer;
}

.package {
    margin-bottom: 40px;
    display: flow-root;
}

.package > img, .package > a > img, .recent_row > img {
    border-radius: 20px;
    width: 75px;
    height: 75px;
    float: left;
}

.package_info {
    margin-left: 90px;
}

.package_name {
    font-weight: bold;
    font-size: 21px;
}

.package_caption {
    margin-top: 7px;
    color: var(--muted);
}

.cell {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--card-border);
}

.cell > .title {
    color: var(--muted);
}

.cell > .title {
    white-space: nowrap;
}

.cell > .text {
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cell > .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
}

h3 {
    margin-top: 15px;
    margin-bottom: 15px;
}

.footer {
    margin-top: 20px;
}

.subtle_link, .subtle_link p, .subtle_link span {
    text-decoration: none;
    color: var(--text);
}

.variants {
    margin-left: 90px;
    margin-top: 8px;
}

.variant_badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--chip-text);
    background: var(--chip);
    padding: 2px 9px;
    margin-right: 6px;
    border-radius: 11px;
}

.recent {
    margin-bottom: 10px;
}

.recent_row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.recent_row > img {
    width: 36px !important;
    height: 36px !important;
    border-radius: 9px !important;
    float: none !important;
    margin-right: 12px;
}

.recent_name {
    font-weight: 600;
    flex: 1;
}

.recent_meta {
    color: var(--muted) !important;
    font-size: 14px;
}

.subtle_link:hover, .subtle_link > *:hover {
    opacity: 0.8;
}

.green {
    color: #00b90c;
}

.red {
    color: #ba0000;
}

.banner_underlay {
    background-size: cover;
    background-position: center;
    height: 150px;
    width: 100%;
    border-radius: 8px;
    z-index: -2;
    margin-bottom: 25px;
    top: 0;
}

.changelog {
    display: none;
}

/* Details / Changelog tabs as a segmented control. */
.nav {
    display: flex;
    gap: 4px;
    margin: 16px 0 0;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.nav_btn {
    flex: 1;
    text-align: center;
    color: var(--muted);
    font-weight: 500;
    padding: 8px 0;
    border-radius: 9px;
    cursor: pointer;
}

.nav_btn.active {
    background: var(--chip);
    color: var(--text);
    font-weight: 600;
    border-bottom: none;
}

.changelog_entry {
    margin-bottom: 18px;
}

a {
    text-decoration: none;
}

.table-btn, .table-btn > div {
    padding-top: 10px;
    padding-bottom: 10px;
}

.table-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.table-btn:after {
    content: "›";
    font-size: 26px;
    line-height: 1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0E1A26;
        --text: #E3EEF8;
        --muted: #8EA3B8;
        --chip: #1A2B3B;
        --chip-text: #B5C7D8;
        --sileo: linear-gradient(135deg, #3CC0FF, #2F7FD8);
        --zebra: linear-gradient(135deg, #EAF4FC, #C3D9EC);
        --zebra-text: #14304A;
        --link: #5EC2FF;
        --card: #142333;
        --card-border: #1F3346;
        --hero: linear-gradient(135deg, #1A9BE6, #2F6FC4);
    }
}

/* Each index section (Featured, Recently Updated, Packages) sits on its own card. */
.section {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-top: 18px;
}

.section_title {
    /* Shrink to the text so the accent line below matches the title's width. */
    width: fit-content;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin: 0 0 16px;
}

.section .scroll_view {
    width: auto;
    margin: 0 -10px;
}

.section .package {
    margin-bottom: 22px;
}

.section .package:last-child, .section .recent_row:last-child {
    margin-bottom: 0;
}

.section .recent {
    margin-bottom: 0;
}

.section .md_view p:last-child, .section .changelog_entry:last-child {
    margin-bottom: 0;
}

.section .scroll_view + .md_view {
    margin-top: 10px;
}

/* Tweak pages: a gradient in the icon's colour (set per page at build time) fading into the page background. */
.tinted {
    --tint: var(--tint-light);
}

.tinted.dark {
    --tint: var(--tint-dark);
}

@media (prefers-color-scheme: dark) {
    .tinted {
        --tint: var(--tint-dark);
    }
}

.tinted body {
    background: linear-gradient(180deg, var(--tint) 0, var(--bg) 560px) no-repeat, var(--bg);
}

.package_search {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    width: 100%;
    font: inherit;
    font-size: 16px;
    color: var(--text);
    background: var(--chip);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 18px;
    outline: none;
}

.package_search:focus {
    border-color: var(--link);
}

.package_search::placeholder {
    color: var(--muted);
}

.package[hidden] {
    display: none;
}

.no_results {
    color: var(--muted);
    text-align: center;
    padding: 10px 0;
}

.footer p {
    margin: 4px 0;
}

.footer_terminal {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.footer_credit {
    font-size: 12px;
    font-style: italic;
}

/* Accent line under section titles, as wide as the title. */
.section_title:after {
    content: "";
    display: block;
    width: 100%;
    height: 3px;
    margin-top: 8px;
    border-radius: 2px;
    background: var(--sileo);
}

.show_more {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 11px 0;
    font: inherit;
    font-weight: 600;
    color: var(--link);
    background: var(--chip);
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.show_more[hidden] {
    display: none;
}

/* Monospace is wider than the system font: smaller sizes so names and rows still fit on a phone. */
.package_name {
    font-size: 17px;
    overflow-wrap: anywhere;
}

.package_caption {
    font-size: 13px;
}

.section_title {
    font-size: 23px;
}

.add_btn {
    font-size: 14px;
}

.recent_name {
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent_meta {
    font-size: 11px;
    white-space: nowrap;
    margin-left: 8px;
}

.repo_desc {
    font-size: 14px;
}

/* Tweak pages: keep the Details/Changelog tabs close to the icon and name. */
.package_head {
    margin-bottom: 0;
}
