/* RESET */

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

/* Prevent font size inflation */
html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
    text-wrap: pretty;
    margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
    list-style: none;
}

/* Set core body defaults */
body {
    min-height: 100dvh;
    line-height: 1.5;

    * {
        padding: 0;
        margin: 0;
    }
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
    line-height: 1.1;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
    text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
    text-decoration-skip-ink: auto;
    text-underline-offset: 0.15em;
    transition: opacity 0.3s;
    color: #647182;

    &:hover,
    &:focus-visible {
        color: darkslategray;
    }
}

/* Make images easier to work with */
img,
picture {
    max-width: 100%;
    display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
    min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
    scroll-margin-block: 5ex;
}

/* BASE */

:root {
    /* Colours */
    --light: white;
    --dark: #111;
    --medium: #647182;
    --accent: goldenrod;

    /* Font sizes */
    --text-sm: 0.875rem;
    --text-xs: 0.75rem;

    /* Spacing */
    --left-col-width: 20rem;
    --outer: clamp(2rem, 10vw, 4rem);
    --inner: clamp(1rem, 5vw, 2rem);
}

@font-face {
    font-family: "Playfair Display";
    src:
        local("Playfair Display Regular"),
        local("PlayfairDisplay-Regular"),
        url("fonts/PlayfairDisplay-Regular.woff2") format("woff2"),
        url("fonts/PlayfairDisplay-Regular.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        "Open Sans",
        "Helvetica Neue",
        sans-serif;
    background-color: var(--light);
    padding: var(--outer);
    color: var(--dark);
    font-weight: 300;
    font-size: 1em;
    margin: 0;

    ::selection {
        background: var(--accent); /* WebKit/Blink Browsers */
    }
    ::-moz-selection {
        background: var(--accent); /* Gecko Browsers */
    }
}

/* TYPOGRAPHY */

kbd {
    background-color: #eee;
    border-radius: 3px;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.2),
        0 2px 0 0 rgba(255, 255, 255, 0.7) inset;
    color: var(--dark);
    display: inline-block;
    /* font-size: var(--text-xs); */
    font-weight: 700;
    line-height: 1.25;
    padding: 2px 5px;
    white-space: nowrap;
}

details {
    flex-grow: 1;
    cursor: pointer;

    summary {
        font-weight: 700;
    }

    p {
        font-size: var(--text-sm);
        padding-top: 0.5em;
    }

    ::marker {
        color: var(--accent);
    }
}

small {
    display: block;
    text-wrap: balance;
}

b {
    font-weight: 700;
}

.counter {
    /* font-size: 1rem; */
    font-weight: 200;
    color: var(--medium);
}

/* HEADER / LEFT COLUMN */

header {
    justify-content: space-between;
    flex-direction: column;
    gap: var(--inner);
    display: flex;

    p {
        text-wrap: balance;
    }
}

header h1 {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 3em;

    div {
        font-family: sans-serif;
        margin-top: var(--inner);
        color: var(--medium);
        font-weight: 300;
        font-size: 1rem;
        line-height: 1;
        display: block;
    }
}

.contact {
    align-items: center;
    flex-direction: row;
    align-items: center;
    list-style: none;
    display: flex;
    gap: 1.5em;
    margin: 0;

    button,
    a:not([class]) {
        text-decoration: none;
        align-items: center;
        color: var(--dark);
        font-weight: 500;
        display: flex;
        gap: 0.5rem;

        svg {
            fill: var(--accent);
        }

        &:hover,
        &:focus-visible {
            text-decoration: underline;
            text-underline-offset: 0.15em;
            color: var(--accent);
        }
    }
}

/* MAIN CONTENT / RIGHT COLUMN */

section {
    padding: var(--outer) 0;
}

section h2 {
    font-weight: 600;
    line-height: 1.25;
    font-size: 1em;

    span {
        font-weight: 300;
        color: #647182;
        display: block;
    }
}

section figure {
    flex-direction: column;
    gap: var(--text-xs);
    display: flex;
}

section .list {
    gap: var(--outer) var(--inner);
    list-style: none;
    padding: 0;

    --grid-placement: auto-fit;
    --grid-min-item-size: clamp(150px, 20%, 300px);

    display: grid;
    grid-template-columns: 
        repeat(var(--grid-placement, auto-fit), 
        minmax(var(--grid-min-item-size, 16rem), 1fr))
    ;

    img {
        transition: opacity 0.3s;
        aspect-ratio: 300 / 365;
        height: auto;
        width: 100%;
    }
}

.img_wrap {
    position: relative;
    background-color: #cdcfd3;
}

.img_hover {
    position: absolute;
    opacity: 0;
    top: 0;
}

.img_wrap:hover,
.img_wrap:focus-visible {
    .img_hover {
        opacity: 1;
    }
}

/* img:not(.img_hover) {
    animation: fadeIn;
    animation-timeline: view(50% block);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
} */

/* ADJUSTMENTS */

@media screen and (min-width: 960px) {
    body {
        padding: 0 var(--outer);
    }

    main {
        gap: var(--outer);
        display: flex;
    }

    header {
        position: sticky;
        height: 100dvh;
        width: var(--left-col-width);
        padding: var(--outer) 0;
        top: 0;
    }

    section {
        max-width: calc(100dvw - var(--left-col-width));
        min-height: 100dvh;
        flex: 1;
    }
}

.hover {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .touch {
        display: none;
    }

    .hover {
        display: block;
    }
}
