/* Mobile-first responsive design with multiple breakpoints */

/* Extra small devices (phones, 320px and up) */
@media screen and (max-width: 480px) {
    .home {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .home h2 {
        font-size: 1.8rem;
        margin: 0 0 0.5rem 0;
    }

    .home figure img {
        width: 8rem;
        height: 8rem;
    }

    .home figure figcaption {
        font-size: 1.6rem;
    }

    .home .home-time div {
        width: 2.5rem;
        height: 2.5rem;
    }

    .home .home-time div p {
        font-size: 0.7rem;
    }

    .home .home-time div p span {
        font-size: 0.5rem;
    }

    .welcome h2 {
        font-size: 1.8rem;
    }

    .welcome figure img {
        width: 8rem;
        height: 8rem;
    }

    .welcome figure figcaption {
        font-size: 1.6rem;
    }

    .about, .time {
        padding: 4rem 1rem 6rem;
    }

    .about h2, .about h3 {
        font-size: 1.4rem;
    }

    .hadist {
        padding: 1.5rem 0.8rem;
    }

    .story-content {
        padding: 0 0.5rem;
    }

    .story-intro {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .story-paragraph {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }

    .story-conclusion {
        font-size: 0.95rem;
        margin-top: 1rem;
    }

    .about .about_couple li figure img {
        width: 10rem;
        height: 10rem;
    }

    .gallery .container figure img {
        height: 12rem;
    }

    .gallery .container button:nth-of-type(1),
    .gallery .container button:nth-of-type(2) {
        font-size: 2.5rem;
        top: 10rem;
    }

    .gallery .container button:nth-of-type(1) {
        left: 0.5rem;
    }

    .gallery .container button:nth-of-type(2) {
        right: 0.5rem;
    }

    .wishas div:nth-of-type(1) > div figure img {
        width: 6rem;
        height: 2.5rem;
    }

    .wishas div:nth-of-type(2) {
        padding: 1.5rem 0.8rem;
    }

    .wishas div:nth-of-type(3) {
        padding: 1.5rem 0.8rem;
    }

    .audio button {
        width: 3rem;
        height: 3rem;
        font-size: 1.4rem;
        bottom: 6rem;
        right: 1rem;
    }

    header nav a {
        width: 3.5rem;
        height: 2.5rem;
        font-size: 0.5rem;
    }

    header nav a i {
        font-size: 1rem;
    }
}

/* Small devices (landscape phones, 481px and up) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .home h2 {
        font-size: 2rem;
    }

    .home figure img {
        width: 9rem;
        height: 9rem;
    }

    .about, .time {
        padding: 5rem 1.2rem 7rem;
    }

    .about h2, .about h3 {
        font-size: 1.6rem;
    }

    .gallery .container figure img {
        height: 13rem;
    }

    .gallery .container button:nth-of-type(1),
    .gallery .container button:nth-of-type(2) {
        font-size: 2.8rem;
        top: 11rem;
    }

    .wishas div:nth-of-type(1) > div figure img {
        width: 7rem;
        height: 2.8rem;
    }
}

/* Medium devices (tablets, 769px and up) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .about, .time {
        padding: 8rem 4rem 10rem;
    }

    .gallery {
        padding: 6rem 4rem 10rem;
    }

    .gallery .container figure img {
        height: 25rem;
    }

    .gallery .container button:nth-of-type(1),
    .gallery .container button:nth-of-type(2) {
        top: 20rem;
        font-size: 3.5rem;
    }

    .wishas {
        padding: 6rem 4rem;
    }

    .wishas div:nth-of-type(2) {
        padding: 2rem 3rem 4rem;
    }

    .wishas div:nth-of-type(3) {
        padding: 2rem 3rem;
    }

    footer {
        padding: 3rem 4rem 4rem;
    }
}

/* Mobile-specific styles (768px and below) */
@media screen and (max-width: 768px) {
    .home {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
    }

    header nav {
        display: flex;
        padding: 0.5rem 1rem;
        height: 4rem;
    }

    header nav a {
        min-width: 3.5rem;
        min-height: 2.5rem;
        padding: 0.3rem;
        border-radius: 8px;
        transition: all 0.3s ease;
    }

    header nav a:active {
        background-color: #000;
        color: #fff;
        transform: scale(0.95);
    }

    .home svg {
        bottom: -5rem;
    }

    .about, .time {
        padding: 6rem 1.4rem 8rem;
    }

    .about h2, .about h3 {
        font-size: 1.8rem;
    }

    .about i:nth-of-type(1) {
        right: 1.4rem;
        top: 2.6rem;
    }

    .about i:nth-of-type(2) {
        left: 1.4rem;
        top: 24rem;
    }

    .about i:nth-of-type(3) {
        right: 1.4rem;
        top: 55rem;
    }

    .about i:nth-of-type(4) {
        left: 1.4rem;
        top: 60rem;
    }

    .about i:nth-of-type(5) {
        right: 1.4rem;
    }

    .hadist {
        padding: 2rem 1.4rem;
    }

    .story-content {
        max-width: 100%;
        padding: 0 1rem;
    }

    .story-intro {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
    }

    .story-paragraph {
        font-size: 0.95rem;
        margin-bottom: 1rem;
        text-align: left;
    }

    .story-conclusion {
        font-size: 1rem;
        margin-top: 1.2rem;
    }

    .hadist i {
        left: 1.4rem;
        top: 24rem;
    }

    .hadist svg:nth-of-type(1) {
        top: -4rem;
    }

    .hadist svg:nth-of-type(2) {
        bottom: -5rem;
    }

    .time a + p + i {
        right: 1.4rem;
        top: 16rem;
    }

    .gallery {
        margin-top: -6rem;
        padding: 4rem 1.4rem;
    }

    .gallery .container {
        padding: 0 1rem 1rem;
    }

    .gallery .container figure {
        margin-top: -1rem;
    }

    .gallery .container figure img {
        height: 14rem;
    }

    .gallery .container ul {
        bottom: 5rem;
    }

    .gallery .container ul li {
        width: 1rem;
        height: 0.2rem;
        min-width: 1rem;
        min-height: 0.2rem;
    }

    .gallery .container button:nth-of-type(1),
    .gallery .container button:nth-of-type(2) {
        top: 12.4rem;
        font-size: 3rem;
        min-width: 3rem;
        min-height: 3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
    }

    .gallery .container button:nth-of-type(1):active,
    .gallery .container button:nth-of-type(2):active {
        background-color: rgba(0, 0, 0, 0.6);
        transform: scale(0.9);
    }

    .gallery .container button:nth-of-type(1) {
        left: 0.8rem;
    }

    .gallery .container button:nth-of-type(2) {
        right: 0.8rem;
    }

    .gallery div:nth-of-type(2) {
        padding: 0 1rem 4rem;
    }

    .gallery div:nth-of-type(2) > div {
        margin-top: -1rem;
        padding: 2rem 1rem;
        grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
        gap: 1rem;
    }

    .gallery div:nth-of-type(2) > div img {
        border-radius: 15px;
    }

    .gallery div:nth-of-type(2) button {
        font-size: 1.4rem;
        min-width: 3rem;
        min-height: 3rem;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
    }

    .gallery div:nth-of-type(2) button:active {
        background-color: rgba(0, 0, 0, 0.6);
        transform: scale(0.9);
    }

    .gallery > i {
        top: 2rem;
        left: 3rem;
    }

    .wishas {
        padding: 1rem 1.4rem 2rem;
        margin-top: -14rem;
    }

    .wishas div:nth-of-type(1) > div {
        flex-direction: column;
    }

    .wishas div:nth-of-type(1) > div figure {
        width: 100%;
    }

    .wishas div:nth-of-type(1) > div figure img {
        width: 8rem;
    }

    .wishas div:nth-of-type(2) {
        padding: 2rem 1rem;
    }

    .wishas div:nth-of-type(2) > form {
        margin-top: -1rem;
    }

    .wishas div:nth-of-type(2) > form input,
    .wishas div:nth-of-type(2) > form select,
    .wishas div:nth-of-type(2) > form textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.8rem 1rem;
    }

    .wishas div:nth-of-type(3) {
        padding: 2rem 1rem;
    }

    .wishas div:nth-of-type(3) ul li {
        gap: 0.6rem;
    }

    .wishas div:nth-of-type(3) .button-grup button {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-height: 2.5rem;
        min-width: 2.5rem;
    }

    .wishas svg:nth-of-type(1) {
        top: -4rem;
    }

    .wishas svg:nth-of-type(2) {
        bottom: -5rem;
    }

    .audio button {
        bottom: 5rem;
        right: 0.8rem;
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.4rem;
    }

    footer {
        margin-top: 4rem;
        padding: 1rem 1.4rem 3.4rem;
    }

    footer h2 {
        font-size: 1.4rem;
    }

    footer > div a {
        font-size: 0.6rem;
        min-height: 2rem;
        min-width: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        border-radius: 4px;
        transition: all 0.3s ease;
    }

    footer > div a:active {
        background-color: #000;
        color: #fff;
        transform: scale(0.95);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .gallery .container button:nth-of-type(1),
    .gallery .container button:nth-of-type(2) {
        background-color: rgba(0, 0, 0, 0.5);
    }

    .gallery .container button:nth-of-type(1):hover,
    .gallery .container button:nth-of-type(2):hover {
        background-color: rgba(0, 0, 0, 0.7);
    }

    header nav a:hover {
        background-color: #000;
        color: #fff;
    }

    .wishas div:nth-of-type(1) > div figure button:hover {
        background-color: #000;
        color: #fff;
    }
}
