/* The Six Finger Punch shell, shared by every project: the badge and its info window, the bar and its menus.
   Copied in by bin/new from templates/shell. Improvements go back there. */
:root {
    --bg: #2a2a2f;
    --ink: #f1f1f3;
    --punch: #fffc00;
    --glass: rgba(22, 22, 28, 0.6);
    --gap: max(16px, env(safe-area-inset-bottom));
}

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--bg);
    color: var(--ink);
    font: 600 13px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    -webkit-user-select: none;
    user-select: none;
}

#badge {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    width: 40px;
    opacity: 0.85;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
    transition: opacity 0.2s, transform 0.2s;
}

#badge:hover { opacity: 1; transform: scale(1.06) rotate(-4deg); }
#badge img { display: block; width: 100%; height: auto; }

/* The badge's hexagon border, thin, over glass: a Punch Yellow band between black lines, with cut corners.
   The rings are octagons with an octagon hole; each cut moves in by 0.414 of the inset, keeping the band even. */
.frame {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    clip-path: polygon(8px 0px, calc(100% - 8px) 0px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0px calc(100% - 8px), 0px 8px);
}

.frame::before, .frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.frame::before {
    background: #000;
    clip-path: polygon(evenodd, 8px 0px, calc(100% - 8px) 0px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0px calc(100% - 8px), 0px 8px, 8px 0px,
        9.656px 4px, calc(100% - 9.656px) 4px, calc(100% - 4px) 9.656px, calc(100% - 4px) calc(100% - 9.656px), calc(100% - 9.656px) calc(100% - 4px), 9.656px calc(100% - 4px), 4px calc(100% - 9.656px), 4px 9.656px, 9.656px 4px);
}

.frame::after {
    background: var(--punch);
    clip-path: polygon(evenodd, 8.414px 1px, calc(100% - 8.414px) 1px, calc(100% - 1px) 8.414px, calc(100% - 1px) calc(100% - 8.414px), calc(100% - 8.414px) calc(100% - 1px), 8.414px calc(100% - 1px), 1px calc(100% - 8.414px), 1px 8.414px, 8.414px 1px,
        9.242px 3px, calc(100% - 9.242px) 3px, calc(100% - 3px) 9.242px, calc(100% - 3px) calc(100% - 9.242px), calc(100% - 9.242px) calc(100% - 3px), 9.242px calc(100% - 3px), 3px calc(100% - 9.242px), 3px 9.242px, 9.242px 3px);
}

#bar {
    bottom: var(--gap);
    display: flex;
    gap: 2px;
    padding: 8px 10px;
}

/* Long-press menus, above the button that opened them. A panel for the selected thing sits in the same spot. */
.menu, .panel {
    bottom: calc(var(--gap) + 66px);
    z-index: 2;
}

.menu {
    display: flex;
    gap: 2px;
    padding: 8px 10px;
}

.panel {
    width: min(340px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu[hidden], .panel[hidden] { display: none; }

#bar .icon { -webkit-touch-callout: none; }

button {
    font: inherit;
    color: var(--ink);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 40px;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.icon:hover, .icon.on { color: var(--punch); }
.icon:active { color: #000; background: var(--punch); }
.icon.busy svg { animation: pulse 0.7s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.3; } }

input[type=range] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 28px;
    background: none;
    margin: 0 6px;
}

input[type=range]::-webkit-slider-runnable-track { height: 2px; background: rgba(255, 255, 255, 0.35); }
input[type=range]::-moz-range-track { height: 2px; background: rgba(255, 255, 255, 0.35); }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -7px;
    background: var(--punch);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 0;
    background: var(--punch);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

#bar, #badge { z-index: 2; }

/* The info window, opened from the badge. */
#about {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(10, 10, 14, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

#about[hidden] { display: none; }

.window {
    position: relative;
    left: auto;
    transform: none;
    width: min(540px, 100%);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    font: 400 16px/1.6 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    color: #e6e6ea;
    -webkit-user-select: text;
    user-select: text;
}

/* The text scrolls inside the frame, so the border stays put on short screens. */
.window .inner { overflow-y: auto; padding: 34px 38px 30px; }

.window header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.window .wordmark { display: block; height: 40px; width: auto; flex-shrink: 0; }

.window h1 {
    margin: 0;
    font: 700 56px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.01em;
    color: #fff;
}

.window .version {
    margin: 10px 0 22px;
    font: 500 13px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--punch);
}

.window p { margin: 0 0 14px; text-wrap: balance; }

.window .sign {
    margin: 22px 0 0;
    text-align: right;
    font-weight: 500;
    color: #fff;
}

.window .sign a {
    color: var(--punch);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 252, 0, 0.4);
}

.window .sign a:hover { border-bottom-color: var(--punch); }

@media (max-width: 480px) {
    .window { font-size: 15px; }
    .window .inner { padding: 28px 24px 24px; }
    .window h1 { font-size: 44px; }
    .window .wordmark { height: 30px; }
}
