/* Global style */

*,
*::after,
*::before {
    box-sizing: border-box;
}

main {
    width: 50%;
    max-width: 48rem;
    /*max-width: 36rem;*/
    margin: auto;
    margin-top: 40px;
    padding: 0 1rem; /* Added padding for better mobile spacing */
}

body {
    margin: 0;
    align-items: center;

    font-size: 18px;
    font-family: "Charis SIL", serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Prevent copy
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
    */
}

footer {
    margin-top: 16px;
    padding-top: 8px;
    padding-bottom: 24px;
    align-items: center;
    position: relative;
    text-align: center;

    /* width: 50%; */
    max-width: 48rem;
    /*max-width: 36rem;*/
    margin: auto;
    margin-top: 40px;
    padding: 0 1rem; /* Added padding for consistency */
}

p,
a,
code,
pre {
    overflow-wrap: break-word;
    -webkit-overflow-wrap: break-word;
    -ms-overflow-wrap: break-word;
    -o-overflow-wrap: break-word;
}

a {
    font-weight: 500;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    text-align: center;
    font-size: 30px;
}

table,
th,
td {
    border: 1px solid;
    border-collapse: collapse;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

pre,
code {
    /*font-family: 'Vollkorn', serif;*/
    font-size: 14px;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}

figcaption {
    font-size: 16px;
}

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

header {
    width: 100%;
    height: 3.5rem;
    top: 0px;
    left: 0px;
    z-index: 10;
}

.header-taskbar {
    max-width: 60rem;
    /*max-width: 836px;*/
    padding: 0 1rem;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    height: 3.5rem;
}

/* -----------Logo on header taskbar----------- */
.logo-container {
    font-size: 38px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-family: "Caveat", cursive;
    height: 36px;
}

.logo-container:hover {
    text-decoration: none;
}

/* -----------Icon on header taskbar----------- */
.toggle-container {
    font-size: 20px;
    display: flex;
    align-items: center;
}

.header-taskbar-icon-button {
    background-color: transparent;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    overflow: hidden;
    outline: none;
    padding: 6px;
    height: 36px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
}

/* ---------------Responsive--------------- */

/* iPad Pro (12.9-inch) - Landscape */
@media screen and (max-width: 1366px) and (min-width: 1025px) {
    main,
    footer {
        width: 65%;
        max-width: 50rem;
    }

    body {
        font-size: 24px; /* Slightly larger for better readability */
    }

    h1 {
        font-size: 36px;
    }
}

/* iPad Air/Pro (10.9-11 inch) and iPad Pro 12.9" Portrait */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    main,
    footer {
        width: 75%;
        max-width: 45rem;
    }

    body {
        font-size: 20px; /* Larger font for tablet reading */
    }

    h1 {
        font-size: 32px;
    }

    pre,
    code {
        font-size: 18px; /* Slightly larger code font */
    }

    .logo-container {
        font-size: 36px; /* Slightly smaller logo */
    }
}

/* iPad Mini and smaller tablets - Portrait */
@media screen and (max-width: 768px) and (min-width: 521px) {
    main,
    footer {
        width: 85%;
    }

    body {
        font-size: 20px;
    }

    h1 {
        font-size: 32px;
    }

    main {
        margin-top: 30px; /* Reduce top margin */
    }

    .logo-container {
        font-size: 34px;
    }

    /* Make tables more readable on smaller tablets */
    table,
    th,
    td {
        padding: 8px 6px;
        font-size: 16px;
    }
}

/* Mobile phones */
@media screen and (max-width: 520px) {
    main,
    footer {
        width: 95%;
        padding: 0 0.5rem;
    }

    body {
        font-size: 18px;
    }

    h1 {
        font-size: 28px;
    }

    main {
        margin-top: 20px;
    }

    .logo-container {
        font-size: 30px;
    }

    pre,
    code {
        font-size: 18px;
        padding: 12px;
    }

    /* Stack table content vertically on very small screens */
    table,
    th,
    td {
        padding: 6px 4px;
        font-size: 14px;
    }
}

/* Touch-friendly improvements for all tablet sizes */
@media screen and (max-width: 1024px) {
    .header-taskbar-icon-button {
        padding: 8px; /* Larger touch targets */
        min-width: 44px;
        min-height: 44px;
    }

    a {
        padding: 2px 0; /* More space around links */
    }

    /* Improve line height for better readability */
    p {
        line-height: 1.6;
    }
}
