/* ── Design tokens ──────────────────────────────────────────── */
@font-face {
    font-family: "SpaceGrotesk";
    src: url("fonts/SpaceGrotesk-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Newspaper";
    src: url("fonts/NewspaperCutoutWhiteOnBlac-Rg.ttf") format("truetype");
    font-style: normal;
    font-display: swap;
}

:root {
    --panel-bg: rgba(8, 12, 20, 0.66);
    --panel-blur: 6px;
    --panel-border-radius: 6px;

    --black:   #0D0D0D;
    --white:   #d2d7e0;
    --glass: #edf0f507;
    --slate:   #68707e;
    --accent:  #4d78bd;
    --warning: #551e2d;

    --legend-swatch-size: 1rem;

    --legend-graar: #050505;
    --legend-dance: #27416B;
    --legend-chill: #42617A;
    --legend-kindaboring: #66506A;
    --legend-boring:      #6A425C;
    --legend-defboring:   #70304A;
    --legend-why: #3A0D1F;

    --font-body: SpaceGrotesk, system-ui, sans-serif;
    --font-newspaper: Newspaper, system-ui, sans-serif;

    --max-w: 666px;
    --gap:   clamp(1rem, 6vw, 2.5rem);

    --day-stack-border-radius: 12px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Rotating background ────────────────────────────────────── */
body {
    min-height: 100dvh;
    background-color: var(--black);
    color: var(--glass);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow-x: hidden;
    position: relative;
}

/* The rotating element lives behind everything */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;

    width: 200vmax;
    height: 200vmax;

    background-image: url("img/sasto-trim.webp");
    background-size: cover;
    animation: bg-rotate 2026s linear infinite backwards;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    filter: saturate(0.5);
}

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
}

@keyframes bg-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Stack children above the background */
header, main, footer { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────────────────── */
header {
    padding: 0.6rem clamp(1rem, 6vw, 3rem);
    border-bottom: 1px solid var(--glass);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    background: var(--panel-bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-direction: column;
}

header h1 {
    font-size: clamp(1.5rem, 5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    color: var(--white);
}

header h1 cutout0 {
    display: inline-block;
    font-family: var(--font-newspaper);
    letter-spacing: 0.15em;
    color: var(--legend-boring);
    transform: rotate(3deg) scale(120%);
}

header h1 cutout1 {
    display: inline-block;
    font-family: var(--font-newspaper);
    letter-spacing: 0.15em;
    line-height: 1.1;
    color: var(--slate);
    transform: rotate(-9deg) scale(141%);
}

header h1 cutout2 {
    display: inline-block;
    font-family: var(--font-newspaper);
    letter-spacing: 0.15em;
    line-height: 0.9;
    color: var(--legend-kindaboring);
    transform: rotate(2deg) scale(126%);
}

.header-sub {
    font-size: 0.9rem;
    color: var(--slate);
    margin-top: 0.25rem;
    text-align: center;
}

header a {
        color: var(--accent);
        text-decoration: none;
        transition: opacity 0.15s;
    }
    header a:hover, header a:focus-visible { opacity: 0.75; text-decoration: underline; }

/* ── Main ───────────────────────────────────────────────────── */
main {
    padding: var(--gap) clamp(1rem, 6vw, 3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--gap) * 1.2);
}

/* ── Chart ─────────────────────────────────────────────────── */
.chart {
    width: 100%;
    display: flex;
    flex-direction: column;
    max-width: var(--max-w);
    background: var(--panel-bg);
    border: 1px solid var(--glass);
    border-radius: var(--panel-border-radius);
    padding: clamp(0.5rem, 4vw, 2rem);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chart h2 {
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--white);
    display: flex;
    align-self: center;
}

.chart-wrap {
    width: 90%;
    align-self: center;
    height: 333px;
    padding: clamp(0.5rem, 4vw, 2rem);

    display: flex;
    gap: clamp(1rem, 4vw, 2rem);
    justify-content: flex-end;

    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.day {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.day-stack {
    flex: 1;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    height: 100%;
    border-radius: var(--day-stack-border-radius);
    position: relative;
    overflow: hidden;

    border: 1px solid rgba(0,0,0,0.15);
    border-style: outset;

    background: rgba(11, 17, 32, 0.25);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -10px 30px rgba(0,0,0,0.35);
}

.day-stack::before {
    content: '';
    position: absolute;
    inset: 0;

    background: linear-gradient(
    135deg,
    rgba(255,255,255,0.35),
    rgba(255,255,255,0.05) 30%,
    transparent 60%
    );

    pointer-events: none;
}

.day-stack::after {
    content: '';
    position: absolute;
    inset: 0;

    border-radius: var(--day-stack-border-radius);

    box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset -10px -20px 40px rgba(0,0,0,0.25);

    pointer-events: none;
}

.day-label {
    text-align: center;
    font-weight: 400;
    color: var(--white);
}

.bar {
    width: 100%;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bar::before {
    content: '';
    position: absolute;
    inset: 0;

    background: linear-gradient(
    to right,
    rgba(255,255,255,0.18),
    transparent 40%,
    transparent 60%,
    rgba(0,0,0,0.15)
    );

    pointer-events: none;
}

.bar.graar { background: var(--legend-graar); }
.bar.dance { background: var(--legend-dance); }
.bar.chill { background: var(--legend-chill); }
.bar.TBD { 
    background: repeating-conic-gradient(
    var(--legend-graar) 0% 25%,
    var(--legend-kindaboring) 0% 50%
    );
    background-size: 8px 8px;
}
.bar.kindaboring { background: var(--legend-kindaboring); }
.bar.boring { background: var(--legend-boring); }
.bar.defboring { background: var(--legend-defboring); }
.bar.why { background: var(--legend-why); }

/* ── Legend ─────────────────────────────────────────────────── */
.legend {
    width: 100%;
    max-width: calc(var(--max-w)*0.5);
    background: var(--panel-bg);
    border: 1px solid var(--glass);
    border-radius: var(--panel-border-radius);
    padding: clamp(1rem, 4vw, 1.75rem);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.legend h2 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: 0.5rem;
}

.legend-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.legend-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.legend-swatch {
    flex-shrink: 0;
    width: calc(var(--legend-swatch-size)*2);
    height: var(--legend-swatch-size);
    border: 1px solid var(--slate);
    border-radius: 3px;
    margin-top: 4px;
}

.legend-swatch.checkered {
    background: repeating-conic-gradient(
        var(--legend-graar) 0% 25%,
        var(--legend-kindaboring) 0% 50%
    );
    background-size: 8px 8px;
}

.legend-label {
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--white);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
    padding: 0.6rem clamp(1rem, 6vw, 3rem);
    border-top: 1px solid var(--glass);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    background: var(--panel-bg);
    display: flex;
    align-items: center;
    flex-direction: column;
}

footer p {
    font-size: 0.8rem;
    color: var(--slate);
}

footer a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.15s;
}
footer a:hover, footer a:focus-visible { opacity: 0.75; text-decoration: underline; }

/* ── Accessible focus rings ─────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}