/* ==========================================================================
   Juan Arenosa — index.css
   ========================================================================== */


/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideInFromTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes revealElement {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    /* Colours — Pantone grays (screen approximations) */
    --color-coconut-white: #fbfaf8;
    /* Pantone White */
    --color-fog-gray: #e1e2e4;
    /* Pantone 427 */
    --color-cloudy-gray: #ccd0d3;
    /* Pantone 428 */
    --color-metal-gray: #a2a4a7;
    /* Pantone 877 */

    --color-mushroom-gray: #d6cfc8;
    /* Pantone 400 */
    --color-rhinoceros-gray: #b8ac9c;
    /* Pantone 402 */
    --color-mouse-gray: #847a6b;
    /* Pantone 404 */
    --color-pigeon-gray: #d9cec9;
    /* Pantone 406 */

    --color-elephant-gray: #b6a39f;
    /* Pantone 408 */
    --color-hippopotamus-gray: #8a7266;
    /* Pantone 410 */
    --color-squirrel-gray: #bfbfad;
    /* Pantone 414 */
    --color-sidewalk-gray: #8e9180;
    /* Pantone 416 */

    --color-sardine-gray: #5c6049;
    /* Pantone 418 */
    --color-grandma-gray: #c5c6c8;
    /* Pantone 421 */
    --color-koala-gray: #9c9c9f;
    /* Pantone 423 */
    --color-charcoal-gray: #5a5b5d;
    /* Pantone 425 */

    --color-dolphin-gray: #a7b1bc;
    /* Pantone 7543 */
    --color-shark-gray: #8c97a3;
    /* Pantone 7544 */
    --color-slate-gray: #475764;
    /* Pantone 7546 */
    --color-licorice-black: #0b0b0b;
    /* Pantone Black */

    /* Semantic colours — swap these to restyle the site */
    --color-background: var(--color-licorice-black);
    --color-text: var(--color-licorice-black);
    --color-accent: var(--color-slate-gray);

    /* Font sizes */
    --font-size-sm: 18pt;
    --font-size-md: 36pt;
    --font-size-lg: 72pt;

    /* Transitions */
    --transition-fade: 0.15s;
    --transition-colors:
        color var(--transition-fade) ease-in-out,
        background-color var(--transition-fade) ease-in-out,
        filter var(--transition-fade) ease-in-out,
        border-color var(--transition-fade) ease-in-out;

    /* Menu slide */
    --transition-menu: 0.35s;

    /* Animations */
    --animation-top: slideInFromTop 400ms ease forwards;
    --animation-reveal: revealElement 500ms ease-in forwards;
}

::-webkit-scrollbar {
    display: none;
}


/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: var(--transition-colors);
}


/* ==========================================================================
   Base
   ========================================================================== */

body {
    /* font-family: "Archivo", sans-serif; */
    font-family: Arial, Helvetica, sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-size: var(--font-size-sm);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.2;
}

main {
    animation: var(--animation-top);
}

header {
    animation: var(--animation-reveal);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    cursor: pointer;
}


/* ==========================================================================
   Footer & navigation
   ========================================================================== */

footer {
    width: 100%;
    height: auto;
    position: fixed;
    z-index: 10;
    left: 0;
    bottom: 1rem;
    mix-blend-mode: difference;
}

nav.nav-desktop {
    display: block;
}

nav.nav-mobile {
    display: none;
}

.button-mobile {
    display: none;
}

footer ul {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 1rem;
    padding: 0 1rem 0 1rem;
}

footer li,
.button-mobile {
    list-style: none;
    text-align: center;
    text-transform: uppercase;
    color: var(--color-coconut-white);
    border: 2pt var(--color-coconut-white) solid;
    background-color: var(--color-licorice-black);
    border-radius: 2rem;
    padding: 0.5rem 0 0.5rem 0;
}

/* Whole pill is clickable now that the link sits inside the li */
footer li a {
    display: block;
}

/* Reset browser button defaults so it matches the pill style */
.button-mobile {
    font: inherit;
    width: calc(100% - 2rem);
    padding: 0.5rem;
    margin: 1rem;
    cursor: pointer;
}

footer li:hover,
.button-mobile:hover {
    color: var(--color-licorice-black);
    background-color: var(--color-coconut-white);
    border-color: var(--color-licorice-black);
}


/* ==========================================================================
   Newsletter pop-up (site/snippets/newsletter.php)
   ========================================================================== */

/* No page scrolling behind the open pop-up */
html:has(dialog.newsletter[open]) {
    overflow: hidden;
}

dialog.newsletter {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(36rem, calc(100% - 2rem));
    max-width: none;
    height: fit-content;
    max-height: calc(100dvh - 2rem);
    padding: 0;
    overflow: auto;
    border: 2pt var(--color-coconut-white) solid;
    border-radius: 2rem;
    background-color: var(--color-licorice-black);
    color: var(--color-coconut-white);
    opacity: 0;
    transform: translateY(2rem);
    transition:
        opacity var(--transition-menu) ease,
        transform var(--transition-menu) ease;
}

dialog.newsletter.is-open {
    opacity: 1;
    transform: translateY(0);
}

/* Blurred page behind the pop-up */
dialog.newsletter::backdrop {
    background-color: rgba(11, 11, 11, 0);
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
    transition:
        background-color var(--transition-menu) ease,
        backdrop-filter var(--transition-menu) ease,
        -webkit-backdrop-filter var(--transition-menu) ease;
}

dialog.newsletter.is-open::backdrop {
    background-color: rgba(11, 11, 11, 0.4);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

/* Without JavaScript the "Newsletter" link (#newsletter-popup) still shows it */
dialog.newsletter:target:not([open]) {
    display: block;
    opacity: 1;
    transform: none;
    z-index: 100;
}

.newsletter-panel {
    height: auto;
    position: relative;
    padding: 2rem;
}

.newsletter-title {
    font-size: var(--font-size-md);
    text-transform: uppercase;
    padding-right: 3.5rem;            /* room for the X */
    margin-bottom: 1rem;
}

.newsletter-text {
    margin-bottom: 2.5rem;
}

/* --- Close button (X), same pill style as the menu --- */

.newsletter-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
    border: 2pt var(--color-coconut-white) solid;
    border-radius: 50%;
    background-color: var(--color-licorice-black);
    color: var(--color-coconut-white);
    cursor: pointer;
}

.newsletter-close span,
.newsletter-close span::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.1rem;
    height: 2pt;
    background-color: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.newsletter-close span::before {
    content: "";
    transform: translate(-50%, -50%) rotate(90deg);
}

.newsletter-close:hover,
.newsletter-close:focus-visible {
    color: var(--color-licorice-black);
    background-color: var(--color-coconut-white);
}

/* --- Minimal submit line: one underline, field + button on it --- */

.newsletter-line {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    border-bottom: 2pt var(--color-coconut-white) solid;
}

.newsletter-form.is-error .newsletter-line {
    border-bottom-color: var(--color-elephant-gray);
}

.newsletter-line input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0;
    border: 0;
    border-radius: 0;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: max(16px, 1em);        /* 16px+ stops iPhones from zooming in */
}

.newsletter-line input::placeholder {
    color: var(--color-metal-gray);
    opacity: 1;
}

.newsletter-line button {
    flex: 0 0 auto;
    padding: 0.5rem 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: uppercase;
    cursor: pointer;
}

.newsletter-line button:hover,
.newsletter-line button:focus-visible {
    color: var(--color-metal-gray);
}

.newsletter-form.is-busy .newsletter-line button {
    opacity: 0.4;
    cursor: wait;
}

.newsletter-message {
    min-height: 1.2em;
    margin-top: 1rem;
}

.newsletter-message.is-error {
    color: var(--color-elephant-gray);
}

/* Spam trap: off-screen for people, still in the form for bots */
.newsletter-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Hidden visually, still read out by screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {

    dialog.newsletter,
    dialog.newsletter::backdrop {
        transition: none;
    }
}


/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {}

/* Mobile */
@media (max-width: 640px) {

    :root {
        /* Font sizes */
        --font-size-sm: 9pt;
        --font-size-md: 18pt;
        --font-size-lg: 36pt;
    }

    footer ul {
        display: block;
    }

    nav.nav-desktop {
        display: none;
    }

    .button-mobile {
        display: block;
    }

    /* Mobile menu: hidden below, slides up above the Menu button */
    nav.nav-mobile {
        display: block;
        position: absolute;
        bottom: 100%;
        left: 0;
        width: 100%;
        transform: translateY(2rem);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            transform var(--transition-menu) ease,
            opacity var(--transition-menu) ease,
            visibility 0s linear var(--transition-menu);
        /* hide only after sliding out */
    }

    nav.nav-mobile.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition:
            transform var(--transition-menu) ease,
            opacity var(--transition-menu) ease,
            visibility 0s;
    }

    nav.nav-mobile li+li {
        margin-top: 1rem;
    }

    /* Newsletter pop-up */
    dialog.newsletter {
        border-radius: 1.5rem;
    }

    .newsletter-panel {
        padding: 1.5rem;
    }

    .newsletter-close {
        top: 1rem;
        right: 1rem;
    }

}