/* Fonts ********************************************************************/

@font-face {
    font-display: swap;
    font-family: Colaborate;
    src: url("../fonts/colaborate.otf") format("opentype");
}

@font-face {
    font-display: swap;
    font-family: Lemon;
    src: url("../fonts/lemon.woff2") format("woff2");
}


/* Variables ****************************************************************/

:root {
    --color-background: #0C130E;
    --color-text: #E8E2CC;
    --color-text-muted: #CDD2C2;
    --color-link: #198D84;
    --color-map-idle: #56655A;
    --color-overlay: rgb(0 0 0 / 72%);
    --gap: 36px;
    --gap-lead: 36px;
    --gap-photos: 72px;
    --gutter: clamp(16px, 4vw, 48px);
    --radius: 10px;
    color-scheme: dark;
}

@media (max-width: 699px) {
    :root {
        --gap: 64px;
        --gap-lead: 96px;
        --gap-photos: var(--gap);
        --gutter: 2.5vw;
    }
}


/* Base *********************************************************************/

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-background);
    color: var(--color-text);
    font: 1.125rem/1.5 Colaborate, sans-serif;
    font-synthesis: none;
    margin: 0;
}

h1,
h2 {
    font-weight: 400;
    line-height: 1.2;
    margin: 0;
}

h1 {
    font-size: 2rem;
}

p {
    margin: 0;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

img,
svg {
    display: block;
    height: auto;
    max-width: 100%;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover,
a[aria-current] {
    color: var(--color-text);
}

:focus-visible {
    outline: 3px solid var(--color-link);
    outline-offset: 3px;
}

.visually-hidden,
.skip-link:not(:focus) {
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.skip-link:focus {
    background-color: var(--color-background);
    left: 16px;
    padding: 8px 16px;
    position: absolute;
    top: 16px;
}


/* Layout *******************************************************************/

.site-header,
main,
.site-footer {
    margin-inline: auto;
    width: min(1240px, 100% - 2 * var(--gutter));
}

.about,
.archive-section {
    margin-inline: auto;
}

@media (min-width: 700px) {
    .about,
    .archive-section {
        width: 81vw;
    }
}

@media (min-width: 1025px) {
    .about,
    .archive-section {
        width: 49.5vw;
    }
}

.site-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    justify-content: space-between;
    margin-block: 32px 48px;
}

.site-title {
    font: clamp(2.6rem, 4.5vw, 3.4rem)/1 Lemon, serif;
}

.site-title a {
    color: inherit;
}

.site-title a:hover {
    color: var(--color-link);
}

.site-header ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
}

.site-header li a {
    display: inline-block;
    padding-block: 8px;
}

@media (max-width: 699px) {
    .site-header,
    .site-header ul {
        justify-content: center;
    }

    .site-title {
        text-align: center;
        width: 100%;
    }
}

.site-footer {
    margin-block: 72px 40px;
    text-align: center;
}

.site-footer svg {
    margin: 0 auto 8px;
}


/* Galleries in lists *******************************************************/

.gallery-meta {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.lead,
.gallery-grid {
    display: grid;
    gap: var(--gap);
}

.lead {
    margin-bottom: var(--gap-lead);
    row-gap: 12px;
}

.lead img,
.gallery-card img,
.gallery-card .photo-slot {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    object-fit: cover;
    width: 100%;
}

.lead h2 {
    font-size: 2.5rem;
    margin-block: 4px 8px;
}

.lead-text {
    font-size: 1.2rem;
}

.gallery-card {
    position: relative;
}

.gallery-card > a {
    display: block;
}

.gallery-card h2 {
    font-size: 1.6rem;
}

.gallery-card-info {
    padding-top: 12px;
}

@media (min-width: 700px) {
    .lead,
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lead > a {
        grid-column: span 2;
    }

    .lead h2 {
        margin-block: 12px 20px;
    }

    .lead {
        align-items: center;
    }
}

@media (min-width: 1025px) {
    .gallery-grid-wide {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 700px) and (hover: hover) {
    .gallery-grid-overlay .gallery-card-info {
        align-items: center;
        background-color: var(--color-overlay);
        border-radius: var(--radius);
        display: flex;
        flex-direction: column;
        inset: 0;
        justify-content: center;
        opacity: 0;
        padding: 16px;
        position: absolute;
        text-align: center;
        transition: opacity 0.5s ease;
    }

    .gallery-grid-overlay .gallery-card:hover > .gallery-card-info,
    .gallery-grid-overlay .gallery-card-info:focus-within {
        opacity: 1;
    }
}


/* Pagination ***************************************************************/

.pagination {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto 1fr;
    margin-top: 56px;
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    grid-column: 2;
    justify-content: center;
}

.pagination-pages > * {
    min-width: 32px;
    padding: 6px 4px;
    text-align: center;
}

.pagination-older {
    grid-column: 3;
    justify-self: end;
}

@media (max-width: 699px) {
    .pagination-newer span,
    .pagination-older span {
        display: none;
    }
}


/* Gallery ******************************************************************/

.gallery-header {
    margin-block: 48px 72px;
    text-align: center;
}

.gallery-header h1 {
    margin-bottom: 16px;
}

.gallery-date-place {
    margin-block: 35px 3px;
}

.gallery-thumbs {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(var(--columns), minmax(0, 104px));
    justify-content: center;
    margin-bottom: var(--gap-photos);
}

.gallery-thumbs img {
    border-radius: 3px;
}

.gallery-thumbs a:hover img {
    outline: 2px solid var(--color-text);
    outline-offset: 1px;
}

.gallery-images {
    display: grid;
    gap: var(--gap-photos);
}

.gallery-images li {
    scroll-margin-top: 16px;
    text-align: right;
}

.gallery-images img {
    border-radius: var(--radius);
    width: 100%;
}

.gallery-empty {
    text-align: center;
}

.gallery-photos {
    position: relative;
}

.back-to-top-track {
    align-items: flex-end;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
    position: absolute;
    right: calc((100% - 100vw) / 2 + 20px);
    top: 100vh; /* Button appears once the first photo reaches the top */
}

.back-to-top {
    align-items: center;
    background-color: var(--color-link);
    border-radius: 50%;
    bottom: 20px;
    color: var(--color-text);
    display: flex;
    font-size: 1.25rem;
    height: 44px;
    justify-content: center;
    pointer-events: auto;
    position: sticky;
    width: 44px;
}


/* Tags and archive *********************************************************/

.tag-title {
    margin-bottom: 40px;
    text-align: center;
}

.archive-section {
    display: grid;
    gap: 16px;
    margin-block: 64px;
}

.archive-section h2 {
    font-size: 1.5rem;
    text-align: center;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    font-size: 1.25rem;
    gap: 4px 1em;
    justify-content: center;
}

.tag-list small {
    color: var(--color-text-muted);
    font-size: 0.8em;
}

.asturias-map {
    margin-block: 48px;
    width: 100%;
}

.asturias-map path {
    fill: var(--color-map-idle);
    fill-rule: evenodd;
    stroke: var(--color-background);
}

.asturias-map a path {
    fill: var(--color-link);
}

.asturias-map a:hover path,
.asturias-map a:focus-visible path {
    fill: var(--color-text);
}

.asturias-map text {
    fill: var(--color-text);
    font-size: 28px;
    pointer-events: none;
    text-anchor: end;
    visibility: hidden;
}

.asturias-map g:hover text,
.asturias-map a:hover text,
.asturias-map a:focus-visible text {
    visibility: visible;
}


/* Photo slots **************************************************************/

.photo-slot {
    --line: rgb(255 255 255 / 50%);
    background:
        var(--photo, none) center / cover no-repeat,
        linear-gradient(to top right, transparent calc(50% - 1px), var(--line) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom right, transparent calc(50% - 1px), var(--line) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
        rgb(255 255 255 / 15%);
    border-radius: var(--radius);
}


/* Information and 404 ******************************************************/

.about {
    display: grid;
    gap: 24px;
}

.about-photo {
    --photo: url("../images/informacion.jpg");
    aspect-ratio: 16 / 9;
    margin-bottom: 16px;
}

.not-found {
    --photo: url("../images/404.jpg");
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 60vh;
}

.not-found-info {
    background-color: var(--color-overlay);
    border-radius: var(--radius);
    margin: 20px;
    padding: 32px;
    text-align: center;
}

.not-found-info h1 {
    margin-bottom: 16px;
}


/* Reduced motion ***********************************************************/

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

    * {
        transition: none !important;
    }
}
