:root {
    --g1: #59b3ff;
    --g2: #3366f2;
    --g3: #382ea6;
    --g4: #0f0a33;
    --accent: #8cc8ff;
    --on-accent: #0f0a33;
    --panel: rgba(10, 10, 44, 0.6);
    --panel-solid: #16154a;
    --footer: #0f0a33;
}

/* help pages for the Files apps, written to <site>/help/help.css by scripts/build-help-pages.py,
   which puts the site's own gradient and accent in front of this as custom properties */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--g4);
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 17px;
    background: linear-gradient(to top, var(--g1), var(--g2) 30%, var(--g3) 62%, var(--g4)) fixed;
}

a, a:visited, a:hover, a:active {
    color: inherit;
}

main a {
    text-decoration-color: currentColor;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

/* navigation chrome stays free of the browser-default underline */
.brand,
.crumbs a,
details.toc > summary,
.toc-panel li a,
nav.paging a,
footer.help-footer a,
a.button,
body.help-index a.topic {
    text-decoration: none;
}

/* layout */

main, header.help-header, nav.paging, footer.help-footer {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

header.help-header {
    padding-top: 18px;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #fff;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.crumbs {
    flex: 1;
    color: rgba(255,255,255, 0.65);
}

.crumbs a {
    color: rgba(255,255,255, 0.9);
}

.crumbs a:hover {
    color: #fff;
}

/* TOC dropdown */

details.toc {
    position: relative;
}

details.toc > summary {
    list-style: none;
    cursor: pointer;
    padding: 6px 12px;
    background: rgba(255,255,255, 0.14);
    border-radius: 8px;
    font-size: 13px;
    user-select: none;
}

details.toc > summary::-webkit-details-marker { display: none; }

details.toc[open] > summary {
    background: rgba(255,255,255, 0.22);
}

details.toc > .toc-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    background: var(--panel-solid);
    border: 1px solid rgba(255,255,255, 0.14);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 270px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0, 0.5);
}

.toc-panel h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255, 0.55);
    margin: 14px 0 4px;
}

.toc-panel h3:first-child { margin-top: 0; }

.toc-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-panel li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 15px;
    color: rgba(255,255,255, 0.9);
}

.toc-panel li a:hover {
    color: #fff;
}

.toc-panel li a[aria-current="page"] {
    font-weight: 600;
    color: var(--accent);
}

.toc-panel .icon {
    opacity: 0.75;
}

/* main */

main {
    padding-top: 28px;
    padding-bottom: 36px;
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(0,0,0, 0.25);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

main h1 {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0 0 18px;
}

main p {
    line-height: 1.55;
    margin: 0 0 1em;
    color: rgba(255,255,255, 0.92);
}

main h2 {
    font-size: 23px;
    font-weight: 650;
    margin: 34px 0 12px;
}

main h3 {
    font-size: 19px;
    font-weight: 650;
    margin: 26px 0 10px;
}

main ul, main ol {
    margin: 0 0 1em;
    padding-left: 1.3em;
}

main li {
    line-height: 1.55;
    margin-bottom: 0.4em;
    color: rgba(255,255,255, 0.92);
}

main strong {
    font-weight: 650;
    color: #fff;
}

main code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86em;
    background: rgba(255,255,255, 0.10);
    padding: 1px 5px;
    border-radius: 4px;
    overflow-wrap: anywhere;
}

main pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86em;
    background: rgba(0,0,0, 0.28);
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    white-space: pre-wrap;
    word-break: break-word;
}

main pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* inline icon */

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
}

/* media block */

figure.media {
    margin: 26px 0;
    text-align: center;
    --natural-w: 100%;
}

figure.media img {
    max-width: min(100%, var(--natural-w));
    max-height: 72vh;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0, 0.45);
}

figure.media.wide img {
    width: 100%;
    max-height: none;
}

/* a window capture with its own rounded corners and shadow */
figure.media.bare img {
    border-radius: 0;
    box-shadow: none;
}

figure.media video {
    display: block;
    width: 100%;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0, 0.45);
    background: #fff;
}

/* an LCD monitor around a desktop screen recording: dark bezel, a deeper chin, a power light */
figure.media .monitor {
    position: relative;
    padding: 2.6% 2.6% 5.4%;
    border-radius: 12px;
    background: linear-gradient(#2c2c2f, #141416 55%, #1d1d20);
    box-shadow: 0 12px 34px rgba(0,0,0, 0.5),
                inset 0 1px 0 rgba(255,255,255, 0.14),
                inset 0 0 0 1px rgba(255,255,255, 0.05);
}

figure.media .monitor video {
    border-radius: 2px;
    box-shadow: 0 0 0 1px #000;
}

figure.media .monitor::after {
    content: "";
    position: absolute;
    right: 3.4%;
    bottom: 2.1%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7fb4ff;
    box-shadow: 0 0 4px #7fb4ff, -16px 0 0 #3a3a3e, -32px 0 0 #3a3a3e, -48px 0 0 #3a3a3e;
}

/* CTA button */

p.cta {
    text-align: center;
    margin: 28px 0;
}

a.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 650;
    font-size: 17px;
    padding: 12px 24px;
    border-radius: 999px;
    box-shadow: 0 3px 12px rgba(0,0,0, 0.25);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

a.button:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(0,0,0, 0.35);
    transform: translateY(-1px);
}

/* prev / next paging */

nav.paging {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding-bottom: 26px;
    font-size: 15px;
}

nav.paging a {
    flex: 1;
    border: 1px solid rgba(255,255,255, 0.18);
    border-radius: 12px;
    padding: 12px 16px;
    background: var(--panel);
    transition: background 0.15s;
}

nav.paging a:hover {
    background: var(--panel-solid);
}

nav.paging a[rel="prev"] { text-align: left; }
nav.paging a[rel="next"] { text-align: right; }

nav.paging a span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255, 0.6);
    margin-bottom: 2px;
}

/* footer */

footer.help-footer {
    text-align: center;
    padding-top: 18px;
    padding-bottom: 34px;
    font-size: 14px;
    color: var(--footer);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

footer.help-footer a {
    color: var(--footer);
}

footer.help-footer a:hover { text-decoration: underline; }

/* topic index */

body.help-index main > p.lead {
    font-size: 19px;
}

body.help-index main h2 {
    font-size: 13px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(255,255,255, 0.6);
    margin: 34px 0 12px;
}

body.help-index .topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

body.help-index .topic {
    display: block;
    border: 1px solid rgba(255,255,255, 0.12);
    border-radius: 14px;
    padding: 14px;
    background: rgba(255,255,255, 0.05);
    transition: background 0.15s, transform 0.15s;
}

body.help-index .topic:hover {
    background: rgba(255,255,255, 0.11);
    transform: translateY(-1px);
}

body.help-index .topic .thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top;
    border-radius: 8px;
    background: rgba(255,255,255, 0.06);
}

body.help-index .topic div.thumb {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.help-index .topic div.thumb .icon {
    width: 42px;
    height: 42px;
    opacity: 0.55;
}

/* a card zoomed in on one part of its screenshot */
body.help-index .topic div.thumb.crop {
    background-repeat: no-repeat;
    background-color: #fff;
}

/* provider cards show the provider's icon instead of a screenshot of the same form */
body.help-index .topic div.thumb.logos {
    gap: 14px;
    flex-wrap: wrap;
    align-content: center;
    padding: 12px;
    position: relative;
    background: rgba(255,255,255, 0.88);
}

body.help-index .topic div.thumb.logos img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

/* the band of the provider's screenshot that differs, veiled so the icon stands out */
body.help-index .topic div.thumb.logos.shot {
    --veil: rgba(246, 242, 248, 0.66);
    background-image: linear-gradient(var(--veil), var(--veil)), var(--shot);
    background-size: cover, cover;
    background-position: center, center var(--focus);
}

body.help-index .topic div.thumb.logos.shot img {
    filter: drop-shadow(0 2px 6px rgba(0,0,0, 0.28));
}

/* one or two icons go in the upper right corner, leaving the screenshot readable below */
body.help-index .topic div.thumb.logos.shot:not(.many) {
    --veil: rgba(246, 242, 248, 0.5);
    justify-content: flex-end;
    align-items: flex-start;
    align-content: flex-start;
    gap: 6px;
    padding: 10px;
}

body.help-index .topic div.thumb.logos.shot:not(.many) img {
    width: 44px;
    height: 44px;
}

body.help-index .topic div.thumb.logos.many img {
    width: 40px;
    height: 40px;
}

body.help-index .topic div.thumb.logos .badge {
    position: absolute;
    right: 10px;
    bottom: 8px;
    color: #333;
}

body.help-index .topic div.thumb.logos .badge .icon {
    width: 26px;
    height: 26px;
    opacity: 0.8;
}

body.help-index .topic h3 {
    margin: 10px 0 4px;
    font-size: 17px;
    font-weight: 650;
    display: flex;
    align-items: center;
    gap: 6px;
}

body.help-index .topic p {
    font-size: 13px;
    margin: 0;
    color: rgba(255,255,255, 0.75);
    line-height: 1.4;
}

/* phones */

@media screen and (max-width: 600px) {
    main h1 { font-size: 29px; }
    main, header.help-header, nav.paging, footer.help-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    main {
        border-radius: 0;
    }
    nav.paging { flex-direction: column; }
    details.toc > .toc-panel {
        position: fixed;
        left: 16px;
        right: 16px;
        top: 64px;
        min-width: 0;
    }
}
