/* ==========================================================================
   PhotoSite – global grundlayout
   ========================================================================== */

/*
 * Den här filen innehåller endast generella regler som gäller i hela
 * applikationen.
 *
 * Komponentspecifik layout hör hemma i respektive komponentfil.
 */


/* ==========================================================================
   Boxmodell
   ========================================================================== */

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


/* ==========================================================================
   Dokument
   ========================================================================== */

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    padding:
        var(--page-padding-block)
        var(--page-padding-inline);

    background: var(--color-background);
    color: var(--color-text);

    font-family: var(--font-family-base);
    font-size: 1rem;
    line-height: var(--line-height-base);

    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}


/* ==========================================================================
   Huvudinnehåll
   ========================================================================== */

main {
    display: block;
    min-width: 0;
}


/* ==========================================================================
   Typografi
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text);
    line-height: var(--line-height-tight);
}

p {
    overflow-wrap: break-word;
}

strong,
b {
    font-weight: var(--font-weight-semibold);
}


/* ==========================================================================
   Länkar
   ========================================================================== */

a {
    color: inherit;
}

a:hover {
    text-decoration-thickness: from-font;
}


/* ==========================================================================
   Bilder och media
   ========================================================================== */

img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

svg {
    display: block;
}


/* ==========================================================================
   Formulärelement
   ========================================================================== */

button,
input,
select,
textarea {
    margin: 0;

    color: inherit;
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

input,
select,
textarea {
    max-width: 100%;
}

textarea {
    resize: vertical;
}


/* ==========================================================================
   Gemensam tangentbordsfokus
   ========================================================================== */

/*
 * :focus-visible visar fokusmarkering främst vid tangentbordsnavigering.
 *
 * Komponenter med mörk bakgrund, exempelvis lightbox, kan skriva över
 * färgen lokalt.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}


/* ==========================================================================
   Tabeller
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 8px 12px;

    border: var(--border-default);

    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--color-surface-muted);
    font-weight: var(--font-weight-semibold);
}

tbody tr:nth-child(even) {
    background: var(--color-surface-soft);
}


/* ==========================================================================
   Beskrivningslistor
   ========================================================================== */

dl,
dt,
dd {
    margin-block-start: 0;
}


/* ==========================================================================
   Hjälpklasser
   ========================================================================== */

/*
 * Döljer innehåll visuellt men behåller det tillgängligt för skärmläsare.
 *
 * Används exempelvis för beskrivande texter till ikonknappar.
 */
.visually-hidden {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;

    border: 0 !important;

    white-space: nowrap !important;
}


/*
 * Används för innehåll som ska döljas helt, även för hjälpmedel.
 */
[hidden] {
    display: none !important;
}


/* ==========================================================================
   Responsiv grundlayout
   ========================================================================== */

@media (max-width: 560px) {
    body {
        padding:
            var(--page-padding-block-mobile)
            var(--page-padding-inline-mobile);
    }
}


/* ==========================================================================
   Minskad rörelse
   ========================================================================== */

/*
 * Globala scrollanimationer ska respektera användarens önskemål om minskad
 * rörelse. Komponentspecifika animationer hanteras i respektive CSS-fil.
 */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}