html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
body {
    margin: 0;
    background: #f3efe9;
    color: #1c1916;
    font: 15px/1.5 ui-sans-serif, system-ui, sans-serif;
}
a { color: #9a4d12; }
.site-main a:not(.button):not(.external) { text-decoration-color: #9a4d12; }
.site-main a:not(.button):not(.external):hover,
.site-main a:not(.button):not(.external):focus-visible {
    color: transparent;
    background-image: linear-gradient(105deg,
        #9a4d12 0%,
        #9a4d12 34%,
        #ffd7a8 48%,
        #fff1dc 50%,
        #e4570c 56%,
        #9a4d12 68%,
        #9a4d12 100%);
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: pyro-wave 3.4s linear infinite;
}
a.external {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
a.external .ext-icon {
    width: 1.05em;
    height: 1.05em;
    flex: none;
    fill: currentColor;
}
a.button.external .ext-icon { width: 1.15em; height: 1.15em; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.mark {
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
    color: #1c1916;
    font-size: 1.15rem;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topnav-wrap {
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid #e4ddd4;
    background: #fffdfb;
}
.topnav {
    height: 3.4rem;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.35rem;
}
.topnav nav { display: flex; gap: 0.25rem; height: 100%; align-items: stretch; }
.topnav nav a {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    color: #5c564f;
    text-decoration: none;
    font-weight: 650;
    border-bottom: 2px solid transparent;
}
.topnav nav a.is-on { color: #1c1916; border-bottom-color: #ff7a1a; }
.account { margin-left: auto; position: relative; }
.account summary { cursor: pointer; font-weight: 700; list-style: none; padding: 0.35rem 0.15rem; }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: " ▾"; font-weight: 500; color: #8a8178; }
.account .menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    background: white;
    border: 1px solid #e4ddd4;
    border-radius: 10px;
    min-width: 10rem;
    padding: 0.3rem;
    box-shadow: 0 8px 24px rgba(28, 25, 22, 0.08);
}
.account .menu form { margin: 0; }
.lang-switch { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.3rem; padding-bottom: 0.3rem; border-bottom: 1px solid #eee; }
.lang-switch span, .locale-row span { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: #8a8178; padding: 0.2rem 0.55rem; }
button.menu-link.is-on { font-weight: 800; color: #1c1916; }
.locale-row { display: flex; gap: 0.35rem; align-items: center; margin-top: 1.25rem; }
.locale-row form { margin: 0; }
.locale-row button.menu-link { width: auto; padding: 0.2rem 0.35rem; }

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.flashes { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }

.page-head { display: flex; justify-content: space-between; gap: 1.25rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.35rem; }
.page-head h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.page-head p { margin: 0.3rem 0 0; color: #5c564f; }
.back { margin: 0 0 0.6rem; }
.toolbar { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.search { display: flex; gap: 0.75rem; align-items: center; }
.search input { width: 16rem; margin: 0; }

.site-frame {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 3.4rem);
}
.side {
    width: 16.5rem;
    flex: none;
    background: #fffdfb;
    border-right: 1px solid #e4ddd4;
    padding: 1.15rem 0.75rem 2rem;
}
.side-group { margin-top: 1.15rem; }
.side-kicker {
    margin: 0 0.7rem 0.55rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8178;
    font-weight: 700;
}
.side a.nav-link {
    display: block;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    color: #3d3833;
    text-decoration: none;
    font-weight: 600;
}
.side a.nav-link.is-on { background: #fff0e4; color: #1c1916; }
.site-main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 3rem; }
.site-main h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.lede { margin: 0.35rem 0 0; color: #5c564f; max-width: 46rem; }

.url-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.1rem 0 1.25rem;
    padding: 0.7rem 0.7rem 0.7rem 1rem;
    background: #1c1916;
    color: #f6f3ef;
    border-radius: 12px;
}
.url-bar a {
    color: #ffc48a;
    text-decoration: none;
    font-family: ui-monospace, monospace;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}
.url-bar a.external .ext-icon {
    width: 1.35em;
    height: 1.35em;
    padding: 0.18em;
    border-radius: 6px;
    background: rgba(255, 196, 138, 0.16);
    box-sizing: border-box;
}
.url-bar .button { flex: none; color: #fff8f3; font-family: inherit; }
.url-bar a.button.external .ext-icon { background: rgba(255, 248, 243, 0.16); }

.facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fffdfb;
    border: 1px solid #e4ddd4;
    border-radius: 12px;
    overflow: hidden;
}
.facts div { padding: 0.85rem 1.1rem; border-bottom: 1px solid #eee6de; }
.facts div:nth-child(odd) { border-right: 1px solid #eee6de; }
.facts span {
    display: block;
    color: #8a8178;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.facts strong { font-weight: 600; }
.facts small { display: block; margin-top: 0.25rem; color: #5c564f; font-weight: 450; }
.facts code { font-size: 0.92rem; overflow-wrap: anywhere; }
.facts div.wide { grid-column: 1 / -1; border-right: 0; }

.panel {
    background: #fffdfb;
    border: 1px solid #e4ddd4;
    border-radius: 12px;
    overflow: hidden;
}
.panel table { margin: 0; }
table { width: 100%; border-collapse: collapse; margin-top: 1.25rem; }
th, td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid #eee6de; vertical-align: middle; }
th { font-weight: 650; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: #8a8178; background: #faf7f4; }
tr:last-child td { border-bottom: 0; }
td.right, .right { text-align: right; }
.note { color: #5c564f; }

.sheet { max-width: 38rem; }
.actions { display: flex; justify-content: flex-end; gap: 0.5rem; align-items: center; }
.actions-inline { display: flex; justify-content: flex-end; gap: 0.75rem; align-items: center; }
.actions-inline form { margin: 0; }

button, .button {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: #e4570c;
    color: #fff8f3;
    border: 0;
    border-radius: 999px;
    padding: 0.48rem 1rem;
    font: inherit;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-decoration: none;
    text-shadow: 0 1px 1px rgba(90, 24, 0, 0.4);
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 214, 168, 0.7),
        inset 0 -1px 0 rgba(150, 40, 0, 0.45);
}
button::before, .button::before,
button::after, .button::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}
button::before, .button::before {
    background: linear-gradient(105deg,
        transparent 0%,
        transparent 34%,
        rgba(255, 176, 64, 0.2) 44%,
        rgba(255, 236, 196, 0.92) 50%,
        rgba(255, 96, 16, 0.55) 57%,
        transparent 68%,
        transparent 100%);
    background-size: 240% 100%;
    background-position: 120% 0;
}
button::after, .button::after {
    background: linear-gradient(100deg,
        rgba(255, 70, 0, 0) 0%,
        rgba(255, 120, 20, 0.45) 38%,
        rgba(255, 210, 120, 0.35) 62%,
        rgba(160, 28, 0, 0.25) 100%);
    background-size: 240% 100%;
    background-position: 100% 0;
}
button:hover::before, .button:hover::before, button:focus-visible::before, .button:focus-visible::before,
button:hover::after, .button:hover::after, button:focus-visible::after, .button:focus-visible::after {
    opacity: 1;
    animation: pyro-wave 3.4s linear infinite;
}
button:focus-visible, .button:focus-visible {
    outline: 2px solid #9a4d12;
    outline-offset: 3px;
}
@keyframes pyro-wave {
    0% { background-position: 100% 0; }
    12% { background-position: 0% 0; }
    13% { background-position: 100% 0; }
    100% { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
    button:hover::before, .button:hover::before, button:focus-visible::before, .button:focus-visible::before,
    button:hover::after, .button:hover::after, button:focus-visible::after, .button:focus-visible::after {
        animation: none;
        opacity: 1;
    }
    .site-main a:not(.button):not(.external):hover,
    .site-main a:not(.button):not(.external):focus-visible {
        animation: none;
        color: #c2410c;
        background-image: none;
    }
}
button.quiet, .button.quiet, button.menu-link {
    background: transparent;
    color: #9a4d12;
    font-weight: 600;
    letter-spacing: 0;
    text-shadow: none;
    padding: 0.35rem 0.6rem;
    border-color: transparent;
    box-shadow: none;
}
button.quiet:hover, .button.quiet:hover, button.menu-link:hover,
button.quiet:focus-visible, .button.quiet:focus-visible, button.menu-link:focus-visible { box-shadow: none; }
button.quiet::before, .button.quiet::before, button.menu-link::before,
button.quiet::after, .button.quiet::after, button.menu-link::after { display: none; }
button.menu-link { width: 100%; text-align: left; }

.system { max-width: 28rem; margin: 12vh auto; padding: 0 1.25rem; }
.system h1 { margin: 0.2rem 0 0.6rem; }
label { display: block; margin: 0.85rem 0; font-weight: 600; }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid #d9d0c6;
    border-radius: 8px;
    font: inherit;
    font-weight: 450;
    background: white;
}
input[type="radio"], input[type="checkbox"] { width: auto; display: inline-block; margin-top: 0.2rem; }
.flash { background: #fff4e8; border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0; }
.flash.error, .error { color: #9f2d12; }
.flash.error { background: #fde8e2; }
ul.error { padding-left: 1.1rem; }
pre { white-space: pre-wrap; background: #1c1916; color: #f6f3ef; padding: 0.8rem; border-radius: 8px; }
.file-view { max-height: 32rem; overflow: auto; }
.file-editor { max-width: 46rem; }
.file-editor textarea { min-height: 24rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; line-height: 1.45; tab-size: 2; }
tr.is-on td { background: #fff4e8; }
td small.when { display: block; margin-top: 0.15rem; color: #8a8178; font-size: 0.75rem; font-weight: 450; }
.diff { white-space: pre; max-height: 32rem; overflow: auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.crumbs a { text-decoration: none; }
.source-choices { border: 0; margin: 0.85rem 0; padding: 0; display: grid; gap: 0.55rem; }
.source-choices legend { font-weight: 600; padding: 0; margin-bottom: 0.15rem; }
.source-choice { display: grid; grid-template-columns: auto 1fr; gap: 0.65rem; align-items: start; margin: 0; padding: 0.7rem 0.8rem; border: 1px solid #e4ddd4; border-radius: 10px; background: #fffdfb; font-weight: 450; }
.source-choice strong { font-weight: 650; }
.source-choice small, label small.hint { display: block; margin-top: 0.15rem; color: #5c564f; font-weight: 450; }
.source-choice:has(input:checked) { border-color: #1c1916; }
.source-form .for-repository,
.source-form .for-branch,
.source-form .for-path,
.source-form .for-git-fixed,
.source-form .for-directory-hint,
.source-form .for-git-path-hint { display: none; }
.source-form:has(input[value="git"]:checked) .for-git-fixed,
.source-form:has(input[value="git"]:checked) .for-repository,
.source-form:has(input[value="git"]:checked) .for-branch { display: block; }
.source-form:has(input[value="git_path"]:checked) .for-path,
.source-form:has(input[value="git_path"]:checked) .for-repository,
.source-form:has(input[value="git_path"]:checked) .for-branch,
.source-form:has(input[value="git_path"]:checked) .for-git-path-hint { display: block; }
.source-form:has(input[value="directory"]:checked) .for-path,
.source-form:has(input[value="directory"]:checked) .for-directory-hint { display: block; }
#files { margin-top: 1.6rem; }
#files h2 { margin-bottom: 0.4rem; }
code { font-family: ui-monospace, monospace; }

@media (max-width: 800px) {
    .site-frame { flex-direction: column; min-height: 0; }
    .side { width: auto; border-right: 0; border-bottom: 1px solid #e4ddd4; }
    .facts { grid-template-columns: 1fr; }
    .facts div:nth-child(odd) { border-right: 0; }
    .toolbar, .search { margin-left: 0; }
    .search input { width: 100%; }
    .url-bar { align-items: flex-start; flex-direction: column; }
}
