/* Make element dimensions predictable */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --page-background: #f4f3f1;
    --panel-background: #ffffff;
    --text-colour: #202020;
    --muted-text: #5c5c5c;
    --button-background: #252525;
    --button-hover: #000000;
    --button-text: #ffffff;
    --primary-background: #9a6b2f;
    --primary-hover: #7d5423;
    --focus-colour: #005fcc;
    --maximum-width: 1100px;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--page-background);
    color: var(--text-colour);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
}

.page {
    width: min(100% - 2rem, var(--maximum-width));
    margin: auto;
    padding-block: 2rem;
}


/*
 * Main desktop layout.
 *
 * Text and buttons are on the left.
 * The barber image is on the right.
 */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    overflow: hidden;
    background: var(--panel-background);
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 10%);
}


/*
 * Text section
 */
.hero__content {
    padding: clamp(2rem, 5vw, 4rem);
    padding-right: 0;
}

.hero__location {
    margin: 0 0 0.5rem;
    color: var(--primary-background);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.25rem, 6vw, 4.5rem);
    line-height: 1.05;
    text-wrap: balance;
}

.hero__intro {
    max-width: 34rem;
    margin: 1.25rem 0 0;
    color: var(--muted-text);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
}


/*
 * Image
 *
 * Do not force an aspect ratio here. This allows the browser
 * to retain the proportions of the original 378 x 417 image.
 */
.hero__image {
    align-self: center;
}

.hero__image img {
    display: block;
    width: 100%;
    height: auto;
}


/*
 * Action buttons
 *
 * The three-column grid ensures all three buttons have
 * exactly the same width on desktop.
 */
.actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 2rem;
}

.button {
    display: inline-flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: 2px solid var(--button-background);
    border-radius: 0.5rem;
    background: var(--button-background);
    color: var(--button-text);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        transform 150ms ease;
}

.button:hover {
    border-color: var(--button-hover);
    background: var(--button-hover);
    transform: translateY(-1px);
}

.button--primary {
    border-color: var(--primary-background);
    background: var(--primary-background);
}

.button--primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}

.button:focus-visible {
    outline: 3px solid var(--focus-colour);
    outline-offset: 3px;
}


/*
 * Footer
 */
.footer {
    padding: 1rem;
    color: var(--muted-text);
    font-size: 0.875rem;
    text-align: center;
}


/*
 * Tablet and mobile
 */
@media (max-width: 760px) {

    .page {
        width: min(100% - 1rem, var(--maximum-width));
        padding-block: 0.5rem;
    }

    /*
     * Change the hero from two columns to a single column.
     */
    .hero {
        grid-template-columns: 1fr;
        gap: 0;
        border-radius: 0.75rem;
    }

    /*
     * Image first on mobile.
     *
     * There is deliberately no fixed height or aspect-ratio.
     * This means the complete image is shown rather than
     * cropping the top and bottom.
     */
    .hero__image {
        grid-row: 1;
        width: 100%;
        min-height: 0;
    }

    .hero__image img {
        display: block;
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /*
     * Text and buttons underneath the image.
     */
    .hero__content {
        grid-row: 2;
        padding: 1.75rem 1.25rem;
    }

    /*
     * Stack buttons vertically on mobile.
     */
    .actions {
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
        min-height: 52px;
    }
}


/*
 * Avoid unnecessary animation for users who have
 * requested reduced motion.
 */
@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    .button {
        transition: none;
    }
}
