/* D Flåg: Material 3 hand-written CSS (dflag.se front page, Hästsko, Carlberg & Wahlberg, Hochen & Jochen).
   Tones self-check in test_site. */

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2");
}

:root {
    color-scheme: light dark;
    --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --max: 820px;
    --gutter: max(16px, env(safe-area-inset-left));
    --gutter-r: max(16px, env(safe-area-inset-right));
    --scrim: rgb(0 0 0 / 0.55);
}

/* tones (light). The first is the default; the others with ?ton=<name>. All pairs pass WCAG (test_site).
   vatten: Flågvattnet, the lake the band is named after; gran: the spruce around it; rubin: the logo's red. */

:root,
:root[data-tone="vatten"] {
    --primary: #226677;
    --on-primary: #ffffff;
    --container: #c2eaf4;
    --on-container: #062932;
    --bg: #f6fafb;
    --surface: #f0f6f7;
    --surface-high: #e4edef;
    --text: #162022;
    --text-2: #425357;
    --outline: #6a7c81;
    --accent: #fcd592;
    --on-accent: #392605;
    --inverse: #2a383c;
    --on-inverse: #f0f4f5;
}

:root[data-tone="gran"] {
    --primary: #22774d;
    --on-primary: #ffffff;
    --container: #c2f4db;
    --on-container: #06321c;
    --bg: #f6fbf8;
    --surface: #f0f7f3;
    --surface-high: #e4efea;
    --text: #16221c;
    --text-2: #42574d;
    --outline: #6a8176;
    --accent: #fcd992;
    --on-accent: #392805;
    --inverse: #2a3c33;
    --on-inverse: #f0f5f2;
}

:root[data-tone="rubin"] {
    --primary: #77222d;
    --on-primary: #ffffff;
    --container: #f4c2c9;
    --on-container: #32060c;
    --bg: #fbf6f7;
    --surface: #f7f0f1;
    --surface-high: #efe4e5;
    --text: #221618;
    --text-2: #574245;
    --outline: #816a6d;
    --accent: #fcd992;
    --on-accent: #392805;
    --inverse: #3c2a2c;
    --on-inverse: #f5f0f1;
}

@media (prefers-color-scheme: dark) {
    :root,
    :root[data-tone="vatten"] {
        --primary: #8ed0e1;
        --on-primary: #083c49;
        --container: #225562;
        --on-container: #c2e7f0;
        --bg: #0a1417;
        --surface: #162225;
        --surface-high: #222f32;
        --text: #e1e8ea;
        --text-2: #c0cbce;
        --outline: #84969a;
        --accent: #5e4926;
        --on-accent: #f6e3c1;
        --inverse: #e1e8ea;
        --on-inverse: #2a383c;
    }

    :root[data-tone="gran"] {
        --primary: #8ee1b8;
        --on-primary: #084929;
        --container: #226242;
        --on-container: #c2f0d9;
        --bg: #0a1710;
        --surface: #16251e;
        --surface-high: #22322a;
        --text: #e1eae5;
        --text-2: #c0cec7;
        --outline: #849a8f;
        --accent: #5e4b26;
        --on-accent: #f6e4c1;
        --inverse: #e1eae5;
        --on-inverse: #2a3c33;
    }

    :root[data-tone="rubin"] {
        --primary: #e18e99;
        --on-primary: #490811;
        --container: #62222b;
        --on-container: #f0c2c8;
        --bg: #170a0c;
        --surface: #251618;
        --surface-high: #322224;
        --text: #eae1e2;
        --text-2: #cec0c2;
        --outline: #9a8487;
        --accent: #5e4b26;
        --on-accent: #f6e4c1;
        --inverse: #eae1e2;
        --on-inverse: #3c2a2c;
    }

}

@media (prefers-color-scheme: dark) {
    :root {
        --scrim: rgb(0 0 0 / 0.7);
    }
}

/* ---------------------------------------------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 76px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.6 var(--font);
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
    font-weight: 800;
}

p {
    margin: 0;
}

a {
    color: var(--primary);
}

img {
    max-width: 100%;
    display: block;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

.icon {
    width: 24px;
    height: 24px;
    flex: none;
    fill: currentColor;
}

.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;
}

/* top bar + nav ------------------------------------------------------------------------------------------------- */

.app-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 60px;
    padding: calc(env(safe-area-inset-top) + 8px) var(--gutter-r) 8px var(--gutter);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: saturate(1.3) blur(10px);
    backdrop-filter: saturate(1.3) blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--outline) 22%, transparent);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}

.brand__mark {
    width: 30px;
    height: 30px;
    fill: var(--primary);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 20px;
    color: var(--text-2);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
}

.nav a:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
}

/* buttons ------------------------------------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 24px;
    font-weight: 700;
    font-size: 16px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.btn .icon {
    width: 20px;
    height: 20px;
    margin-left: -4px;
}

.btn.filled {
    background: var(--primary);
    color: var(--on-primary);
}

.btn.filled:hover {
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
    background: color-mix(in srgb, var(--primary) 92%, var(--on-primary));
}

.btn.tonal {
    background: var(--container);
    color: var(--on-container);
}

.btn.tonal:hover {
    background: color-mix(in srgb, var(--container) 90%, var(--on-container));
}

.btn.text {
    background: transparent;
    color: var(--primary);
    padding: 0 12px;
    min-height: 40px;
}

.btn.text:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

/* layout -------------------------------------------------------------------------------------------------------- */

main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px var(--gutter-r) calc(40px + env(safe-area-inset-bottom)) var(--gutter);
}

.section {
    margin-top: 40px;
    scroll-margin-top: 76px;
}

.section__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}

.section__head h2 {
    font-size: 26px;
}

.overline {
    color: var(--primary);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card {
    background: var(--surface);
    border-radius: 24px;
    padding: 20px;
}

.prose p + p {
    margin-top: 14px;
}

.prose {
    color: var(--text);
    font-size: 17px;
}

.lead {
    color: var(--text-2);
    font-size: 18px;
}

/* hero ---------------------------------------------------------------------------------------------------------- */

.hero {
    position: relative;
    margin-top: 12px;
    border-radius: 28px;
    overflow: hidden;
    background: var(--inverse);
    color: var(--on-inverse);
    isolation: isolate;
}

.hero__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -2;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, color-mix(in srgb, var(--inverse) 35%, transparent) 0%, color-mix(in srgb, var(--inverse) 88%, transparent) 100%);
}

.hero__body {
    padding: 120px 24px 26px;
    display: grid;
    gap: 10px;
}

.hero__kicker {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--on-inverse) 82%, transparent);
}

.hero h1 {
    font-size: clamp(32px, 9vw, 52px);
    letter-spacing: -0.01em;
}

.hero__text {
    max-width: 42ch;
    font-size: 17px;
    color: color-mix(in srgb, var(--on-inverse) 90%, transparent);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.hero__actions .btn.tonal {
    background: color-mix(in srgb, var(--on-inverse) 92%, transparent);
    color: var(--inverse);
}

/* the secondary action sits on the dark hero, so it is light, not the primary colour */
.hero__actions .btn.text {
    color: var(--on-inverse);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hero__actions .btn.text:hover {
    background: color-mix(in srgb, var(--on-inverse) 16%, transparent);
}

/* songs --------------------------------------------------------------------------------------------------------- */

.tracks {
    display: grid;
    gap: 12px;
}

.track {
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 18px;
}

.track__top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.track__num {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--container);
    color: var(--on-container);
    font-weight: 800;
    font-size: 15px;
}

.track__title {
    font-size: 18px;
    font-weight: 800;
    flex: 1;
    min-width: 0;
}

.track__title small {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-2);
}

.track audio {
    width: 100%;
    margin-top: 12px;
    height: 40px;
}

.track__missing {
    margin-top: 10px;
    color: var(--text-2);
    font-size: 14px;
    font-style: italic;
}

.track__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

details.lyrics {
    margin-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--outline) 22%, transparent);
    padding-top: 8px;
}

details.lyrics > summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: var(--primary);
    font-weight: 700;
    font-size: 15px;
}

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

details.lyrics > summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 6px solid currentColor;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transition: transform 0.15s;
}

details.lyrics[open] > summary::before {
    transform: rotate(90deg);
}

.lyrics pre {
    margin: 8px 0 4px;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--text);
}

.lyrics .chord {
    color: var(--primary);
    font-weight: 700;
}

.lyrics__meta {
    color: var(--text-2);
    font-size: 13px;
    margin-top: 6px;
}

/* gallery + CSS-only lightbox ----------------------------------------------------------------------------------- */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.gallery a {
    display: block;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--surface-high);
}

.gallery a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.gallery a:hover img {
    transform: scale(1.04);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    place-items: center;
    padding: 20px;
    background: var(--scrim);
}

.lightbox:target {
    display: grid;
}

.lightbox__img {
    max-width: min(92vw, 1000px);
    max-height: 86vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.5);
}

.lightbox__close {
    position: absolute;
    inset: 0;
    cursor: zoom-out;
}

.lightbox__x {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 12px);
    right: 16px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--inverse) 80%, transparent);
    color: var(--on-inverse);
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
}

/* people (about) ------------------------------------------------------------------------------------------------ */

.people {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.person {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px;
}

.person img {
    width: 76px;
    height: 76px;
    border-radius: 16px;
    object-fit: cover;
    flex: none;
}

.person__name {
    font-size: 18px;
    font-weight: 800;
}

.person__meta {
    color: var(--text-2);
    font-size: 14px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 8px;
    background: var(--surface-high);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 700;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* footer -------------------------------------------------------------------------------------------------------- */

.footer {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid color-mix(in srgb, var(--outline) 22%, transparent);
    color: var(--text-2);
    font-size: 14px;
    display: grid;
    gap: 6px;
}

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

/* 404 ----------------------------------------------------------------------------------------------------------- */

.notfound {
    display: grid;
    justify-items: center;
    gap: 14px;
    text-align: center;
    padding: 56px 20px;
    margin-top: 16px;
    border-radius: 28px;
    background: var(--container);
    color: var(--on-container);
}

.notfound h1 {
    font-size: 32px;
}

/* small spacing helpers (no inline styles; CSP forbids them) */
.section > .lead {
    margin-bottom: 16px;
}

.section > .card + .card,
.people + .card {
    margin-top: 14px;
}

/* no sideways scrolling, and a tighter app-bar on narrow phones so the nav never gets clipped */
body {
    overflow-x: clip;
}

@media (max-width: 460px) {
    /* the app-bar has two rows here (about 92 px), so a part opened from the nav starts below it */
    html {
        scroll-padding-top: 108px;
    }
    .section {
        scroll-margin-top: 108px;
    }
    .brand {
        font-size: 16px;
    }
    .brand__mark {
        width: 26px;
        height: 26px;
    }
    /* the nav drops to its own full-width row under the brand, so nothing is clipped */
    .nav {
        flex-basis: 100%;
        gap: 0;
        margin-left: -9px;
    }
    .nav a {
        padding: 0 9px;
        font-size: 14px;
    }
}

/* D Flåg ------------------------------------------------------------------------------------------------------- */

/* the lake photo is wide (1600 x 512): keep the trees and the water in view on phones */
.hero__media {
    object-position: 60% 40%;
}

.hero__caption {
    font-size: 13px;
    color: color-mix(in srgb, var(--on-inverse) 78%, transparent);
}

.section__sub {
    margin: 26px 0 12px;
    font-size: 20px;
}

/* the album cards in the archive */
.albums {
    display: grid;
    gap: 14px;
}

.album {
    background: var(--surface);
    border-radius: 24px;
    padding: 18px;
}

.album__head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.album__cover {
    flex: none;
    display: block;
    width: 88px;
    height: 88px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-high);
}

.album__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album__title {
    font-size: 20px;
}

.album__year {
    display: block;
    margin-top: 2px;
    color: var(--text-2);
    font-weight: 700;
    font-size: 14px;
}

.album__disc {
    margin: 16px 0 4px;
    color: var(--primary);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.album__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tracklist {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.tracklist li {
    display: grid;
    grid-template-columns: 30px 1fr;
    column-gap: 8px;
    align-items: baseline;
    padding: 6px 0;
    color: var(--text-2);
}

.tracklist li + li {
    border-top: 1px solid color-mix(in srgb, var(--outline) 16%, transparent);
}

.tracklist__num {
    color: var(--text-2);
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.tracklist__title {
    min-width: 0;
}

/* a track that can be played: the title in full colour, the player and the download under it */
.tracklist li.has-audio {
    color: var(--text);
}

.tracklist li.has-audio .tracklist__title {
    font-weight: 700;
}

.tracklist audio {
    grid-column: 2;
    width: 100%;
    height: 40px;
    margin-top: 8px;
}

.tracklist .btn.text {
    grid-column: 2;
    justify-self: start;
    margin-left: -12px;
}

/* the news, newest first */
.news {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.news li {
    background: var(--surface);
    border-radius: 20px;
    padding: 14px 18px;
}

.news time,
.news__date {
    display: inline-block;
    margin-bottom: 4px;
    padding: 2px 10px;
    border-radius: 8px;
    background: var(--container);
    color: var(--on-container);
    font-weight: 800;
    font-size: 13px;
}

.note {
    margin-top: 12px;
    color: var(--text-2);
    font-size: 14px;
}

/* the old logo on the old page's own light grey */
.logo {
    display: block;
    width: min(100%, 283px);
    height: auto;
    border-radius: 14px;
    background: #d3d3d3;
    margin-bottom: 16px;
}

.person--text {
    align-items: flex-start;
}

.person__text {
    margin-top: 6px;
    color: var(--text);
    font-size: 15.5px;
}

.people--wide {
    grid-template-columns: 1fr;
}

.person--wide {
    align-items: flex-start;
}

.person--wide img {
    width: 96px;
    height: 124px;
}

.card + .people {
    margin-top: 14px;
}

/* six photos: three in a row on wider screens, two on phones (no lone photo on its own row) */
@media (min-width: 600px) {
    .gallery--3 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* the archive's player and its download on one row */
    .tracklist li {
        grid-template-columns: 30px 1fr auto;
    }

    .tracklist__title {
        grid-column: 2 / span 2;
    }

    .tracklist .btn.text {
        grid-column: 3;
        align-self: center;
        margin: 8px 0 0 6px;
    }
}

@media (max-width: 599px) {
    .gallery--3 {
        grid-template-columns: repeat(2, 1fr);
    }
}
