/* CSS Custom Properties for Maintainability */
:root {
    --primary-color: #0000ff; /* Blue */
    --secondary-color: #808080; /* Gray */
    --jesus-words-color: #a00000; /* Dark red for accessibility */
    --background-dark: #000000; /* Black */
    --background-light: #f1f1f1; /* Light gray for contrast */
    --border-color: #000000; /* Black for borders */
    --font-size-base: 1rem; /* 16px base */
    --font-size-sm: 0.875rem; /* 14px */
    --font-size-xs: 0.75rem; /* 12px */
    --font-family-primary: 'Georgia', serif;
    --font-family-secondary: 'Arial', sans-serif;
}

/* General Styles */
body {
    background-color: var(--background-light);
    font-family: var(--font-family-secondary);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* This moves it to the top */
    min-height: 100vh;
    line-height: 1.6;
}

.main {
    max-width: 400px;
    width: 100%;
    margin-top: 26px;
    text-align: center;
    border: 2px solid grey;
    box-sizing: border-box;
	padding:2px;
}

/* Typography */
.T0 {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    color: var(--primary-color);
}

.T1 {
    font-family: var(--font-family-primary);
    font-size: 1.125rem; /* 18px */
}

.T2,
#italicText {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    font-style: italic;
    color: var(--secondary-color);
}

.T3,
#bibleReference {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--secondary-color);
}

.T4 {
    font-family: 'Albertus Extra Bold', var(--font-family-primary);
    font-size: 1.25rem; /* 20px */
}

.T5,
#plusSign {
    font-family: var(--font-family-primary);
    font-size: 0.625rem; /* 10px */
    color: var(--primary-color);
}

.T6 {
    font-family: var(--font-family-primary);
    font-size: 0.875rem; /* 14px */
    color: var(--secondary-color);
    font-style: italic;
}

.title {
    font-size: 1.375rem; /* 22px */
    font-weight: bold;
}

.subtitle {
    font-size: 1.125rem; /* 18px */
}

.text {
    font-size: var(--font-size-sm);
}

.small {
    font-size: 0.8125rem; /* 13px */
    line-height: 1.4;
}

/* Links */
a {
    text-decoration: none;
    color: var(--border-color);
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Images */
img {
    width: 100%;
    max-width: 930px;
    height: auto;
    display: block;
}

.img1 {
    width: 142px;
    float: left;
}

.img2 {
    width: 206px;
    float: left;
}

/* Text Container */
.text-container {
    height: 430px;
    overflow-y: auto;
    padding: 20px 10px;
    width: 93%;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) var(--background-light);
}

/* Page-Specific Styles */
.whyPage {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.8125rem; /* 13px */
}

.keysPage {
    background: #f1c22c;
    font-weight: bold;
    font-size: 0.8125rem; /* 13px */
}

/* Table Styles */
#chapterSelectTable,
#tableOfContentsTable {
    margin: 20px auto;
    border: 3px solid var(--border-color);
    border-collapse: collapse;
    width: 95%;
    text-align: center;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    background-color: #ffffff;
    table-layout: fixed;
}

#chapterSelectTable tr,
#chapterSelectTable td,
#tableOfContentsTable tr,
#tableOfContentsTable td {
    border: 3px solid var(--border-color);
    padding: 8px;
}

#chapterSelectTable td,
#tableOfContentsTable td {
    transition: background-color 0.3s ease;
}

#chapterSelectTable td:hover,
#tableOfContentsTable td:hover {
    background-color: var(--secondary-color);
}

#chapterSelectTable td a,
#tableOfContentsTable td a {
    display: block;
    width: 100%;
    padding: 5px;
    color: var(--border-color);
}

#tableOfContentsTable td {
    font-family: var(--font-family-secondary);
    font-size: var(--font-size-sm);
}

/* Specific Elements */
#wordsOfJesus {
    color: var(--jesus-words-color);
}

/* Responsive Styles */
@media only screen and (min-width: 768px) {
    body {
        background-image: url('../images/avbackgroundextended.jpg');
        background-position: center center;
        background-size: cover;
        background-repeat: no-repeat;
    }

    .main {
        max-width: 400px;
    }
}

@media only screen and (max-width: 767px) {
    body {
        background-image: none;
        background-color: var(--background-light);
        display: block;
        min-height: auto;
    }

    .main {
        max-width: 100%;
        width: 100%;
        min-height: 100vh;
        margin: 0;
        padding: 10px;
        border: none;
        display: block;
		background: black;
    }

    .img1 {
        width: 40%;
    }

    .img2 {
        width: 60%;
    }

    #chapterSelectTable,
    #tableOfContentsTable {
        font-size: var(--font-size-sm);
    }
}

@media only screen and (max-width: 400px) {
    .main {
        padding: 5px;
    }

    .text-container {
        padding: 10px 5px;
    }
}