/*
 * What every outfit shares. Loaded only together with one; see composable/useOutfit.ts.
 *
 * An outfit restyles the page that is already there, whatever package it comes from, so
 * the rules speak the vocabulary all of it is written in: the --color-* properties and
 * the Tailwind classes. Every rule is prefixed with html[data-outfit], which no page
 * without an outfit has. Nothing here may hide, reorder or disable anything.
 *
 * This file only makes things right: colours that can be read, words that are not cut,
 * a visible focus. How a page looks is each outfit's own business, down to its corners.
 */

/* ---------------------------------------------------------------- colours */

html[data-outfit] {
    /* Surfaces keep the club's colours exactly as they were picked in the administration.
       Only what is written on them is worked out; see buildOutfitVars. */
    --color-primary: var(--o-primary) !important;
    --color-on-primary: var(--o-primary-on) !important;
    --color-secondary: var(--o-secondary) !important;
    --color-on-secondary: var(--o-secondary-on) !important;
    --color-menu: var(--o-menu) !important;

    /* The club's colours as text; a dark page needs lighter ones. */
    --o-primary-ink: var(--o-primary-text);
    --o-secondary-ink: var(--o-secondary-text);
    --o-primary-lettering: var(--o-primary-text-big);
    --o-secondary-lettering: var(--o-secondary-text-big);
    --o-tape: var(--o-mark);
    --o-tape-on: var(--o-mark-on);

    --o-menu: 255 255 255;
    accent-color: rgb(var(--color-primary));
}

html[data-outfit].dark {
    --o-primary-ink: var(--o-primary-text-dark);
    --o-secondary-ink: var(--o-secondary-text-dark);
    --o-primary-lettering: var(--o-primary-text-big-dark);
    --o-secondary-lettering: var(--o-secondary-text-big-dark);
    --o-tape: var(--o-mark-dark);
    --o-tape-on: var(--o-mark-on-dark);
    color-scheme: dark;
}

html[data-outfit] body {
    background-color: rgb(var(--color-background));
    color: rgb(var(--color-normal));
    -webkit-font-smoothing: antialiased;
}

html[data-outfit] ::selection {
    background: rgb(var(--color-primary));
    color: rgb(var(--color-on-primary));
}

/*
 * As text the club's colour has to be read, so it takes its readable shade. Kept apart:
 * inside one :is() the longest selector would lend its weight to all of them.
 */
html[data-outfit] .text-primary,
html[data-outfit] .hover\:text-primary:hover {
    color: rgb(var(--o-primary-ink));
}

html[data-outfit] .group:hover .group-hover\:text-primary {
    color: rgb(var(--o-primary-ink));
}

html[data-outfit] .text-secondary,
html[data-outfit] .hover\:text-secondary:hover {
    color: rgb(var(--o-secondary-ink));
}

/* One club colour written on the other: no shade of it is sure to be read there. */
html[data-outfit] .bg-primary.text-secondary,
html[data-outfit] .bg-primary .text-secondary {
    color: rgb(var(--color-on-primary));
}

html[data-outfit] .bg-secondary.text-primary,
html[data-outfit] .bg-secondary .text-primary {
    color: rgb(var(--color-on-secondary));
}

/* A surface of its own inside a coloured one goes back to the page's colours. */
html[data-outfit]
    :is(.bg-primary, .bg-secondary)
    :is(.bg-background, .bg-content, .bg-content-secondary)
    .text-primary {
    color: rgb(var(--o-primary-ink));
}

html[data-outfit]
    :is(.bg-primary, .bg-secondary)
    :is(.bg-background, .bg-content, .bg-content-secondary)
    .text-secondary {
    color: rgb(var(--o-secondary-ink));
}

/* Faded text is still text. */
html[data-outfit] :is(.text-normal\/70, .text-normal\/75, .text-normal\/80) {
    color: rgb(var(--color-faded));
}

/* Skeletons, and the place a picture is still on its way to. */
html[data-outfit] :is(.bg-gray-200, .bg-gray-300) {
    background-color: rgb(var(--color-normal) / 0.12);
}

html[data-outfit] .aspect-square.bg-menu {
    background: rgb(var(--color-content-secondary));
}

/* The slider writes on its background without choosing a colour for the words. */
html[data-outfit] .swiper-slide .bg-primary {
    color: rgb(var(--color-on-primary));
}

html[data-outfit] .swiper-slide .bg-secondary {
    color: rgb(var(--color-on-secondary));
}

/* ------------------------------------------------------------------- shape */

html[data-outfit] :is(.rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl) {
    border-radius: var(--o-radius, 0);
}

html[data-outfit] :is(.rounded-t-lg, .rounded-t-xl, .rounded-t-2xl) {
    border-top-left-radius: var(--o-radius, 0);
    border-top-right-radius: var(--o-radius, 0);
}

html[data-outfit] :is(.rounded-b-lg, .rounded-b-xl) {
    border-bottom-left-radius: var(--o-radius, 0);
    border-bottom-right-radius: var(--o-radius, 0);
}

/* A white or near-white club colour would vanish on a white page. */
html[data-outfit]
    .bg-secondary:is(.rounded-xl, .rounded-lg, .rounded-full):is(
        .shadow,
        .shadow-sm,
        .cursor-pointer,
        a
    ) {
    box-shadow: inset 0 0 0 1.5px rgb(var(--color-on-secondary) / 0.3);
}

html[data-outfit]
    :is(
        .rounded-tl-lg,
        .rounded-tr-lg,
        .rounded-tr-xl,
        .rounded-tl-xl,
        .rounded-bl-xl,
        .rounded-br-xl
    ) {
    border-radius: 0;
}

html[data-outfit]
    :is(
        .shadow,
        .shadow-sm,
        .shadow-md,
        .shadow-lg,
        .shadow-xl,
        .hover\:shadow:hover,
        .hover\:shadow-md:hover,
        .hover\:shadow-lg:hover
    ) {
    box-shadow: none;
}

/* ------------------------------------------------------------------- words */

html[data-outfit] .font-wide {
    line-height: 1.1;
    /* The longhand: the shorthand would let a time written not to break, break. */
    text-wrap-style: balance;
}

html[data-outfit] .content-container .font-wide.w-full.text-\[28px\] {
    padding-top: clamp(1rem, 2.4vw, 2.25rem);
}

/* A small heading over a card keeps off the card. */
html[data-outfit] .flex.justify-center > .font-wide.text-xl {
    margin-bottom: 0.6rem;
}

/* Some of the faces draw their carons above the line box, and a clamp cuts there. */
html[data-outfit] :is(.line-clamp-1, .line-clamp-2, .line-clamp-3) {
    padding-top: 0.16em;
    margin-top: -0.16em;
}

/* A long name of a team or a hall takes another line rather than losing its end. */
html[data-outfit] .line-clamp-1 {
    -webkit-line-clamp: 3;
    overflow-wrap: anywhere;
}

/* A bigger headline takes more lines, so that no word is cut off by the dress. */
html[data-outfit]
    :where(.grid > div)
    > a.group.relative
    > .absolute:is(.bottom-3, .bottom-0)
    .font-narrow {
    -webkit-line-clamp: 7;
    /* Room for the tails of g and j, which the clamp would cut. */
    padding-bottom: 0.18em;
    margin-bottom: -0.18em;
    text-shadow: none;
    text-wrap-style: balance;
}

html[data-outfit] .prose {
    --tw-prose-body: rgb(var(--color-normal));
    --tw-prose-headings: rgb(var(--color-bright));
    --tw-prose-bold: rgb(var(--color-bright));
    --tw-prose-links: rgb(var(--o-primary-ink));
    --tw-prose-counters: rgb(var(--color-faded));
    --tw-prose-bullets: rgb(var(--color-faded));
    --tw-prose-quotes: rgb(var(--color-bright));
    --tw-prose-quote-borders: rgb(var(--color-bright));
    --tw-prose-hr: rgb(var(--color-normal) / 0.3);
    --tw-prose-th-borders: rgb(var(--color-normal) / 0.4);
    --tw-prose-td-borders: rgb(var(--color-normal) / 0.25);
    font-size: 1.0625rem;
    line-height: 1.65;
    text-wrap-style: pretty;
    hanging-punctuation: first last;
}

html[data-outfit] .prose :is(h1, h2, h3, h4) {
    font-family: var(--font-wide);
    text-wrap-style: balance;
}

html[data-outfit] .prose a {
    text-underline-offset: 0.18em;
    text-decoration-thickness: from-font;
}

/* Numbers that are compared stand in columns. */
html[data-outfit] :is(table, .tabular-nums, .font-bold) {
    font-variant-numeric: tabular-nums lining-nums;
}

/* ------------------------------------------------------- menu and tabs fit */

/*
 * The menu and the tabs measure their entries and move the ones that do not fit under
 * "Več", so an outfit must never make an entry wider than it is undressed: what can be
 * reached in one click is not the outfit's to decide. Sizes here and in the outfits stay
 * under the site's own.
 */
html[data-outfit] .min-h-dvh > .fixed.top-0 .font-narrow.text-xl {
    font-size: 1.0625rem;
    line-height: 1.75rem;
    padding-inline: 0.5rem;
}

/*
 * Tabs that fill the width are measured filled, where a fraction of a pixel too much is
 * enough to push the last one under "Več". The gaps are room for that fraction.
 */
html[data-outfit] .flex.rounded-t-lg:has(> .grow) {
    gap: 1px;
}

html[data-outfit] .flex.rounded-t-lg > div .font-narrow.px-5 {
    font-size: 1rem;
    line-height: 1.5rem;
    padding-inline: 1rem;
    white-space: nowrap;
}

/* ----------------------------------------------------------- one left edge */

/*
 * Where the page's column begins. Titles and what stands under them share it, instead of
 * each block keeping the inset it happens to have.
 */
html[data-outfit] {
    --o-edge: 1rem;
}

@media (min-width: 640px) {
    html[data-outfit] {
        --o-edge: 2rem;
    }
}

@media (min-width: 1280px) {
    html[data-outfit] {
        --o-edge: max(2rem, calc((100% - 1200px) / 2));
    }
}

html[data-outfit] .p-4:has(> .flex.rounded-t-lg) {
    padding-inline: 0;
}

/* The crest keeps inside whatever an outfit hangs it on. */
html[data-outfit] .lg\:fixed.rounded-full a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

html[data-outfit] .lg\:fixed.rounded-full img {
    max-height: 100%;
    width: auto;
}

/* ------------------------------------------------------------- page title */

html[data-outfit] .h-32.bg-gradient-to-b.from-primary {
    height: auto;
    justify-content: flex-start;
    padding-inline: var(--o-edge);
    background: rgb(var(--color-primary));
}

html[data-outfit] .h-32.bg-gradient-to-b.from-primary > .font-wide {
    color: rgb(var(--o-primary-on-big));
    text-align: left;
    overflow-wrap: anywhere;
}

/* Some titles are stored in capitals; an outfit that writes small writes them small. */
html[data-outfit]:is(
        [data-outfit='igrisce'],
        [data-outfit='zgodba'],
        [data-outfit='zapisnik'],
        [data-outfit='vstopnica']
    )
    :is(.h-32.from-primary > .font-wide, .font-wide.text-3xl.grow) {
    text-transform: lowercase;
}

html[data-outfit]:is(
        [data-outfit='igrisce'],
        [data-outfit='zgodba'],
        [data-outfit='zapisnik'],
        [data-outfit='vstopnica']
    )
    :is(
        .h-32.from-primary > .font-wide,
        .h-32.from-primary > .font-wide > h1,
        .font-wide.text-3xl.grow
    )::first-letter {
    text-transform: uppercase;
}

html[data-outfit]:is(
        [data-outfit='igrisce'],
        [data-outfit='zgodba'],
        [data-outfit='zapisnik'],
        [data-outfit='vstopnica']
    )
    .font-wide.w-full.text-\[28px\] {
    text-transform: none;
}

/* ----------------------------------------------------------------- article */

/* The picture runs to the edges instead of fading into a colour before it gets there. */
html[data-outfit] .bg-primary.w-full.justify-center.xl\:flex {
    background: rgb(var(--color-background));
}

html[data-outfit] .bg-primary.w-full.justify-center.xl\:flex > .relative {
    width: 100%;
    max-width: none;
}

html[data-outfit] .bg-primary.w-full.justify-center.xl\:flex > .relative > .from-primary {
    background: none;
}

html[data-outfit] .bg-primary.w-full.justify-center.xl\:flex > .relative > img {
    max-height: min(82vh, 56rem);
    object-fit: cover;
    object-position: center 30%;
}

html[data-outfit] .news-container.mt-2 {
    padding-top: clamp(1rem, 2.4vw, 2.25rem);
}

/* A date is a date. */
html[data-outfit] .inline-flex.w-fit.rounded-full:has(> .whitespace-nowrap) {
    padding: 0;
    background: none;
    box-shadow: none;
    font-size: 1rem;
    color: rgb(var(--color-faded));
}

/* What kind of event it is. */
html[data-outfit] .rounded-full.bg-content-secondary {
    border-radius: var(--o-radius, 0);
}

/* -------------------------------------------------------------- pagination */

html[data-outfit] .px-2.rounded-full {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border-radius: var(--o-radius, 0);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- keyboard */

html[data-outfit] :is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid rgb(var(--o-primary-ink));
    outline-offset: 3px;
}

html[data-outfit] :is(.bg-primary, .bg-secondary) :is(a, button):focus-visible {
    outline-color: currentColor;
}

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

/* On a phone the crest and the fine print stand in the middle, so the rest does too. */
@media (max-width: 639px) {
    html[data-outfit]:not([data-outfit='zapisnik']) footer .lg\:flex-nowrap > .min-w-0 {
        text-align: center;
    }

    html[data-outfit]:not([data-outfit='zapisnik']) footer .mt-2.flex.flex-col {
        align-items: center;
    }

    html[data-outfit] footer .content-container > .mt-8 {
        text-align: center;
    }
}

/* ------------------------------------------------------- lists of the menu */

/* What opens under an entry of the menu. The whole row is the link, not just its words. */
html[data-outfit] .min-h-dvh > .fixed.top-0 .bg-menu\/95 {
    gap: 0;
    padding: 0.5rem 0;
    border-radius: 0;
    background: rgb(var(--color-menu));
    backdrop-filter: none;
}

html[data-outfit] .min-h-dvh > .fixed.top-0 .bg-menu\/95 :is(.py-0\.5, .px-3) {
    padding: 0;
}

html[data-outfit] .min-h-dvh > .fixed.top-0 .bg-menu\/95 a.font-narrow.text-xl {
    display: block;
    padding: 0.3rem 1.25rem;
    border: 0;
    border-radius: 0;
    color: inherit;
}

/* The menu of a phone: large enough to be hit, and a long name takes another line. */
html[data-outfit] .isolate.fixed .gap-2.rounded-2xl {
    gap: 0;
}

html[data-outfit] .isolate.fixed .gap-2.rounded-2xl .border-l-2 {
    padding: 0.7rem 0;
    border: 0;
    border-radius: 0;
    font-family: var(--font-wide);
    font-size: 1.75rem;
    line-height: 1.1;
    color: rgb(var(--color-bright));
}

html[data-outfit] .isolate.fixed .gap-2.rounded-2xl .border-l-2 > svg {
    font-size: 1.75rem;
}

html[data-outfit] .isolate.fixed .gap-2.rounded-2xl .border-l-2 .font-medium {
    overflow: visible;
    font-weight: inherit;
    letter-spacing: inherit;
    white-space: normal;
}

html[data-outfit] .isolate.fixed .gap-2.rounded-2xl .mt-0\.5 {
    margin: 0 0 0.75rem;
    padding: 0;
}

html[data-outfit] .isolate.fixed .gap-2.rounded-2xl .mt-0\.5 .border-l-2 {
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 1.1875rem;
    line-height: 1.25;
    color: rgb(var(--color-normal));
}

html[data-outfit] .isolate.fixed > :has(> #popup-content > .w-full > .gap-2.rounded-2xl) {
    position: relative;
    isolation: isolate;
    padding: 1.25rem 1.25rem 1rem;
    border: 0;
    border-radius: 0;
    background: rgb(var(--color-content));
}

html[data-outfit] .isolate.fixed > :has(> #popup-content > .w-full > .gap-2.rounded-2xl) svg {
    font-size: 1.75rem;
}

/* ------------------------------------------------------------------ motion */

/*
 * How an outfit moves is its own business too, and nothing of it may be needed: what moves
 * is decoration or comes to rest within a second, nothing starts out invisible, and nothing
 * shifts what stands around it. With motion turned off none of it happens.
 */
@keyframes outfit-sheet {
    from {
        translate: 0 2.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-outfit] *,
    html[data-outfit] *::before,
    html[data-outfit] *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Paper does not scroll. */
@media print {
    html[data-outfit] *,
    html[data-outfit] *::before,
    html[data-outfit] *::after {
        animation: none !important;
    }
}
