/* hj: Material 3 hand-written CSS (dflag.se front page + Hästsko). 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). */
:root,
:root[data-tone="rymd"] {
    --primary: #222b77;
    --on-primary: #ffffff;
    --container: #c2c7f4;
    --on-container: #060a32;
    --bg: #f6f6fb;
    --surface: #f0f0f7;
    --surface-high: #e4e5ef;
    --text: #161722;
    --text-2: #424457;
    --outline: #6a6c81;
    --accent: #fce292;
    --on-accent: #392c05;
    --inverse: #2a2c3c;
    --on-inverse: #f0f0f5;
}

:root[data-tone="strid"] {
    --primary: #77222e;
    --on-primary: #ffffff;
    --container: #f4c2c9;
    --on-container: #32060c;
    --bg: #fbf6f7;
    --surface: #f7f0f1;
    --surface-high: #efe4e5;
    --text: #221618;
    --text-2: #574245;
    --outline: #816a6d;
    --accent: #f5aea3;
    --on-accent: #390c05;
    --inverse: #3c2a2c;
    --on-inverse: #f5f0f1;
}

:root[data-tone="sol"] {
    --primary: #776022;
    --on-primary: #ffffff;
    --container: #f4e7c2;
    --on-container: #322706;
    --bg: #fbfaf6;
    --surface: #f7f5f0;
    --surface-high: #efece4;
    --text: #221f16;
    --text-2: #575142;
    --outline: #817b6a;
    --accent: #fae39e;
    --on-accent: #392c05;
    --inverse: #3c372a;
    --on-inverse: #f5f3f0;
}

@media (prefers-color-scheme: dark) {
    :root,
    :root[data-tone="rymd"] {
        --primary: #8e96e1;
        --on-primary: #080f49;
        --container: #222962;
        --on-container: #c2c6f0;
        --bg: #0a0b17;
        --surface: #161725;
        --surface-high: #222332;
        --text: #e1e2ea;
        --text-2: #c0c2ce;
        --outline: #84869a;
        --accent: #5e5026;
        --on-accent: #f6e9c1;
        --inverse: #e1e2ea;
        --on-inverse: #2a2c3c;
    }

    :root[data-tone="strid"] {
        --primary: #e18e99;
        --on-primary: #490811;
        --container: #62222b;
        --on-container: #f0c2c8;
        --bg: #170a0c;
        --surface: #251618;
        --surface-high: #322224;
        --text: #eae1e3;
        --text-2: #cec0c2;
        --outline: #9a8487;
        --accent: #5e2e26;
        --on-accent: #f6c8c1;
        --inverse: #eae1e3;
        --on-inverse: #3c2a2c;
    }

    :root[data-tone="sol"] {
        --primary: #e1cb8e;
        --on-primary: #493808;
        --container: #625122;
        --on-container: #f0e3c2;
        --bg: #17140a;
        --surface: #252116;
        --surface-high: #322e22;
        --text: #eae7e1;
        --text-2: #cecac0;
        --outline: #9a9484;
        --accent: #5e5026;
        --on-accent: #f6e9c1;
        --inverse: #eae7e1;
        --on-inverse: #3c372a;
    }

}

@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) 88%, transparent);
    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);
}

/* two portraits side by side in the hero (Hochen & Jochen) */
.hero--twins .hero__media {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: auto;
    gap: 0;
}

.hero--twins .hero__media img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.hero--twins::after {
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, color-mix(in srgb, var(--inverse) 92%, transparent) 100%);
}

.hero--twins .hero__body {
    padding-top: 26px;
    margin-top: -2px;
}

/* 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;
}

/* the adventure story (Hochen & Jochen) */
.story {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 17px;
    line-height: 1.75;
    color: var(--text);
}

/* 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) {
    .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;
    }
}
