/* Basic Reset and Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* CSS Variables for easier tuning */
    --page-button-bottom-margin: 15px; 
    --page-button-side-margin: 15px; 
    --page-button-min-width: 50px;   
    --page-button-top-margin: 15px; 


    /* Variables specific to Page 2 & 3 content (not corner buttons) */
    --page2-button-icon-block-top-offset: 40%; /* Also used for page3 main content */
    --page2-button-gap: 8px; /* Also used for page3 main content */
    --page2-button-width: 165px; /* Also used for page3 main content */
    --page2-button-height: 45px; /* Also used for page3 main content */
    --page2-icon-size: 18px; /* Also used for page3 main content */
    --page2-link-font-size: 0.7em; /* Also used for page3 text links */
    --page2-link-line-height: 1.4; /* Also used for page3 text links */
}

/* --- RULES FOR HTML, BODY, AND APP-CANVAS --- */
html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-canvas {
    height: 95dvh; 
    aspect-ratio: 9 / 16;
    max-width: 100vw;
    max-height: 95dvh;
    background-color: #f8f8f8; /* Fallback for pages without image */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Pages Container */
.pages-container {
    flex-grow: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Individual Pages */
.page {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    flex-direction: column;
    position: relative; 
}

.page.active {
    display: flex;
}

/* Inner content area within the page */
.page-content {
    flex-grow: 1;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: transparent;
    padding-top: 20px;
}

/* Main content block (used by Page 2 & Page 3) */
.main-content {
    position: absolute;
    top: var(--page2-button-icon-block-top-offset);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--page2-button-gap);
    width: auto;
    padding-bottom: 0;
}


/* --- Image Page Specific Styling (Page 1, 2 & 3) --- */
.image-page.active {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent; 
    color: #fff; 
}

#page1.active {
    background-image: url('images/page1_background.png');
}

#page2.active,
#page3.active { /* Page 3 now uses the same background as Page 2 */
    background-image: url('images/page2_background.png');
}

.image-page .page-content h1,
.image-page .page-content h2,
.image-page .page-content p,
.image-page .page-content ul,
.image-page .page-content li {
     color: inherit; 
     text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}


/* --- Common Page Action Button Styling (for bottom corner buttons on Page 1 & 2) --- */
.page-button, .page2-action-button {
    position: absolute;
    bottom: var(--page-button-bottom-margin);
    background-color: limegreen; 
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1em; 
    border-radius: 5px;
    opacity: 0.8;
    z-index: 10; 
    transition: opacity 0.3s ease, background-color 0.3s ease;
    min-width: var(--page-button-min-width);
    text-align: center;
    height: auto; 
    line-height: 1.2; 
}

.page-button:hover, .page2-action-button:hover { opacity: 1; }

/* Specific positioning for Page 1 buttons */
#page1-link-button { 
    left: var(--page-button-side-margin); 
}
#page1-next-button { 
    right: var(--page-button-side-margin); 
    font-size: 1.2em; 
    font-weight: bold; 
}

/* Specific positioning for Page 2 "Back Arrow" button */
#page2-back-button { 
    left: var(--page-button-side-margin);
    font-size: 1.2em; 
    font-weight: bold; 
}

/* Style for the Page 2 "Close" button */
#page2-close-button.close-button {
    right: var(--page-button-side-margin);
    background-color: red;
    color: white;
    border: 1px solid darkred; 
    font-size: 1.1em; 
    font-weight: bold;
    line-height: 1; 
}

#page2-close-button.close-button:hover {
    background-color: darkred;
}

/* Hidden Navigation Button Styling (on Page 2) */
.hidden-nav-button {
    position: absolute;
    top: var(--page-button-top-margin); 
    right: var(--page-button-side-margin); 
    display: none; 
    z-index: 10; 
}


/* --- Main Content Buttons (Contact, Instagram, etc. - used on Page 2 & 3) --- */
.page2-contact-button { /* Class name is generic enough for Page 3 too */
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--page2-button-width);
    height: var(--page2-button-height);
    margin: 0 auto;
    padding: 0;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8em;
    color: white;
    background: linear-gradient(to right, #153d7b 0%, #46639f 50%, #ffb347 100%);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.page2-contact-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.3);
}

.page2-icon.standalone-icon { /* Class name is generic enough for Page 3 too */
    display: block;
    width: var(--page2-icon-size);
    height: var(--page2-icon-size);
    object-fit: contain;
    margin: 0 auto;
}

/* --- Text Links (LEADCATCHERS.CA, Mxckapps.com - used on Page 2 & 3) --- */
.page2-text-link { /* Class name is generic enough for Page 3 too */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    text-decoration: none;
    font-size: var(--page2-link-font-size);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transition: color 0.2s ease;
    z-index: 5; 
    line-height: var(--page2-link-line-height);
    background-color: transparent;
    width: auto;
    white-space: nowrap;
}

/* Position the two text links relative to the bottom edge - Now applies to any page having these links */
.page .page2-text-link:nth-of-type(2) { 
    bottom: var(--page-button-bottom-margin);
}
.page .page2-text-link:nth-of-type(1) { 
     bottom: calc(var(--page-button-bottom-margin) + var(--page2-link-font-size) * var(--page2-link-line-height) + 2px); 
}

.page2-text-link:hover {
    color: #ccc;
}

/* Optional: Basic content element styling (e.g., if Page 3 was non-image based) */
/* These h1,p,ul,li styles will be overridden by .image-page if page3 is an image page */
h1, h2 {
    margin-bottom: 10px;
}

p {
    margin-bottom: 15px;
    line-height: 1.6;
}

ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

li {
    margin-bottom: 5px;
}