/* =========================================================
   ALESSANDRO MIORI
   Minimal Swiss-inspired personal website
   ========================================================= */


/* ---------- RESET ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;

    min-height: 100vh;
    min-height: 100dvh;

    background: #e8e7e2;
    color: #111111;

    font-family:
        "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;

    font-weight: 400;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}


/* ---------- PAGE ---------- */

.page {
    position: relative;

    min-height: 100vh;
    min-height: 100dvh;

    padding:
        max(38px, env(safe-area-inset-top))
        max(48px, env(safe-area-inset-right))
        max(38px, env(safe-area-inset-bottom))
        max(48px, env(safe-area-inset-left));

    display: flex;
    flex-direction: column;
}


/* ---------- HEADER ---------- */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    width: 100%;
}


/* ---------- LOGO ---------- */

.brand {
    display: block;
    line-height: 0;
}

.brand img {
    display: block;

    width: 48px;
    height: auto;
}


/* ---------- NAVIGATION ---------- */

.navigation {
    display: flex;
    align-items: center;

    gap: 30px;
}

.navigation a,
.login-trigger {
    position: relative;

    padding: 0;

    border: 0;
    background: none;

    color: #111111;

    font: inherit;
    font-size: 13px;
    font-weight: 400;

    letter-spacing: 0.01em;

    text-decoration: none;

    cursor: pointer;
}


/* underline */

.navigation a::after,
.login-trigger::after {

    content: "";

    position: absolute;

    left: 0;
    bottom: -5px;

    width: 100%;
    height: 1px;

    background: currentColor;

    transform: scaleX(0);
    transform-origin: right;

    transition:
        transform 180ms ease;
}

.navigation a:hover::after,
.login-trigger:hover::after {

    transform: scaleX(1);
    transform-origin: left;
}


/* ---------- HERO ---------- */

.hero {
    flex: 1;

    display: flex;
    align-items: center;

    width: 100%;
}


/* main Swiss grid */

.hero-content {
    width: 100%;

    margin-top: 3vh;
}


/* ---------- NAME ---------- */

h1 {
    margin: 0;

    font-size: clamp(58px, 9.3vw, 172px);

    font-weight: 400;

    line-height: 0.88;

    letter-spacing: -0.065em;

    white-space: nowrap;
}


/* ---------- DIVIDER ---------- */

.rule {
    width: 100%;
    height: 1px;

    margin-top: clamp(28px, 4vw, 60px);
    margin-bottom: 22px;

    background: rgba(17, 17, 17, 0.85);
}


/* ---------- INTRO ---------- */

.intro {
    display: flex;
    flex-direction: column;
    gap: 6px;

    max-width: 800px;
}

.intro p {
    margin: 0;

    max-width: 430px;

    font-size: 14px;
    line-height: 1.5;

    letter-spacing: -0.01em;
}

.intro a {
    color: inherit;

    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}


/* ---------- LOGIN PANEL ---------- */

.login-panel {
    position: fixed;

    top: 92px;
    right: max(48px, env(safe-area-inset-right));

    width: min(320px, calc(100vw - 40px));

    opacity: 0;

    transform: translateY(-8px);

    pointer-events: none;

    transition:
        opacity 200ms ease,
        transform 200ms ease;
}

.login-panel.is-open {
    opacity: 1;

    transform: translateY(0);

    pointer-events: auto;
}


/* ---------- LOGIN FORM ---------- */

.login-form {
    width: 100%;
}

.field {
    margin-bottom: 22px;
}

.field label {
    display: block;

    margin-bottom: 6px;

    font-size: 11px;

    letter-spacing: 0.03em;
}

.field input {
    display: block;

    width: 100%;

    padding: 5px 0 8px;

    border: 0;
    border-bottom: 1px solid #111111;
    border-radius: 0;

    outline: none;

    background: transparent;

    color: #111111;

    font-family: inherit;
    font-size: 16px;
}

.field input:focus {
    border-bottom-width: 2px;
}

.submit-login {
    margin-top: 4px;

    padding: 0 0 4px;

    border: 0;
    border-bottom: 1px solid #111111;

    background: transparent;

    color: #111111;

    font-family: inherit;
    font-size: 13px;

    cursor: pointer;
}

.login-error {
    margin: -5px 0 18px;

    font-size: 12px;
    line-height: 1.4;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .page {
        padding:
            max(30px, env(safe-area-inset-top))
            max(30px, env(safe-area-inset-right))
            max(30px, env(safe-area-inset-bottom))
            max(30px, env(safe-area-inset-left));
    }

    h1 {
        font-size: clamp(54px, 11.5vw, 100px);
    }

    .intro {
        grid-template-columns: 1fr 1fr;

        gap: 35px;
    }

    .login-panel {
        right: max(30px, env(safe-area-inset-right));
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .page {
        padding:
            max(22px, env(safe-area-inset-top))
            max(20px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(20px, env(safe-area-inset-left));
    }


    /* header */

    .brand img {
        width: 40px;
    }

    .navigation {
        gap: 20px;
    }

    .navigation a,
    .login-trigger {
        font-size: 12px;
    }


    /* hero */

    .hero {
        align-items: center;
    }

    .hero-content {
        margin-top: 0;
    }


    /* name */

    h1 {
        font-size: clamp(48px, 15.5vw, 82px);

        line-height: 0.92;

        letter-spacing: -0.06em;

        white-space: normal;

        max-width: 100%;
    }


    /* divider */

    .rule {
        margin-top: 26px;
        margin-bottom: 18px;
    }


    /* text */

    .intro {
        display: block;
    }

    .intro p {
        max-width: 340px;

        font-size: 13px;
        line-height: 1.45;
    }


    /* login */

    .login-panel {
        top: 82px;

        left: 20px;
        right: 20px;

        width: auto;

        padding: 20px 0 24px;

        background: #e8e7e2;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

    .navigation {
        gap: 15px;
    }

    h1 {
        font-size: 14.5vw;
    }

}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }

}
