/* Font face declaration */
@font-face {
    font-family: 'PitchSans';
    src: url('./PitchSans-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

:root {
    --font-primary: 'PitchSans', 'Helvetica Neue', Arial, sans-serif;
    --font-condensed: 'Avenir Next Condensed', 'Helvetica Neue', 'Arial Narrow', 'Impact', sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: #F6F7F8;
    color: #222;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.footer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin: 10px;
}

.clickable {
    cursor: pointer;
    text-decoration: underline;
    color: #82A4DB;
}

.clickable:hover {
    opacity: 0.8;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #f8f8f8;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><filter id="paper"><feTurbulence baseFrequency="0.04" numOctaves="5" result="noise" seed="1"/><feDiffuseLighting in="noise" lighting-color="white" surfaceScale="1"><feDistantLight azimuth="45" elevation="60"/></feDiffuseLighting></filter></defs><rect width="100" height="100" fill="%23f8f8f8" filter="url(%23paper)" opacity="0.3"/></svg>');
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content h2 {
    font-family: 'PitchSans', 'Helvetica Neue', Arial, sans-serif;
    color: #222;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.modal-content p {
    font-family: var(--font-condensed);
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #222;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

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

.container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    padding: 20px;
    text-align: center;
    flex: 1;
    overflow: hidden;
}

header {
    margin-bottom: 20px;
}

h1 {
    font-weight: normal;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #222;
}

.fortune-cookie {
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.8s ease, visibility 0.8s;
    max-width: 100%;
    overflow: hidden;
}

#fortuneCookie.faded {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.fortune-cookie:active {
    transform: scale(0.98);
}

.fortune-cookie pre {
    font-size: 6px;
    line-height: 1;
    color: #222;
    margin: 0 auto;
    white-space: pre;
    overflow: hidden;
    text-align: center;
    display: block;
}

.main-content {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fortune-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 450px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.fortune-paper {
    pointer-events: auto;
}

.fortune-paper {
    background-color: #f8f8f8;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><filter id="paper"><feTurbulence baseFrequency="0.04" numOctaves="5" result="noise" seed="1"/><feDiffuseLighting in="noise" lighting-color="white" surfaceScale="1"><feDistantLight azimuth="45" elevation="60"/></feDiffuseLighting></filter></defs><rect width="100" height="100" fill="%23f8f8f8" filter="url(%23paper)" opacity="0.3"/></svg>');
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: rotate(-1deg);
    border: 1px solid #e0e0e0;
    max-width: 80%;
    word-wrap: break-word;
    cursor: pointer;
}

.fortune-paper:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: #82A4DB;
    border-top-left-radius: 5px;
    pointer-events: none;
}

.fortune-paper:after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background-color: #82A4DB;
    border-bottom-right-radius: 5px;
    pointer-events: none;
}


#fortuneText {
    font-family: var(--font-condensed);
    font-size: 1.1rem;
    color: #82A4DB;
    margin: 0;
}

/* Animation for fortune */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.fortune-paper {
    animation: fadeIn 0.2s ease-out forwards;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .fortune-cookie pre {
        font-size: 5px;
    }

    #fortuneText {
        font-size: 1rem;
    }

    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 320px) {
    .fortune-cookie pre {
        font-size: 4px;
    }

    .container {
        padding: 10px;
    }
}