/* Regular Style */
@font-face {
  font-family: 'Ivypresto';
  src: url('fonts/IvyprestoText-Regular.woff2') format('woff2'),
       url('fonts/IvyprestoText-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* Regulkar Italic Style */
@font-face {
  font-family: 'Ivypresto';
  src: url('fonts/IvyprestoText-RegularItalic.woff2') format('woff2'),
       url('fonts/IvyprestoText-RegularItalic.woff') format('woff');
  font-weight: normal;
  font-style: italic;
}

/* Bold Style */
@font-face {
  font-family: 'Ivypresto';
  src: url('fonts/IvyprestoText-Bold.woff2') format('woff2'),
       url('fonts/IvyprestoText-Bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
}

/* Bold Italic Style */
@font-face {
  font-family: 'Ivypresto';
  src: url('fonts/IvyprestoText-BoldItalic.woff2') format('woff2'),
       url('fonts/IvyprestoText-BoldItalic.woff') format('woff');
  font-weight: bold;
  font-style: italic;
}

:root {
    --background-dark: #121212;
    --background-light: #f0f0f0;
    --text-dark: #111;
    --text-light: #f5f5f5;
    --text-grey: #333;
    --sand-color: #F2EADC;
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: "Ivypresto", sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    overflow: hidden; /* Prevent scrolling */
    -webkit-font-smoothing: antialiased;
}

.screen, .page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    background-image: url('images/bg.png');
    background-size: cover;
    background-position: center;
}

.screen.active, .page.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
   /* transition: opacity 0.5s ease-in-out;
}

/* --- New Intro Screen Styles --- */
#intro-screen {
    justify-content: center;
}
.intro-header {
    position: absolute;
    top: 35%;
    transform: translateY(-50%);
    width: 100%;
    text-align: center;
}
.intro-header img {
    width: 80%;
    max-width: 300px;
}
.intro-footer {
    position: absolute;
    bottom: 30px;
    width: 100%;
    text-align: center;
}
.intro-footer img {
    height: 50px;
}


/* --- Splash & Landing Page Shared Styles --- */
.splash-header {
    position: absolute;
    top: 60px;
    width: 100%;
    text-align: center;
    z-index: 20;
}

.header-image {
    height: 35px;
}

#splash-footer {
    position: absolute;
    bottom: 30px;
    padding-bottom: var(--safe-area-inset-bottom);
    width: 100%;
    text-align: center;
}

#splash-footer img {
    height: 60px;
    width: auto;
}

/* --- Splash Screen --- */
#splash-screen{
    justify-content: center;
}
.splash-step {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.splash-content {
    background-color: var(--sand-color);
    padding: 12px;
    border-radius: 4px;
    box-shadow: 0 3px 3px 0 rgba(0,0,0,0.25);
    width: 90%;
    max-width: 350px;
    text-align: center;
    opacity: 0;
}

.splash-content img, .splash-content p {
    opacity: 0;
}

.splash-content img {
    width: 100%;
    border-radius: 4px;
    display: block;
}

.splash-content p {
    color: var(--text-grey);
    margin: 12px 0 0 0;
    font-size: 1.125em;
}


/* --- Landing Page (Final Layout) --- */
#landing-page {
    justify-content: center;
    padding: 110px 20px 100px 20px;
}

#landing-page .splash-header,
#landing-page #splash-footer {
    position: absolute;
}

#main-content-block {
    background-color: var(--sand-color);
    border-radius: 4px;
    width: 90%;
    max-width: 350px;
    padding: 20px;
    box-sizing: border-box;
    /* display: flex; */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
    /* min-height: 0; */
    /* height: 100%; */
    overflow: auto;
    text-align: center;
    /* margin: 0 auto; */
}

#gif-container {
    background-color: transparent;
    width: 100%;
    max-width: 190px;
    /* aspect-ratio: 1 / 1; */
    border-radius: 4px;
    border: none;
    /* display: flex; */
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    margin: 0 auto;
}

#gif-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.instruction-text {
    text-align: center; 
    padding: 0;
    color: var(--text-dark);
    font-size: 1.125em;
    margin-bottom: 20px;
}

#start-button {
    width: 150px;
    padding: 15px 40px;
    border: 4px solid #FAFAFA;
    border-radius: 4px; 
    background-color: #3A705B;
    color: var(--sand-color);
    font-size: 1.1em; 
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    text-align: center;
}

/* --- Camera View --- */
#camera-view { 
    background-color: #000; 
    justify-content: center;
}
/* style.css */

.camera-ui-button {
    position: absolute;
    top: 25px;
    right: 20px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 30;

    background-color: transparent;
    border: none;
    color: white;
    border-radius: 50%;
    font-size: 1.1em;
    font-weight: bold;

    background-image: url('images/info.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
/* style.css */
/* Gradient overlay on camera view */
#camera-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0));
    z-index: 2;
    pointer-events: none;
}
.camera-ui-button.back-arrow {
    right: auto;
    left: 20px;
    
    background-image: url('images/arrow_back.png'); 
    
    background-repeat: no-repeat;
    
    background-position: center; 
    
    background-size: contain;

    background-color: transparent;
    border: none;
}
}
#camera-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
}
#framing-guide {
    position: absolute;
    width: 90%; 
    height: 60%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    z-index: 2;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}
#record-button-container {
    position: absolute;
    bottom: 50px;
    padding-bottom: var(--safe-area-inset-bottom);
    z-index: 3;
}

/* 1. Default State: A perfect red circle */
#record-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: red;
    border: 4px solid white;
    cursor: pointer;
    padding: 0; /* Prevents internal distortion */
    transition: transform 0.4s ease, border-radius 0.4s ease;
    position: relative; /* Needed for SVG positioning */
}

/* Hide the SVG timer by default */
#record-button .pie-timer-svg {
    display: none;
}

/* 2. Countdown State: A perfect red square */
#record-button.counting {
    border-radius: 12px;
    transform: scale(0.8);
}

#record-button.counting .pie-timer-svg {
    display: none;
}

/* 3. Recording State: The Pie Timer */
#record-button.recording {
    background-color: transparent;
    border-radius: 50%;
    transform: scale(1);
}

/* Show the SVG and fix its rotation */
#record-button.recording .pie-timer-svg {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* This starts the animation at the top and flips it to run CLOCKWISE */
    transform: rotate(-90deg) scaleY(-1);
}

#record-button.recording .pie-timer-svg circle {
    fill: transparent;
    stroke-width: 64;
}

#record-button.recording .pie-timer-svg .pie-bg {
    stroke: #8B0000; /* Dark red background */
}

/* This logic correctly REVEALS the dark red */
#record-button.recording .pie-timer-svg .pie-fg {
    stroke: red;
    stroke-dasharray: 201;
    stroke-dashoffset: 0; /* Start empty */
    animation: pie-timer-animation 3s linear forwards;
}

/* The animation now correctly fills the circle */
@keyframes pie-timer-animation {
    to {
        stroke-dashoffset: 201; /* Animate to full */
    }
}
#record-button.counting {
    border-radius: 12px; 
    animation: none; 
    transform: scale(0.8);
}
#countdown {
    position: absolute;
    font-size: 15em; 
    top: 20vh;
    font-weight: bold;
    color: #fff; 
    text-shadow: 0 0 20px rgba(0,0,0,0.7);
    z-index: 4;
    opacity: 0;
    transform: scale(1.5);
    transition: opacity 0.3s, transform 0.3s;
    height: 150px;
    z-index: 2;
}
#countdown.visible { 
    opacity: 1; 
    transform: scale(1); 
}

/* --- Video Preview Screen --- */
#preview-screen {
    background-color: #000;
    display: flex; 
    flex-direction: column; 
    justify-content: center;
    align-items: center; 
    gap: 20px;
}
#preview-video {
    width: 90%;
    max-width: 400px;
    border-radius: 4px;
    border: 2px solid #FFFFFF;
}
#preview-controls {
    display: flex;
    justify-content: space-between;
    width: 90%;
    max-width: 400px;
}
.preview-btn {
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    flex-basis: 48%;
    text-align: center;
}
.preview-btn#retake-button {
    border-radius: 4px;
    border: 4px solid #FAFAFA;
    background-color: #0C3958;
    color: #fff;
}
#share-video-button {
    border-radius: 4px;
    border: 4px solid #FAFAFA;
    background-color: #3A705B;
    color: var(--sand-color);
}

#video-wrapper {
    position: relative;
    width: 90%;
    max-width: 400px;
}

/* --- Info Page (Modal) Styles --- */
#info-page {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
#info-modal-content {
    background-color: var(--sand-color);
    width: 100%;
    max-width: 400px;
    height: 85%;
    max-height: 700px;
    border-radius: 14px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}
#info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}
.info-header-logo {
    height: 24px;
}
.close-modal-button {
    background: none;
    border: none;
    font-size: 2.2em;
    line-height: 1;
    color: var(--text-grey);
    cursor: pointer;
    padding: 0;
}
#info-modal-body {
    padding: 0px 20px 20px 20px;
    overflow-y: auto;
    color: var(--text-dark);
}
.info-title-container {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}
.info-title-logo {
    height: 55px;
}
#info-modal-body details {
    border-bottom: 1px solid #ddd;
    padding: 15px 0;
}
#info-modal-body details:last-of-type {
    border-bottom: none;
}
#info-modal-body summary {
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    list-style: none; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#info-modal-body summary::-webkit-details-marker { display: none; }
#info-modal-body summary::after {
    content: '⌄';
    font-size: 1.4em;
    transition: transform 0.2s;
}
#info-modal-body details[open] summary::after {
    transform: rotate(180deg);
}
#info-modal-body .details-content {
    font-size: 1em;
    line-height: 1.6;
    color: var(--text-grey);
    padding-top: 15px;
}
#info-modal-body .details-content p {
    margin: 0 0 1em 0;
}
#info-modal-body .details-content ol {
    padding-left: 20px;
}
#info-modal-body .embedded-video-container {
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    overflow: hidden;
}
.hard-cut {
    transition: none !important;
}

/* iPhone 15 Pro (portrait) */
@media only screen 
  and (device-width: 393px) 
  and (orientation: portrait) {
  #splash-footer {
    bottom: 20px !important;
  }
  p {
    margin: .5em 0;
    font-size: 0.9em;
  }
  .instruction-text {
    margin: 0;;
  }
  #preview-screen {
        padding-top: 20px;
    }
}
