/* Fonts, design tokens and the site header live in header.css, shared with the admin. */
:root {
    /* Legacy names still used by admin-styled grids and side boxes. */
    --link-color: var(--link);
    --grid-header-bg: var(--navy);
    --grid-header-fg: #fff;
    --grid-alt-bg: #f3f6f9;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    font-feature-settings: "kern";
    text-rendering: optimizeLegibility;
}

::selection { background: var(--yellow); color: var(--navy-ink); }

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: .18em;
}
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { color: var(--navy-ink); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem); margin: 0 0 1rem; }
h2 { font-size: 1.5rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.25rem; }
img { max-width: 100%; height: auto; }
iframe, video { max-width: 100%; }
time, .num, table { font-variant-numeric: tabular-nums; }

.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 10;
    padding: .6rem 1rem; background: var(--yellow); color: var(--navy-ink); font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* Header: see header.css. The tabs are public only. */
.nav-login, .nav-admin { display: none; }

.tabs { background: var(--navy-deep); }
.tabs ul { list-style: none; margin-block: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.tabs a {
    display: flex; align-items: center; min-height: 3rem; padding: 0 .9rem;
    color: rgba(255, 255, 255, .88); font-weight: 600; font-size: 1.05rem; text-decoration: none;
    box-shadow: inset 0 -3px 0 transparent;
}
.tabs li:first-child a, .tabs .nav-admin + li a { margin-left: -.9rem; }
.tabs a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.tabs a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--yellow); }
.tabs .ext-icon, .optional .ext-icon { width: .85rem; height: .85rem; margin-left: .35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
/* Columns: main first in source order, so mobile shows the content first. */
.columns {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    grid-template-areas: "left main";
    gap: 1.5rem;
    padding-block: 1.5rem 3rem;
}
.columns.single { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
/* News, articles and pages: the text column is exactly --measure wide and the left boxes get the room that frees up. */
@media (min-width: 961px) {
    .columns.reading:not(.single) { grid-template-columns: 20rem minmax(0, var(--measure)); }
    /* A page with a table: the white box grows to fit the table, and the page itself scrolls sideways if the screen is too narrow. */
    .columns.reading:has(.block-table) { grid-template-columns: 20rem max-content; }
    /* Wider than the viewport: auto margins collapse to 0 so the page starts at the far left instead of the centered offset. */
    .wrap.columns.reading:has(.block-table) { width: max-content; min-width: min(100%, var(--wrap)); max-width: none; }
    .columns.reading.single:has(.block-table) { grid-template-columns: max-content; }
    .columns.reading:has(.block-table) .reading-card { min-width: var(--measure); max-width: none; margin-right: clamp(1rem, 3vw, 2rem); }
    .columns.reading:has(.block-table) .block-table { overflow: visible; width: fit-content; }
    /* Only tables may widen the box: everything else (titles, headings, lists, long words) is laid out in whatever width the tables leave. */
    .columns.reading:has(.block-table) .reading-card > :not(.page-block-table),
    .columns.reading:has(.block-table) .page-block-table > :not(.block-table) { contain: inline-size; }
    /* The box is sized by the table, so the table cannot size itself by the box (that is circular). */
    .columns.reading:has(.block-table) .block-table table.grid { width: auto; min-width: calc(var(--measure) - 2.5rem - 2px); }
}
.col-main { grid-area: main; min-width: 0; }
.col-main:focus { outline: none; }
.col-left { grid-area: left; min-width: 0; }

/* Page header: a full-width photo under the tabs with the page's h1 and a short text, darkened for legibility. */
.page-hero {
    position: relative; isolation: isolate; display: flex; align-items: flex-end;
    min-height: clamp(13rem, 24vw, 20rem); background: var(--navy-ink); color: #fff; overflow: hidden;
}
.page-hero-media { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.page-hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
        linear-gradient(to top, rgba(10, 20, 34, .78) 0%, rgba(10, 20, 34, .35) 50%, rgba(10, 20, 34, .05) 80%),
        linear-gradient(to right, rgba(10, 20, 34, .55) 0%, rgba(10, 20, 34, 0) 60%);
}
.page-hero-inner { padding-block: 3rem 2rem; }
.page-hero h1 { margin: 0 0 .35rem; color: #fff; font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); text-wrap: balance; text-shadow: 0 1px 12px rgba(0, 0, 0, .25); }
.page-hero p { margin: 0; max-width: 60ch; color: rgba(255, 255, 255, .9); font-size: 1.15rem; text-wrap: pretty; }
/* Light variant: an illustration on paper with dark text, so it doesn't compete with the sky-blue cards below. */
.page-hero-light { background: var(--bg); color: var(--text); }
.page-hero-light::before { content: none; }
/* Keep the whole illustration in view instead of cropping it, anchored to the right edge of the content column. */
.page-hero-light .page-hero-media { left: auto; right: max(0px, (100% - var(--wrap)) / 2); width: min(100%, var(--wrap)); object-fit: contain; object-position: right center; }
.page-hero-light h1 { color: var(--navy-ink); text-shadow: none; }
.page-hero-light p { max-width: 52ch; color: var(--text); }
@media (max-width: 700px) {
    .page-hero-light .page-hero-media { right: 0; width: 100%; object-fit: cover; opacity: .35; }
}

/* Side boxes */
.box { margin-bottom: 1.25rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; font-size: 1rem; }
.box-header { margin: 0; padding: .7rem 1rem .2rem; font-size: 1.05rem; color: var(--navy-ink); }
.box-body { padding: .5rem 1rem 1rem; overflow-wrap: anywhere; }
.box-body > :first-child { margin-top: 0; }
.box-body > :last-child { margin-bottom: 0; }

.linklist, .menu { list-style: none; margin: 0; padding: .25rem 0 .5rem; }
.linklist a, .menu a { display: block; padding: .45rem 1rem; text-decoration: none; }
.linklist a:hover, .menu a:hover { background: var(--sky); }
.menu ul { list-style: none; margin: 0; padding-left: .9rem; }
.menu a.current, .linklist a.current { font-weight: 700; color: var(--navy-ink); background: var(--sky); }
.box-header:has(> a) { padding: 0; }
.box-header > a { display: block; padding: .7rem 1rem .4rem; color: inherit; text-decoration: none; }
.box-header > a:hover { background: var(--sky); text-decoration: underline; }
.box-header > a.current { background: var(--sky); }

/* Static pages: on narrow screens the section menu sits above the text as a collapsed row (the full box stays at the bottom). */
.section-nav { display: none; }
@media (max-width: 960px) {
    .hide-narrow { display: none; }
    .section-nav { display: block; margin: 0 0 1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
    .section-nav > summary {
        display: flex; align-items: center; flex-wrap: wrap; gap: .1rem .75rem; min-height: 3.25rem; padding: .6rem 3rem .6rem 1rem;
        position: relative; cursor: pointer; list-style: none; border-radius: var(--radius);
    }
    .section-nav > summary::-webkit-details-marker { display: none; }
    .section-nav > summary::after {
        content: ""; position: absolute; right: 1.25rem; top: 50%; width: .55rem; height: .55rem; margin-top: -.4rem;
        border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy);
        transform: rotate(45deg); transition: transform .15s ease;
    }
    .section-nav[open] > summary::after { margin-top: -.1rem; transform: rotate(-135deg); }
    .section-nav > summary:hover { background: var(--sky); }
    .section-nav[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
    .section-nav-label { font-weight: 700; color: var(--navy-ink); }
    .section-nav-count { color: var(--muted); font-size: 1rem; }
    .section-nav nav { border-top: 1px solid var(--line); padding-bottom: .35rem; }
    .section-nav-home { display: block; padding: .65rem 1rem; font-weight: 700; color: var(--navy-ink); text-decoration: none; }
    .section-nav-home:hover, .section-nav-home.current { background: var(--sky); }
    .section-nav .menu { padding: 0; }
    .section-nav .menu a, .col-left .menu a { padding: .65rem 1rem; }
    .col-left .menu { font-size: 1.125rem; }
}

/* A main page lists its subpages after its own content (with a heading), or instead of it. */
.subpages { max-width: var(--measure); }
.subpages-after { margin-top: 1.75rem; }
.subpages-after > h2 { margin: 0 0 .6rem; }
.subpage-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.subpage-list li { border-bottom: 1px solid var(--line); }
.subpage-list a {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem;
    padding: .75rem .5rem; font-size: 1.2rem; font-weight: 600; line-height: 1.35; text-decoration: none;
}
.subpage-list a:hover { background: var(--sky); }
.subpage-list a:hover span { text-decoration: underline; text-decoration-thickness: 2px; }

/* Content */
.content { max-width: var(--measure); overflow-wrap: anywhere; }
/* Editor content: paragraphs without spacing, as on the old site. */
.content p, .box-body p { margin: 0; }
.content img { border-radius: 4px; }
.content figcaption { font-style: italic; }
/* Set by the layout script on images the old site scaled down to 460 px (no originals were kept). */
.content img.fill { width: 100%; }
.byline { margin: 0 0 1rem; color: var(--muted); font-size: 1rem; }
.page-heading { margin-bottom: 1.5rem; }

/* Page sections (avsnitt): text, tables and videos in the middle column of pages and articles. */
.page-block + .page-block { margin-top: 1.75rem; }
.page-block > h2 { position: relative; margin: 0 0 .6rem; scroll-margin-top: 1rem; }
.page-block > h2 .anchor {
    position: absolute; right: 100%; padding-right: .3em;
    color: var(--muted); font-weight: 400; text-decoration: none; opacity: 0;
}
.page-block > h2:hover .anchor, .page-block > h2:target .anchor { opacity: 1; }
.block-table { margin: 0; box-shadow: none; border: 1px solid var(--line); }
.block-table:focus-visible { outline-offset: 0; }
/* Narrow screens scroll inside the table; the edge fades in on the side where there is more to see (the rows have
   their own backgrounds, so this is a mask over the content rather than a shadow behind it). Without scroll-driven
   animations, or when the table fits, nothing fades. */
@property --table-fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --table-fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes table-fade {
    0% { --table-fade-start: 0px; --table-fade-end: 2.5rem; }
    8% { --table-fade-start: 2.5rem; }
    92% { --table-fade-end: 2.5rem; }
    100% { --table-fade-start: 2.5rem; --table-fade-end: 0px; }
}
@media (max-width: 960px) {
    .block-table {
        mask-image: linear-gradient(to right, transparent, #000 var(--table-fade-start), #000 calc(100% - var(--table-fade-end)), transparent);
        animation: table-fade linear both;
        animation-timeline: scroll(self inline);
    }
}
.block-table table.grid { min-width: 100%; width: auto; font-size: .95rem; }
.block-table table.grid th, .block-table table.grid td { padding: .5rem .8rem; vertical-align: top; }
.block-table table.grid td { min-width: 4rem; }
/* A long cell wraps at a readable width instead of making its column (and, on wide screens, the page) very wide. */
.block-table table.grid td > .cell { max-width: 28rem; }
/* Several links in one cell (e.g. one result file per class). */
.block-table td a + a { margin-left: .5rem; }
/* Tables sharing a header row on a page get the same column widths (set per column by the server). Auto layout, so a
   column never gets narrower than its longest word: a table that needs more room grows (and scrolls) instead. */
.block-table table.grid.shared-widths { width: 100%; }
/* A table with many columns is a data table that will not fit anyway: it gets its natural width without wrapping, and
   percentages would only squeeze its columns. */
.block-table table.grid:has(th:nth-child(7)) { width: max-content; }
.block-table table.grid:has(th:nth-child(7)) colgroup { display: none; }
.block-table table.grid tbody tr:nth-child(even) { background: var(--grid-alt-bg); }
table.is-sortable th, .block-table table.grid.is-sortable th { padding: 0; }
table.sortable th button.sort {
    display: flex; align-items: center; justify-content: flex-start; gap: .35rem; width: 100%; min-height: 2.5rem; padding: .65rem 1rem;
    border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
table.sortable th button.sort:hover { background: rgba(37, 66, 100, .08); }
.sort-icon::after { content: "\2195"; opacity: .35; font-weight: 400; }
th[aria-sort="ascending"] .sort-icon::after { content: "\2191"; opacity: 1; }
th[aria-sort="descending"] .sort-icon::after { content: "\2193"; opacity: 1; }
.block-video { display: block; width: 100%; max-height: 80vh; background: #000; border-radius: 6px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-figure { margin: 0; }
.video-caption { margin-top: .5rem; color: var(--muted); font-size: 1rem; font-style: italic; }
.block-intro { margin-bottom: .75rem; }
.block-intro > :last-child { margin-bottom: 0; }
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.doc-item {
    display: flex; align-items: center; gap: .8rem; height: 100%; padding: .7rem .9rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    color: var(--navy-ink); text-decoration: none; line-height: 1.35;
    transition: border-color .15s ease, background-color .15s ease;
}
.doc-item:hover { color: var(--navy-ink); border-color: var(--navy); background: var(--grid-alt-bg); }
.doc-item:hover .doc-title { text-decoration: underline; }
.doc-icon {
    flex: none; min-width: 3rem; padding: .3rem .4rem; border-radius: 4px; background: var(--navy); color: #fff;
    font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-align: center;
}
.doc-title { font-weight: 600; overflow-wrap: anywhere; }
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.link-card {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1.1rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    text-decoration: none; transition: border-color .15s ease, background-color .15s ease;
}
.link-card:hover { border-color: var(--navy); background: var(--grid-alt-bg); }
.link-name { color: var(--link); font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.link-card:hover .link-name { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.link-external { width: 1.1rem; height: 1.1rem; color: var(--muted); stroke-linejoin: round; }
.link-card:hover .link-external { color: var(--link-hover); }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 36rem) { .contact-list { grid-template-columns: 1fr; } }
.contact-card { display: flex; align-items: flex-start; gap: .9rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.contact-avatar {
    display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%;
    background: var(--navy); color: #fff; font-size: .95rem; font-weight: 700; letter-spacing: .03em;
}
.contact-body { min-width: 0; line-height: 1.35; }
.contact-body p { margin: 0; }
.contact-name { color: var(--navy-ink); font-weight: 700; }
.contact-body .contact-role { margin-bottom: .35rem; color: var(--muted); font-size: .95rem; }
.contact-line { display: flex; align-items: center; gap: .4rem; font-size: .95rem; }
.contact-line .icon { width: 1rem; height: 1rem; color: var(--muted); stroke-linejoin: round; }
.contact-line a { overflow-wrap: anywhere; }

/* Home: intro */
.home-intro { padding: .5rem 0 .25rem; }
.home-intro h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); line-height: 1.05; letter-spacing: -.025em; margin: 0 0 .6rem; overflow-wrap: anywhere; }
.home-intro p { margin: 0; max-width: 46rem; font-size: 1.25rem; color: var(--muted); }
.home-intro.content p { max-width: none; font-size: inherit; color: inherit; }

/* Association start page: one picture card per branch, two across on phones so all branches fit. */
.branches-heading { margin: .75rem 0 1.25rem; }
.branch-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.branch-card a {
    position: relative; display: flex; align-items: flex-end; aspect-ratio: 3 / 2; overflow: hidden;
    border-radius: var(--radius); background: var(--navy); box-shadow: var(--shadow-sm);
    color: #fff; text-decoration: none; isolation: isolate;
    transition: box-shadow .3s cubic-bezier(.16, 1, .3, 1), transform .3s cubic-bezier(.16, 1, .3, 1);
}
.branch-card img {
    position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover;
    transition: transform .6s cubic-bezier(.16, 1, .3, 1);
}
/* The title carries its own ink, so a two-line title stays at AA contrast over any part of the picture. */
.branch-title {
    width: 100%; padding: calc(var(--fade) + .25rem) .9rem .7rem; --fade: 1.25rem;
    background: linear-gradient(to top, rgba(20, 38, 61, .92) 0, rgba(20, 38, 61, .78) calc(100% - var(--fade)), rgba(20, 38, 61, 0) 100%);
    font-size: 1.3rem; font-weight: 700; line-height: 1.15; text-wrap: balance;
}
.branch-card a:hover { color: #fff; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.branch-card a:hover img { transform: scale(1.04); }
.branch-card a:hover .branch-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
.branch-card a:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
@media (max-width: 40rem) {
    .branches-heading { margin: 0 0 .75rem; }
    .branch-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .branch-card a { aspect-ratio: 16 / 9; }
    /* One line only: a wrapped title would cover most of the small picture. Long titles get a smaller size. */
    .branch-title {
        --fade: .75rem; padding: calc(var(--fade) + .2rem) .65rem .5rem;
        font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .branch-title.long { padding-inline: .5rem; font-size: min(1rem, 4.4vw); }
}
@media (prefers-reduced-motion: reduce) {
    .branch-card a, .branch-card img { transition: none; }
    .branch-card a:hover { transform: none; }
    .branch-card a:hover img { transform: none; }
}

/* Association start page: invitations to the club and contest maps. */
.explore { margin-top: 3rem; }
.explore h2 { margin: 0 0 1.25rem; }
.explore-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.explore-links li { display: flex; }
.explore-link {
    display: grid; grid-template-rows: auto 1fr; width: 100%; overflow: hidden;
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
    color: var(--text); text-decoration: none;
    transition: box-shadow .3s cubic-bezier(.16, 1, .3, 1), transform .3s cubic-bezier(.16, 1, .3, 1);
}
.explore-link img { width: 100%; aspect-ratio: 12 / 5; object-fit: cover; transition: transform .6s cubic-bezier(.16, 1, .3, 1); }
.explore-text { position: relative; display: flex; flex-direction: column; gap: .4rem; padding: 1.1rem 1.25rem 1.25rem; background: var(--surface); }
.explore-title { font-size: 1.4rem; font-weight: 700; line-height: 1.2; color: var(--navy-ink); }
.explore-lead { color: var(--muted); max-width: 38rem; }
.explore-action { display: inline-flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .5rem; font-weight: 700; color: var(--link); }
.explore-action svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.explore-link:hover { color: var(--text); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.explore-link:hover img { transform: scale(1.03); }
.explore-link:hover .explore-action { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
.explore-link:hover .explore-action svg { transform: translateX(3px); }
.explore-link:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
@media (max-width: 40rem) {
    .explore { margin-top: 2rem; }
    .explore h2 { margin-bottom: .75rem; }
    .explore-link img { aspect-ratio: 2 / 1; }
    .explore-text { padding: .9rem 1rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .explore-link, .explore-link img, .explore-action svg { transition: none; }
    .explore-link:hover, .explore-link:hover img, .explore-link:hover .explore-action svg { transform: none; }
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 1rem; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; white-space: nowrap; }

/* Home: upcoming events */
.event-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1rem; }
.event-card {
    position: relative; display: flex; flex-direction: column;
    padding: 1.15rem 1.25rem 1.25rem; background: var(--surface);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}
.event-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.event-card:focus-within { box-shadow: var(--shadow-md); }
.event-when { margin: 0 0 .35rem; color: var(--navy); font-weight: 700; font-size: 1.15rem; }
.event-name { margin: 0 0 .35rem; font-size: 1.2rem; line-height: 1.3; overflow-wrap: anywhere; }
.event-name a { color: var(--navy-ink); text-decoration: none; }
.event-name a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.event-name a:hover { text-decoration: underline; }
.event-name a:focus-visible { outline: none; }
.event-name a:focus-visible::after { outline: 3px solid var(--link); outline-offset: 2px; }
.event-class { margin: 0 0 1rem; color: var(--muted); font-size: 1rem; }
.event-status {
    align-self: flex-start; margin: auto 0 0; padding: .2rem .65rem;
    border-radius: 999px; font-size: .95rem; font-weight: 600;
}
.status-open { color: var(--ok-fg); background: var(--ok-bg); }
.status-closed { color: var(--closed-fg); background: var(--closed-bg); }
.status-registered { color: var(--me-fg); background: var(--me-bg); }
.status-none { color: var(--muted); background: var(--bg); }
.more-link { margin: 1rem 0 0; font-weight: 600; }

.empty-state { padding: 1.5rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); max-width: var(--measure); }
.empty-state p { margin: 0 0 .35rem; }
.empty-state p:last-child { margin: 0; }

/* News */
.news { max-width: var(--measure); }
.news-heading { margin: 3rem 0 1.25rem; }
.news-item, .reading-card { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.reading-card { max-width: var(--measure); }
.news-item { margin-bottom: 1.75rem; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.back-link svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.back-link:hover svg { transform: translateX(-3px); }
@media (prefers-reduced-motion: reduce) { .back-link svg { transition: none; } .back-link:hover svg { transform: none; } }
.news-item > :first-child, .reading-card > :first-child { margin-top: 0; }
.news-item > :last-child, .reading-card > :last-child, .news-item .content > :last-child, .reading-card .content > :last-child { margin-bottom: 0; }
@media (max-width: 600px) { .news-item, .reading-card { padding: .9rem 1rem; } }
.news-item h2, .news-item h3 { margin: 0 0 .2rem; font-size: 1.45rem; line-height: 1.25; }
.news-item h2 a, .news-item h3 a { color: var(--navy-ink); text-decoration: none; }
.news-item h2 a:hover, .news-item h3 a:hover { color: var(--link); text-decoration: underline; }
.item-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.item-head > :first-child { margin-top: 0; min-width: 0; }
/* Only the edit link (the heading is in the page header): top right, with room before the content. */
.item-head-end { justify-content: flex-end; margin-bottom: 1rem; }
.edit-link { flex: none; display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; white-space: nowrap; }
.edit-link svg { align-self: center; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 1rem 0 0; max-width: var(--measure); }
.pager a, .pager span[aria-current] {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.75rem; min-height: 2.75rem; padding: 0 .8rem;
    border-radius: 8px; text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pager a { background: var(--surface); box-shadow: var(--shadow-sm); }
.pager a:hover { background: var(--sky); }
.pager span[aria-current] { background: var(--navy); color: #fff; }
.pager span.gap { color: var(--muted); padding: 0 .2rem; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: .5rem; list-style: none; padding: 0; margin: 1rem 0; }
.thumbs a { display: block; font-size: .95rem; line-height: 1.35; text-decoration: none; border-radius: 6px; }
/* Same 4:3 frame for every image, so portrait and landscape shots line up; the viewer shows the whole image. */
.thumbs img {
    display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 35%;
    margin: 0; border-radius: 6px; background: #dde3ea;
    transition: filter .15s ease-out;
}
.thumb-caption { display: block; margin-top: .3rem; }
.thumbs a:hover img { filter: brightness(1.08); }
.thumbs a:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.large-image { text-align: center; }
.large-image > img { max-height: 85vh; width: auto; }
.large-image nav { display: flex; justify-content: space-between; gap: 1rem; margin: .75rem 0; }

/* Album viewer (lightbox.js) */
html:has(dialog.lightbox[open]) { overflow: hidden; scrollbar-gutter: auto; }
.lightbox {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: #000; color: #e8e8e8;
    display: none; grid-template-rows: auto minmax(0, 1fr) auto;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: #000; }
.lightbox ::selection { background: #e8e8e8; color: #000; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .5rem .5rem 1.25rem; }
.lightbox-count { font-size: 1rem; font-variant-numeric: tabular-nums; color: #b8b8b8; }
.lightbox button {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 2.75rem; min-width: 2.75rem; padding: 0 .9rem; border: 0; border-radius: 999px;
    background: rgb(255 255 255 / .1); color: #fff; font: inherit; font-size: 1rem; cursor: pointer;
    transition: background-color .15s ease-out;
}
.lightbox button:hover { background: rgb(255 255 255 / .22); color: #fff; }
.lightbox button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lightbox-stage { margin: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 0 4.5rem; }
.lightbox-stage img {
    display: block; min-height: 0; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
    cursor: pointer; user-select: none; transition: opacity .2s cubic-bezier(.16, 1, .3, 1);
}
.lightbox-stage img.loading { opacity: .35; }
.lightbox-stage figcaption { font-size: 1rem; text-align: center; color: #d0d0d0; }
.lightbox-nav { position: absolute; top: 50%; translate: 0 -50%; width: 3.25rem; height: 3.25rem; padding: 0; }
.lightbox-prev { left: .75rem; }
.lightbox-next { right: .75rem; }
.lightbox-hint { display: none; margin: 0; padding: .6rem 1rem .9rem; text-align: center; font-size: .95rem; color: #b8b8b8; }
.lightbox-hint kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.7rem; padding: 0 .4rem; margin: 0 .1rem;
    border: 1px solid #5a5a5a; border-bottom-width: 2px; border-radius: 5px; font: inherit; font-size: .85rem; color: #fff;
}
@media (hover: hover) and (pointer: fine) {
    .lightbox-hint { display: block; }
}
@media (max-width: 40rem) {
    .lightbox-stage { padding: 0; }
    .lightbox-nav { top: auto; bottom: .75rem; translate: none; background: rgb(0 0 0 / .55); }
    .lightbox-close span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .lightbox-stage img, .lightbox button { transition: none; }
}

/* Tables */
.table-wrap { position: relative; overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 1rem; background: var(--surface); }
table.grid th { background: var(--grid-header-bg); color: var(--grid-header-fg); text-align: left; font-weight: 600; }
table.grid th, table.grid td { padding: .5rem .7rem; }
table.grid tbody tr:nth-child(even) { background: var(--grid-alt-bg); }
table.grid td.num, table.grid td.date { text-align: right; white-space: nowrap; }
table.grid td.date { text-align: left; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-weight: normal; }
.tag { display: inline-block; margin-left: .4rem; padding: 0 .5rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--me-fg); background: var(--me-bg); white-space: nowrap; }

/* Calendar */
.page-lead { margin: -.25rem 0 1rem; max-width: var(--measure); font-size: 1.15rem; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 .5rem; }
.page-actions .button { gap: .45rem; min-height: 3rem; padding-inline: 1.3rem 1.5rem; font-size: 1.1rem; box-shadow: var(--shadow-sm); }
.page-actions .muted { flex: 1 1 18rem; max-width: 34rem; font-size: 1rem; }
.page-actions .button-outline { background: #fff; color: var(--navy-ink); box-shadow: inset 0 0 0 2px var(--navy-ink), var(--shadow-sm); }
h1 + .page-actions { margin-bottom: 1.25rem; }
.cal-section { margin: 2.25rem 0 0; }
.cal-section > h2 { margin: 0 0 .35rem; }
.section-note { margin: 0 0 1rem; max-width: var(--measure); color: var(--muted); }
details.year { margin: 0 0 .75rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
details.year > summary {
    display: flex; align-items: baseline; gap: .75rem; min-height: 3rem; padding: .7rem 1.1rem;
    cursor: pointer; list-style: none; border-radius: var(--radius);
}
details.year > summary::-webkit-details-marker { display: none; }
details.year > summary::before {
    content: ""; flex: none; width: .55rem; height: .55rem; align-self: center;
    border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy);
    transform: rotate(-45deg); transition: transform .15s ease;
}
details.year[open] > summary::before { transform: rotate(45deg); }
details.year > summary:hover { background: var(--sky); }
details.year > summary:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.year-label { font-size: 1.25rem; font-weight: 700; color: var(--navy-ink); }
.year-count { color: var(--muted); }
.table-card { overflow-x: auto; margin: 0 0 1.5rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table-card table.grid { margin: 0; background: none; }
.table-card table.grid th { background: var(--sky); color: var(--navy-ink); border-bottom: 1px solid var(--line); }
.table-card table.grid th, .table-card table.grid td { padding: .65rem 1rem; }
details.year .table-card { margin: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; border-top: 1px solid var(--line); }
table.events td { vertical-align: top; }
table.events .ev-status .event-status { display: inline-block; padding: .1rem .6rem; font-size: .9rem; white-space: nowrap; }
.table-card .status-none { background: #e6ebf1; }
table.events .ev-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.events .ev-name a { font-weight: 600; }
table.events th.num, table.events .ev-count { text-align: right; font-variant-numeric: tabular-nums; }
table.events .ev-unit { display: none; }
table.grid tr.me { background: var(--me-bg) !important; }

.back-link { margin: 0 0 .5rem; }
.back-link a { display: inline-flex; align-items: center; gap: .3rem; min-height: 2.75rem; font-weight: 600; }
.notice-ok { background: var(--ok-bg); color: var(--ok-fg); font-weight: 600; max-width: var(--measure); }
.event-summary {
    display: grid; gap: 1rem; margin: 0 0 2rem; padding: 1.25rem 1.4rem; max-width: var(--measure);
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.event-summary .event-status { margin: 0; justify-self: start; }
.event-summary dl.facts { margin: 0; }
.summary-action, .summary-note { margin: 0; }
.summary-note { color: var(--muted); }
.field-hint { margin: 0; color: var(--muted); }
details.confirm { margin-top: 1rem; }
details.confirm > summary { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--link); cursor: pointer; text-decoration: underline; }
details.confirm form { display: grid; gap: .6rem; margin-top: .5rem; }
details.confirm form p { margin: 0; }
details.confirm .button-quiet { width: auto; justify-self: start; }

/* Event editor (on /kalender/ansok and /kalender/{id}/{tab}) and the admin share the form, button and message styles below. */
.event-editor { max-width: 52rem; }
/* A table-card.table-grow is as wide as its table: on desktop the page widens (up to the full window) instead of
   the table scrolling, while the rest of the editor keeps its width. */
@media (min-width: 961px) {
    .wrap.columns:has(.table-grow) { width: max-content; min-width: min(100%, var(--wrap)); max-width: 100%; }
    .event-editor:has(.table-grow) { max-width: none; }
    .event-editor:has(.table-grow) > :not(.table-grow) { max-width: 52rem; }
    .table-card.table-grow { width: max-content; min-width: min(100%, 52rem); max-width: 100%; }
}
/* Long column headers (e.g. registration questions) wrap instead of widening the column; cells ignore max-width. */
.th-limit { display: inline-block; max-width: 11rem; white-space: normal; }
/* Free-text answers wrap after a comfortable line length. */
.cell-limit { display: inline-block; max-width: 18rem; white-space: normal; overflow-wrap: anywhere; }
.event-editor h2 { margin: 1.75rem 0 .5rem; }
.editor-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 .75rem; border-bottom: 1px solid var(--line); }
.editor-tabs a {
    display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1rem;
    font-weight: 600; text-decoration: none; color: var(--link); border-radius: 6px 6px 0 0;
}
.editor-tabs a:hover { background: var(--sky); }
.editor-tabs a[aria-current="page"] { color: var(--navy-ink); box-shadow: inset 0 -3px 0 var(--navy); }
:is(.event-editor, .admin-main) .form {
    display: grid; gap: 1rem; margin: 0 0 1rem; padding: 1.25rem 1.4rem;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
:is(.event-editor, .admin-main) .form label { display: grid; gap: .3rem; font-weight: 600; }
:is(.event-editor, .admin-main) .form label .small { font-weight: normal; color: var(--muted); }
:is(.event-editor, .admin-main) .form label.check { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.event-editor .form fieldset.class-list { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 0; padding: 0; border: 0; }
.event-editor .form fieldset.class-list legend { width: 100%; margin-bottom: .3rem; padding: 0; font-weight: 600; }
.event-editor .form fieldset.class-list label.check { font-weight: normal; }
input[type=checkbox] {
    appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center;
    width: 1.4rem; height: 1.4rem; min-height: 0; margin: 0; padding: 0; vertical-align: middle; cursor: pointer;
    background: #fff; border: 2px solid var(--navy); border-radius: .3rem;
    transition: background-color .12s, box-shadow .12s;
}
input[type=checkbox]::before {
    content: ""; width: .8rem; height: .8rem; background: #fff; transform: scale(0); transition: transform .12s;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type=checkbox]:checked { background: var(--navy); }
input[type=checkbox]:checked::before { transform: scale(1); }
input[type=checkbox]:hover:not(:disabled) { background-color: var(--sky); }
input[type=checkbox]:checked:hover:not(:disabled) { background-color: var(--navy-deep); }
input[type=checkbox]:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
input[type=checkbox]:disabled { opacity: .5; cursor: not-allowed; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .6rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.choice-cards legend { margin-bottom: .4rem; padding: 0; font-weight: 600; }
:is(.event-editor, .admin-main) .form label.choice-card {
    display: flex; align-items: flex-start; gap: .65rem; padding: .8rem 1rem; cursor: pointer;
    font-weight: normal; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line);
}
.choice-card:hover { background: var(--sky); }
.choice-card:has(input:checked) { background: var(--sky); box-shadow: inset 0 0 0 2px var(--navy); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.choice-card input[type=radio] { flex: none; width: 1.25rem; height: 1.25rem; margin: .1rem 0 0; accent-color: var(--navy); }
.choice-card strong { display: block; color: var(--navy-ink); }
.choice-card .small { display: block; margin-top: .15rem; }
.choice-cards .field-error { grid-column: 1 / -1; }
:is(.event-editor, .admin-main) .form > p { margin: 0; max-width: var(--measure); }
:is(.event-editor, .admin-main) .form label.ck-voice-label { display: none; }
:is(.event-editor, .admin-main) .form label :is(input, select, textarea) { font-weight: normal; }
:is(.event-editor, .admin-main) .optional { font-weight: normal; color: var(--muted); }
:is(.event-editor, .admin-main) .field-error { display: block; color: #a3001b; font-weight: 600; }
:is(.event-editor, .admin-main) .actions .field-error { margin: 0; }
:is(.event-editor, .admin-main) [aria-invalid="true"]:not([type=radio]) { border: 2px solid #a3001b; }
.choice-cards:has([aria-invalid="true"]) .choice-card:not(:has(input:checked)) { box-shadow: inset 0 0 0 2px #a3001b; }
:is(.event-editor, .admin-main) [tabindex="-1"]:focus { outline: none; }
:is(.event-editor, .admin-main) .inline, :is(.event-editor, .admin-main) form.form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
:is(.event-editor, .admin-main) input.narrow { width: 8rem; }
:is(.event-editor, .admin-main) input[type=file] { font: inherit; font-weight: normal; }
:is(.event-editor, .admin-main) .date-input { max-width: 12rem; }
:is(.event-editor, .admin-main) select { max-width: 24rem; }
:is(.event-editor, .admin-main) .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1rem 0; }
:is(.event-editor, .admin-main) button:not(.primary):not(.link):not(.danger) { background: var(--bg); color: var(--navy-ink); box-shadow: inset 0 0 0 1px var(--line); }
:is(.event-editor, .admin-main) button:not(.primary):not(.link):not(.danger):hover { background: var(--sky); }
:is(.event-editor, .admin-main) button.link { min-height: 2.75rem; padding: 0 .4rem; background: none; color: var(--link); font-weight: normal; text-decoration: underline; }
:is(.event-editor, .admin-main) button.link:hover { color: var(--link-hover); }
:is(.event-editor, .admin-main) button.danger { background: #a3001b; }
:is(.event-editor, .admin-main) button.danger:hover { background: #7d0015; }
:is(.event-editor, .admin-main) button.link.danger { background: none; color: #a3001b; }
:is(.event-editor, .admin-main) button.link.danger:hover { background: none; color: #7d0015; }
:is(.event-editor, .admin-main) button:disabled { opacity: .55; cursor: default; }
:is(.event-editor, .admin-main) .actions .button { background: var(--bg); color: var(--navy-ink); box-shadow: inset 0 0 0 1px var(--line); }
:is(.event-editor, .admin-main) .actions .button:hover { background: var(--sky); }
:is(.event-editor, .admin-main) .actions .button.primary { background: var(--navy); color: #fff; box-shadow: none; }
:is(.event-editor, .admin-main) .actions .button.primary:hover { background: var(--navy-ink); }
:is(.event-editor, .admin-main) .message { max-width: var(--measure); padding: .9rem 1.1rem; border-radius: 8px; }
:is(.event-editor, .admin-main) .message.ok { background: var(--ok-bg); color: var(--ok-fg); }
:is(.event-editor, .admin-main) .message.info { background: var(--sky); color: var(--navy-ink); }
:is(.event-editor, .admin-main) .message.error { background: #fde8e8; color: #a3001b; }
:is(.event-editor, .admin-main) .nowrap { white-space: nowrap; }
:is(.event-editor, .admin-main) td .narrow { min-height: 2.25rem; }
/* Captions of an uploaded album (/galleri/ladda-upp/{id}). */
ul.album-images { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
ul.album-images li { display: flex; flex-direction: column; gap: .3rem; padding: .5rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); font-size: 1rem; }
ul.album-images img { max-height: 120px; object-fit: contain; align-self: center; }
/* The editing area is as wide as the published text column (--measure plus padding and border). */
.editor-wrap { max-width: calc(var(--measure) + 2rem + 2px); margin: 0 0 1rem; }
.editor-label { display: block; margin-bottom: .3rem; font-weight: 600; }
.editor-hint { margin: -.1rem 0 .5rem; max-width: var(--measure); color: var(--muted); }
.editor-wrap .ck-editor__editable { min-height: 260px; padding-inline: 1rem; }
/* Holds the editor's space until CKEditor has loaded, so the page doesn't jump (it hides this div and adds its UI after it). */
.editor-wrap > div:empty { min-height: 301px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.editor-wrap.compact .ck-editor__editable { min-height: 130px; }
.editor-wrap.compact > div:empty { min-height: 171px; }
.ck-content p { margin: 0; }
/* Edited text looks like the published page: the site's font and reading size instead of CKEditor's Helvetica 16px. */
.editor-wrap .ck.ck-content {
    --ck-content-font-family: var(--font); --ck-content-font-size: 1.125rem; --ck-content-line-height: 1.6;
    font-family: var(--font); font-size: 1.125rem; line-height: 1.6;
}
.reconnect { border: 0; border-radius: var(--radius); padding: 1.2rem 1.6rem; box-shadow: var(--shadow-md); }
.reconnect::backdrop { background: rgba(20, 38, 61, .35); }
.reconnect p { margin: 0; }
.reconnect .reconnect-failed, .reconnect[data-state="failed"] .reconnect-show { display: none; }
.reconnect[data-state="failed"] .reconnect-failed { display: block; }

/* Footer: the same on every page, pushed to the bottom of the window on short pages. */
body:has(> .site-footer) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.site-footer {
    margin-top: auto; font-size: 1rem;
    background: var(--navy-ink); color: rgba(255, 255, 255, .78);
    box-shadow: inset 0 3px 0 var(--yellow);
}
.site-footer a { color: #fff; }
.site-footer :focus-visible { outline-color: var(--yellow); }
.footer-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .25rem 2.5rem; padding-block: 1rem .85rem; }
.footer-home { display: inline-flex; align-items: center; gap: .6rem; min-height: 2.75rem; font-size: 1.15rem; font-weight: 700; text-decoration: none; }
.footer-home img { width: 2.25rem; height: auto; flex: none; }
.footer-home:hover span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
/* Forms */
form.stacked { display: grid; gap: .9rem; max-width: 28rem; }
form.stacked label { display: grid; gap: .3rem; font-weight: 600; }
form.stacked label.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: normal; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=search], input[type=number], input[type=date], input[type=url], textarea, select {
    width: 100%; min-height: 2.75rem; padding: .5rem .7rem; font: inherit;
    border: 1px solid #aeb7c2; border-radius: 6px; background: var(--surface); color: var(--text);
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; border-color: var(--link); }
/* The global field styles above would otherwise clip flatpickr's month dropdown and year input. */
.flatpickr-calendar :is(select, input[type=number]) { width: auto; min-height: 0; padding: 0 0 0 .5ch; border: 0; border-radius: 0; background: transparent; font-size: inherit; }
button, .button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 2.75rem; padding: .5rem 1.2rem; font: inherit; font-weight: 600;
    border: 0; border-radius: 6px; background: var(--navy); color: #fff; cursor: pointer;
    justify-self: start; text-decoration: none;
}
button:hover, .button:hover { background: var(--navy-ink); color: #fff; }
.button-quiet { width: 100%; background: var(--bg); color: var(--navy-ink); }
.button-quiet:hover { background: var(--sky); color: var(--navy-ink); }
.field-validation-error, .validation-summary-errors { color: #a3001b; font-size: 1rem; }
.notice { padding: .9rem 1.1rem; border-radius: 8px; background: var(--me-bg); }
.notice.error { background: #fde8e8; }
.small { font-size: .95rem; }
form.inline { display: inline; }
.link-button { background: none; border: 0; padding: 0; min-height: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; }
.link-button:hover { background: none; color: var(--link-hover); }
.content-box { background: var(--surface); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.content-box + .content-box { margin-top: 1.5rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.admin-link { margin: .3em 0 .8em; font-size: 1rem; }

@media (max-width: 960px) {
    .columns {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "main" "left";
        gap: 1.5rem;
    }
}

@media (max-width: 860px) {
    .tabs { display: none; }
    .menu-open .tabs { display: block; }
    .tabs ul { flex-direction: column; gap: 0; padding-block: .25rem .75rem; }
    .tabs li:first-child a, .tabs .nav-admin + li a { margin-left: 0; }
    .tabs a { min-height: 3rem; padding: 0 .25rem; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    .tabs a[aria-current="page"] { box-shadow: none; color: var(--yellow); }
    .columns { padding-block: 1.25rem 2rem; }
    .event-cards { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
    .event-card { padding: 1rem 1.1rem; }
    .event-class { margin-bottom: .75rem; }
}

@media (max-width: 480px) {
    .nav-login { display: block; }
    .section-head { flex-direction: column; gap: .25rem; }
    dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
    dl.facts dd { margin-bottom: .6rem; }
    .event-summary { padding: 1.1rem; }
}

@media (max-width: 640px) {
    /* Administration first in the menu, as a button set apart from the tabs (header.css hides the header button). */
    .nav-admin { display: block; padding-block: .5rem .35rem; }
    .tabs .nav-admin a {
        gap: .6rem; padding: 0 1rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
        color: #fff;
    }
    .tabs .nav-admin a:hover { background: rgba(255, 255, 255, .1); }
    table.events, table.events tbody { display: block; background: none; }
    table.events thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    table.events tr {
        display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem;
        padding: .75rem 1rem; border-top: 1px solid var(--line); background: var(--surface) !important;
    }
    table.events td, table.grid.events td.num, .table-card table.events td { display: block; padding: 0; min-width: 0; white-space: normal; }
    table.events .ev-name { grid-column: 1 / -1; order: -1; overflow-wrap: anywhere; }
    table.events .ev-date, table.events .ev-class, table.grid.events td.ev-count { color: var(--muted); font-size: .95rem; text-align: left; }
    table.events .ev-count { grid-column: 1 / -1; }
    table.grid.events td.ev-count:has(.visually-hidden) { display: none; }
    table.events .ev-unit { display: inline; }
    table.events .ev-status { grid-column: 1 / -1; margin-top: .3rem; }
    .table-card table.events tr:first-child { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

.toasts { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; flex-direction: column; }
.toast { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: .9rem 1rem; box-shadow: 0 -2px 10px rgba(0, 0, 0, .12); animation: toast-in .2s ease-out; }
.toast.ok { background: var(--ok-bg); color: var(--ok-fg); }
.toast.error { background: #fde8e8; color: #a3001b; }
.toast.ok::before { content: "✓"; font-weight: 700; }
.toast.error::before { content: "!"; font-weight: 700; }
.toast-text { flex: 0 1 auto; }
.toast-action { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Signup questions */
.questions h2 { margin: 0; }
.questions > p { margin: 0; }
.questions > button { justify-self: start; }
.question-dialog .form { padding: 0; box-shadow: none; background: none; margin: 0; }
.question-dialog .form > h2 { margin: 0; }
.question-list { list-style: none; margin: .75rem 0; padding: 0; display: grid; gap: .5rem; counter-reset: q; }
.question-list li { counter-increment: q; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .6rem .75rem; border: 1px solid #cfd6dd; border-radius: .5rem; background: #fff; }
.question-list li::before { content: counter(q) "."; font-weight: 600; min-width: 1.5em; }
.question-list .q-text { flex: 1 1 14rem; overflow-wrap: anywhere; }
.question-list .q-actions { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: center; }
.question-list .q-actions button { min-height: 2.5rem; min-width: 2.5rem; font-size: 1.15rem; }
.question-list .q-actions button:disabled { opacity: .35; cursor: default; }
.question-list .q-warn { flex-basis: 100%; color: #8a2b0b; }
.q-kind { font-size: .8rem; padding: .1rem .55rem; border-radius: 999px; background: #e8eef5; color: #25405c; white-space: nowrap; }
.question-dialog { width: min(34rem, calc(100vw - 2rem)); border: 0; border-radius: .75rem; padding: 1.25rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.question-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.question-dialog h2 { margin-top: 0; }
.tip { margin: .75rem 0; padding: .6rem .8rem; border-left: 4px solid #2f6f9f; background: #eef5fb; border-radius: .25rem; font-size: .9rem; }
.yesno, .class-choice { border: 0; padding: 0; margin: 0 0 1rem; }
.yesno legend, .class-choice legend { font-weight: 600; padding: 0; margin-bottom: .25rem; }
.yesno, .class-choice { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.yesno legend, .class-choice legend { flex-basis: 100%; }
form.stacked .yesno label.inline, form.stacked .class-choice label.inline { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: 0 1.1rem 0 .85rem; border: 1px solid #aeb7c2; border-radius: .5rem; background: #fff; font-weight: normal; cursor: pointer; }
form.stacked .yesno label.inline:has(input:checked), form.stacked .class-choice label.inline:has(input:checked) { background: var(--sky); box-shadow: inset 0 0 0 1px var(--navy); }
.yesno input[type=radio], .class-choice input[type=checkbox] { width: 1.25rem; height: 1.25rem; min-height: 0; margin: 0; accent-color: var(--navy); }
.yesno .field-error, .class-choice .field-error { flex-basis: 100%; }

.answer { display: grid; margin-bottom: .25rem; }
.answer strong { font-weight: 600; }

.info h2 { margin: 0; }
.info .editor-hint { margin: 0 0 .5rem; }

.event-box { max-width: var(--measure); margin: 0 0 1.5rem; }
.event-box h2 { margin: 0 0 .75rem; }

/* Tables with five columns need more room than running text; notes keep the reading measure. */
.cal-section { max-width: 60rem; }
.cal-section > .section-note { max-width: var(--measure); }
.cal-section.map-list { max-width: none; }
/* Result and participant tables are as wide as the info boxes above them. */
.cal-section > .table-card:has(table.grid:not(.events)) { width: 100%; max-width: var(--measure); }
.cal-section > .table-card table.grid:not(.events) { width: 100%; }
.map-list td:nth-child(3) { white-space: nowrap; }
.table-card table.grid tr.me { background: #fff7dc !important; font-weight: 600; }
.table-card table.grid tr.me td:first-child { box-shadow: inset 3px 0 0 #e0b84a; }

/* Karta (association start page) */
.map-intro { max-width: var(--measure); }
.map-filters { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-end; margin: 1rem 0; }
.map-year { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.map-year select { min-width: 7rem; }
.map-branches { display: flex; flex-wrap: wrap; gap: .4rem; border: 0; padding: 0; margin: 0; }
.map-branches legend { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; font-weight: 600; padding: 0; margin-bottom: .5rem; }
.map-branch-toggles { display: inline-flex; flex-wrap: wrap; gap: .5rem; font-weight: 600; }
.map-branch-toggles[hidden] { display: none; }
.map-branch-toggles button {
    min-height: 2.5rem; padding: .35rem .95rem; font-size: 1rem; font-weight: 600;
    border: 1px solid #aeb7c2; border-radius: 8px; background: var(--surface); color: var(--navy-ink);
    transition: background-color .15s ease-out, border-color .15s ease-out;
}
.map-branch-toggles button:hover { background: var(--sky); border-color: var(--navy-ink); }
.map-branch-toggles button:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.map-chip {
    position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 2.25rem;
    padding: .25rem .75rem .25rem .45rem; border: 1px solid #aeb7c2; border-radius: 999px;
    background: var(--surface); color: var(--muted); font-size: .95rem; font-weight: 600; white-space: nowrap; cursor: pointer;
    transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.map-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.map-chip-dot {
    flex: none; display: grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--chip);
}
.map-chip-dot::after {
    content: ""; width: .7rem; height: .7rem; background: #fff; opacity: 0;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.map-chip:has(input:checked) { color: var(--text); border-color: var(--chip); background: color-mix(in srgb, var(--chip) 12%, #fff); }
.map-chip:has(input:checked) .map-chip-dot { background: var(--chip); }
.map-chip:has(input:checked) .map-chip-dot::after { opacity: 1; }
.map-chip:hover { border-color: var(--navy); }
.map-chip:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
.map-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; margin-right: .3rem; vertical-align: baseline; }
.map-canvas { height: min(75vh, 46rem); min-height: 24rem; border: 1px solid var(--line); border-radius: var(--radius); background: #e8eef3; }
.map-canvas:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin: .5rem 0 0; font-size: .9rem; }
.map-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; background: var(--navy); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--navy); }
.map-dot-approx { background: rgba(37, 66, 100, .25); border: 2px dashed var(--navy); box-shadow: none; }
.map-popup ul { margin: .4rem 0 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
.map-popup-meta { color: var(--muted); font-size: .85rem; }
.map-popup-branch { color: var(--muted); font-size: .85rem; }
.position-picker { height: 22rem; border: 1px solid var(--line); border-radius: var(--radius); background: #e8eef3; }
.position-picker:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.field-group { display: grid; gap: .35rem; }
.field-label { font-weight: 600; }
.airfield-picker { display: grid; gap: .5rem; }
.airfield-picker label { display: grid; gap: .25rem; }
/* Search hits under a search field (SearchResults.razor): each hit is one full-width button, so the whole row
   highlights on hover and is chosen by clicking anywhere on it. Doubled class beats the editors' generic button rules. */
.search-results { list-style: none; margin: 0; padding: .25rem; display: grid; gap: 2px; max-height: 16rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.search-results.search-results button.result-row.result-row {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: .1rem .6rem; width: 100%; min-height: 2.75rem; padding: .45rem .75rem;
    border: 0; border-radius: calc(var(--radius) - 2px); background: none; box-shadow: none; color: var(--text);
    font: inherit; font-weight: normal; text-align: left; cursor: pointer;
}
.search-results.search-results button.result-row.result-row:hover { background: var(--sky); color: var(--navy-ink); }
.search-results.search-results button.result-row.result-row:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.search-results .result-name { font-weight: 600; color: var(--navy-ink); }
.search-results .result-meta { color: var(--muted); font-size: .95rem; }
.participant-search { display: grid; gap: .5rem; max-width: 32rem; }
/* The chosen value (SearchSelection.razor): shaped like the search field; click anywhere to change, × to clear. */
.search-selection { display: flex; align-items: stretch; min-height: 2.75rem; border: 1px solid #aeb7c2; border-radius: 6px; background: var(--surface); overflow: hidden; }
.search-selection:hover { border-color: var(--navy); }
.search-selection.search-selection button.selection-main.selection-main {
    flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: .1rem .6rem; min-height: 0; padding: .5rem .7rem;
    border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--text); font: inherit; font-weight: normal; text-align: left; cursor: pointer;
}
.search-selection .result-name { font-weight: 600; color: var(--navy-ink); }
.search-selection .result-meta { color: var(--muted); font-size: .95rem; }
.search-selection .selection-change { margin-left: auto; color: var(--link); text-decoration: underline; font-size: .95rem; }
.search-selection.search-selection button.selection-main.selection-main:hover { background: var(--sky); }
.search-selection.search-selection button.selection-clear.selection-clear {
    display: grid; place-items: center; min-width: 2.75rem; min-height: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0;
    background: none; box-shadow: none; color: var(--muted); cursor: pointer;
}
.search-selection.search-selection button.selection-clear.selection-clear:hover { background: var(--sky); color: var(--navy-ink); }
.search-selection button:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }

/* Club map */
.club-search { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 0 1rem; }
.club-search[hidden] { display: none; }
.club-search label { font-weight: 600; }
.club-search input { width: min(100%, 24rem); }
.table-card .club-list th[scope="row"] { background: none; color: var(--text); font-weight: 600; text-align: left; vertical-align: top; border-bottom: 0; }
.club-list td { vertical-align: top; }
.club-fields { margin: 0; padding: 0; list-style: none; display: grid; gap: .25rem; }
.club-fields .link-button { text-align: left; }
.club-links a { display: inline-block; margin-right: .75rem; white-space: nowrap; }
.map-popup hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; }

/* Members-only host (mflyg.se) before login: a centred welcome card. */
.welcome-main { max-width: 34rem; padding-block: clamp(2rem, 8vh, 5rem); }
.welcome { text-align: left; }
.welcome-logo { display: block; margin: 0 auto 1.5rem; filter: drop-shadow(0 4px 6px rgb(5 15 30 / .4)); }
.welcome h1 { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; }
.welcome-kicker { font-size: .95rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.welcome h1 .wordmark { font-size: clamp(2.75rem, 9vw, 3.75rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.welcome h1 .wordmark-dot { width: 10px; height: 10px; margin: 0 3px 0 4px; }
.welcome h1 .wordmark-tld { letter-spacing: -.01em; }
.welcome form { margin-top: 2rem; max-width: none; }
.welcome form h2 { margin-top: 0; }
