* {
    box-sizing: border-box;
}


/* =========================================================
   Global
   ========================================================= */



html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;

    font-family: "Dela Gothic One", sans-serif;

    background-color: white;
    color: #171717;
}

html {
    overflow-x: hidden;
}



body {
    min-height: 100vh;
    overflow-x: hidden;
}

.dela-gothic-one-regular {
    font-family: "Dela Gothic One", sans-serif;
    font-weight: 400;
    font-style: normal;
}


/* =========================================================
   Header
   ========================================================= */

#site-header {
    position: fixed;
    top: 0;
    left: 0;

    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 18px 24px;

    z-index: 100;

    pointer-events: none;
}

#site-title {
    font-size: 1rem;

    pointer-events: auto;
}

#other-sites-button {
    padding: 0;

    border: none;

    background: transparent;
    color: #171717;

    font-family: "Dela Gothic One", sans-serif;
    font-size: 0.85rem;

    cursor: pointer;

    pointer-events: auto;
}


/* =========================================================
   Main layout
   ========================================================= */

main {
    width: 100%;
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 60px 24px 40px;
}

#view-section {
    width: 50%;
    max-width: 750px;
    min-width: 0;
}

#birthday-section,
#result-section {
    width: 100%;

    text-align: center;
}


/* =========================================================
   Birthday heading
   ========================================================= */

#birthday-heading {
    position: relative;

    width: fit-content;

    margin: 0 auto 38px;

    text-align: center;
}

#birthday-heading h1 {
    margin: 0;

    font-size: clamp(1.7rem, 3vw, 2.5rem);
    line-height: 1.15;

    letter-spacing: 0.05rem;
}


/* =========================================================
   Privacy info
   ========================================================= */

#privacy-info {
    position: absolute;

    left: calc(100% + 8px);
    top: 50%;

    transform: translateY(-50%);

    display: flex;
    align-items: center;
}

#privacy-info-button {
    width: 16px;
    height: 16px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #777;
    border-radius: 50%;

    background: transparent;
    color: #666;

    font-family: serif;
    font-size: 10px;

    cursor: pointer;
}


/* =========================================================
   Privacy tooltip
   ========================================================= */

#privacy-tooltip {
    position: absolute;

    bottom: calc(100% + 8px);
    left: 50%;

    transform: translateX(-50%);

    width: max-content;
    max-width: 220px;

    padding: 8px 10px;

    background: #222;
    color: white;

    border-radius: 6px;

    font-family: sans-serif;
    font-size: 0.75rem;
    font-weight: normal;

    line-height: 1.4;
    text-align: center;

    pointer-events: none;

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.15s,
        visibility 0.15s;

    z-index: 10;
}

#privacy-info:hover #privacy-tooltip,
#privacy-info:focus-within #privacy-tooltip,
#privacy-info.open #privacy-tooltip {
    opacity: 1;
    visibility: visible;
}


/* =========================================================
   Form
   ========================================================= */

#birthday-form {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 22px;
}


/* =========================================================
   Birthday input pill
   ========================================================= */

#birthday-inputs {
    width: 100%;
    max-width: 500px;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    gap: clamp(6px, 2vw, 20px);

    min-width: 0;

    padding: 10px 20px;

    background-color: #e7f7ef;

    border-radius: 999px;
}

#birthday-inputs label {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;

    gap: 6px;

    min-width: 0;

    color: #777;

    font-family: sans-serif;
    font-size: 0.72rem;
    font-weight: 500;

    letter-spacing: 0.03rem;
}


/* Relative widths */

#birthday-inputs label:nth-child(1) {
    flex: 1.6;
}

#birthday-inputs label:nth-child(2) {
    flex: 0.7;
}

#birthday-inputs label:nth-child(3) {
    flex: 1;
}


/* =========================================================
   Day / year controls
   ========================================================= */

#birthday-inputs input {
    width: 100%;
    min-width: 0;

    height: 58px;

    padding: 0 4px;

    border: none;
    outline: none;

    background: transparent;

    color: #171717;

    font-family: "Dela Gothic One", sans-serif;
    font-size: clamp(1.35rem, 3vw, 2rem);

    text-align: center;

    caret-color: transparent;

    border-radius: 8px;
}

#birthday-inputs input:focus {
    outline: none;
    background: transparent;
}

#birth-day::placeholder,
#birth-year::placeholder {
    color: #aaa;
    opacity: 1;
}


/* =========================================================
   Custom month picker
   ========================================================= */

.month-wrapper {
    position: relative;

    width: 100%;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;
}

#birth-month {
    width: 100%;
    height: 58px;

    padding: 0 4px;

    border: none;
    outline: none;

    background: transparent;
    color: #aaa;

    font-family: "Dela Gothic One", sans-serif;
    font-size: clamp(1.35rem, 3vw, 2rem);

    text-align: center;

    cursor: pointer;

    border-radius: 8px;
}

#birth-month.selected {
    color: #171717;
}


/* Month popup */

#month-picker {
    position: absolute;

    top: calc(100% + 10px);
    left: 50%;

    transform: translateX(-50%);

    width: 260px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 4px;

    padding: 8px;

    background: white;

    border: 1px solid #ddd;
    border-radius: 12px;

    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);

    z-index: 20;
}

#month-picker[hidden] {
    display: none;
}

#month-picker button {
    padding: 9px 6px;

    border: none;
    border-radius: 7px;

    background: transparent;
    color: #171717;

    font-family: sans-serif;
    font-size: 0.85rem;

    cursor: pointer;
}

#month-picker button:hover,
#month-picker button:focus {
    outline: none;

    background-color: #e7f7ef;
}


/* =========================================================
   Error
   ========================================================= */

#error-message {
    margin: -8px 0 0;

    font-family: sans-serif;
    font-size: 0.85rem;
}


/* =========================================================
   Show me button
   ========================================================= */

#birthday-form > button[type="submit"] {
    min-width: 150px;

    margin-top: 4px;

    padding: 13px 26px;

    border: none;
    border-radius: 8px;

    background-color: #171717;
    color: white;

    font-family: "Dela Gothic One", sans-serif;
    font-size: 1rem;

    cursor: pointer;

    transition: transform 0.12s;
}

#birthday-form > button[type="submit"]:hover {
    transform: translateY(-1px);
}

#birthday-form > button[type="submit"]:active {
    transform: translateY(1px);
}


/* =========================================================
   Results
   ========================================================= */

#result-section {
    width: 100%;
    text-align: left;
}


/* ---------- Result header ---------- */

#result-header {
    margin-bottom: 36px;

    text-align: center;
}

#result-eyebrow {
    margin: 0 0 8px;

    color: #777;

    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 500;

    letter-spacing: 0.04rem;
    text-transform: uppercase;
}

#target-date {
    margin: 0;

    font-size: clamp(1.8rem, 3.5vw, 2.7rem);
    line-height: 1.15;

    letter-spacing: 0.03rem;
}

#result-age {
    margin: 10px 0 0;

    color: #666;

    font-family: sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
}


/* ---------- Events heading ---------- */

#events-heading {
    margin-bottom: 14px;

    border-bottom: 1px solid #ddd;
}

#events-heading h3 {
    margin: 0 0 10px;

    font-size: 1rem;
    line-height: 1.3;
}


/* ---------- Events ---------- */

#events {
    display: flex;
    flex-direction: column;

    gap: 18px;

    margin-bottom: 32px;
}

#events article {
    width: 100%;

    padding: 20px;

    background-color: #e7f7ef;

    border-radius: 8px;
}

#events article img {
    display: block;

    width: auto;
    max-width: 100%;
    max-height: 340px;

    margin: 0 auto 16px;

    object-fit: contain;

    border-radius: 6px;
}

#events article p {
    margin: 0;

    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.55;
}

.event-source {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 16px;

    margin-top: 16px;
    padding-top: 12px;

    border-top: 1px solid rgba(0, 0, 0, 0.12);

    color: #666;

    font-family: sans-serif;
    font-size: 0.75rem;
}

.event-source a {
    color: #171717;
    font-weight: 600;
    text-decoration: none;
}

.event-source a:hover {
    text-decoration: underline;
}


/* ---------- Result actions ---------- */

#result-actions {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 12px;

    margin-top: 8px;
}

#result-actions button {
    min-width: 170px;

    padding: 13px 22px;

    border: none;
    border-radius: 8px;

    background-color: #171717;
    color: white;

    font-family: "Dela Gothic One", sans-serif;
    font-size: 0.9rem;

    cursor: pointer;

    transition: transform 0.12s;
}

#result-actions button:hover {
    transform: translateY(-1px);
}

#result-actions button:active {
    transform: translateY(1px);
}


/* =========================================================
   Events
   ========================================================= */

#events {
    width: 100%;

    display: flex;
    flex-direction: column;

    gap: 28px;

    margin-bottom: 32px;
}

#events article {
    width: 100%;
}

#events article p {
    margin: 12px 0;

    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

/* #events img {
    display: block;

    width: 100%;
    max-height: 300px;

    margin: 0 auto;

    object-fit: cover;

    border-radius: 12px;
} */

#events img {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 350px;

    margin: 0 auto 16px;

    object-fit: contain;

    border-radius: 12px;
}


/* =========================================================
   Read more
   ========================================================= */

#events a {
    display: inline-block;

    padding: 8px 16px;

    background-color: #e7f7ef;
    color: #171717;

    border-radius: 999px;

    font-family: "Dela Gothic One", sans-serif;
    font-size: 0.75rem;

    text-decoration: none;

    transition: background-color 0.12s;
}

#events a:hover {
    background-color: #d8f1e5;
}


/* =========================================================
   Try another birthday
   ========================================================= */

#reset-button {
    padding: 12px 20px;

    border: none;
    border-radius: 8px;

    background-color: #171717;
    color: white;

    font-family: "Dela Gothic One", sans-serif;
    font-size: 0.85rem;

    cursor: pointer;

    transition: transform 0.12s;
}

#reset-button:hover {
    transform: translateY(-1px);
}

#reset-button:active {
    transform: translateY(1px);
}

#birthday-inputs input:focus,
#birth-month:focus,
#birth-month[aria-expanded="true"] {
    outline: none;
    box-shadow: inset 0 0 0 2px #171717;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {

    #view-section {
        width: 70%;
    }
}

/* /* =========================================================
   Mobile
   ========================================================= */


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 600px) {

    /*
     * dvh follows the actual visible mobile viewport better
     * than vh when browser bars appear/disappear.
     */
    main {
        width: 100%;
        min-height: 100dvh;

        padding: 24px 14px;

        align-items: center;
        padding-top: 10vh;

    }

    body.results-visible main {
        align-items: flex-start;
    }


    /* ---------- Header ---------- */

    #site-header {
        padding: 14px;
    }

    #site-title {
        font-size: 0.85rem;
    }

    #other-sites-button {
        font-size: 0.8rem;
    }


    /* ---------- Main content ---------- */

    #view-section {
        width: 100%;
        max-width: none;
        min-width: 0;
    }


    /* ---------- Birthday heading ---------- */

    #birthday-heading {
        margin-bottom: 32px;
    }

    #birthday-heading h1 {
        font-size: clamp(1.6rem, 8vw, 2rem);
    }


    /* ---------- Privacy info ---------- */

    #privacy-info {
        left: auto;
        right: 0;
        top: -2px;

        transform: none;
    }

    #privacy-tooltip {
        top: calc(100% + 8px);
        bottom: auto;

        left: auto;
        right: 0;

        transform: none;

        width: max-content;
        max-width: min(180px, calc(100vw - 28px));

        white-space: normal;
    }


    /* ---------- Form ---------- */

    #birthday-form {
        width: 100%;

        gap: 20px;
    }


    /* ---------- Birthday input pill ---------- */

    #birthday-inputs {
        width: 100%;
        max-width: none;
        min-width: 0;

        gap: 5px;

        padding: 8px 12px;
    }

    #birthday-inputs label {
        min-width: 0;

        font-size: 0.68rem;
    }


    /* ---------- Day / year ---------- */

    #birthday-inputs input {
        min-width: 0;
        height: 54px;

        /*
         * Keep at least 16px to prevent iOS input zoom.
         */
        font-size: clamp(1rem, 6vw, 1.5rem);
    }


    /* ---------- Month ---------- */

    .month-wrapper {
        position: relative;

        min-width: 0;
        height: 54px;
    }

    #birth-month {
        min-width: 0;
        height: 54px;

        font-size: clamp(1rem, 6vw, 1.5rem);
    }


    /*
     * Don't center the popup around the relatively narrow
     * Month control on mobile. Anchor it instead.
     */
    #month-picker {
        left: 0;
        right: auto;

        transform: none;

        width: min(220px, calc(100vw - 28px));

        gap: 3px;

        padding: 7px;
    }

    #month-picker button {
        min-width: 0;

        padding: 10px 4px;

        font-size: 0.8rem;
    }


    /* ---------- Submit ---------- */

    #birthday-form > button[type="submit"] {
        width: min(100%, 240px);

        padding: 14px 20px;
    }


    /* =====================================================
       Results
       ===================================================== */

    #result-section {
        width: 100%;

        margin-top: 0;
    }

    #result-header {
        margin-bottom: 28px;
    }

    #result-eyebrow {
        font-size: 0.72rem;
    }

    #target-date {
        font-size: clamp(1.6rem, 8vw, 2rem);
    }

    #events-heading {
        margin-bottom: 14px;
    }


    /* ---------- Event cards ---------- */

    #events {
        width: 100%;

        gap: 16px;

        margin-bottom: 26px;
    }

    #events article {
        width: 100%;

        padding: 16px;
    }

    #events article img {
        display: block;

        width: auto;
        max-width: 100%;
        max-height: 280px;

        margin: 0 auto 14px;

        object-fit: contain;
    }

    #events article p {
        font-size: 0.95rem;
    }

    .event-source {
        gap: 10px;

        font-size: 0.7rem;
    }


    /* ---------- Result buttons ---------- */

    #result-actions {
        width: 100%;

        display: flex;
        align-items: stretch;
        justify-content: center;

        gap: 10px;

        margin-top: 8px;
    }

    #result-actions button {
        flex: 1;

        width: 0;
        min-width: 0;
        min-height: 60px;

        display: flex;
        align-items: center;
        justify-content: center;

        margin: 0;
        padding: 10px 12px;

        font-size: 0.8rem;
        line-height: 1.2;
        text-align: center;
    }


    /*
     * If these buttons have separate global rules, this keeps
     * them from overriding the equal-height action layout.
     */
    #share-two,
    #reset-button {
        min-height: 60px;
    }
}


/* =========================================================
   Very small phones
   ========================================================= */

@media (max-width: 350px) {



    main {
        padding-left: 8px;
        padding-right: 8px;
    }

    #birthday-heading h1 {
        font-size: 1.45rem;
    }

    #birthday-inputs {
        gap: 2px;

        padding-left: 8px;
        padding-right: 8px;
    }

    #birthday-inputs input,
    #birth-month {
        font-size: 1rem;
    }

    #month-picker {
        width: min(210px, calc(100vw - 16px));
    }

    #result-actions {
        gap: 6px;
    }

    #result-actions button {
        padding-left: 8px;
        padding-right: 8px;

        font-size: 0.75rem;
    }
}