/* style.css - Cosmic Oracle Theme Base */

/* --- CSS Variables for Colors (easier to manage) --- */
:root {
    --color-bg-deep-purple: #1a0a2e;
    --color-bg-content-area-solid: #23103a;
    --color-bg-content-area-transparent: rgba(35, 16, 58, 0.0); /* Transparent for welcome page container */
    --color-text-primary: #e0d8f0;
    --color-text-secondary: #bca8e0;
    --color-heading: #d9c8ff;
    --color-accent-magenta: #BE79DF;
    --color-accent-gold: #FFD700;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Open Sans', sans-serif;
}

/* --- Basic Reset & Body --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text-primary);
    line-height: 1.7;
    background-color: var(--color-bg-deep-purple);
    background-image: radial-gradient(ellipse at bottom, #3a1a5e 0%, var(--color-bg-deep-purple) 60%, #000000 100%);
    padding: 0; /* Full bleed for video */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- VIDEO BACKGROUND STYLES --- */
.video-background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1; 
}

.video-background-container::after { /* The overlay */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 5, 20, 0.3); /* DARKER OVERLAY: Dark purple/black with 75% opacity */
    z-index: -1; /* On top of video, behind content */
}

.video-background {
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

/* --- Container Styling --- */
/* General .container for prepare.html, guidelines.html, result.html */
.container {
    width: 100%;
    max-width: 700px;
    margin: 20px auto; /* Fallback margin if not flex centered by body */
    background-color: var(--color-bg-content-area-solid);
    padding: 10px 30px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(190, 121, 223, 0.2);
    border: 1px solid rgba(190, 121, 223, 0.3);
    position: relative;
    z-index: 5;
}

/* Specific for .welcome-container on welcome.html */
.welcome-container {
    background-color: transparent !important; /* Transparent */
    border: 1px solid rgba(190, 121, 223, 0.25);
    box-shadow: 0 0 18px 4px rgba(190, 121, 223, 0.35),
                0 0 40px 10px rgba(160, 90, 200, 0.25);
    padding: 10px 30px; /* Adjusted padding */
    border-radius: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: auto; /* Let content define height */
    margin: 20px; /* Margin around the welcome box */

}


/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 0.75em;
    line-height: 1.3;
}

/* Styles for the multi-line welcome title */
.welcome-title { /* This is the H1 on welcome.html */
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(217, 200, 255, 0.3);
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-title span {
    display: block;
    text-align: center;
}

/* YOUR PREFERRED TITLE STYLES RESTORED AND APPLIED */
.welcome-title .title-line-1 { /* "The Oracle" */
    font-size: 0.9em;
    font-weight: 200;
    color: var(--color-heading); /* Was var(--color-text-secondary) */
    line-height: 1.0;
    margin-top: 1px;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px; /* Was 2px */
}

.welcome-title .title-line-2 { /* "- I CHING -" */
    font-size: 2.4em;  
    font-weight: 700; /* Bold for prominence */
    color: var(--color-heading);
    line-height: 1.0;
    margin-top: 3px;   /* Adjusted spacing */
    margin-bottom: 3px;/* Adjusted spacing */
    text-transform: uppercase;
    letter-spacing: 1.5px;
}


p {
    margin-bottom: 1em;
}

.chinese-text {
    font-size: 1.15em;
    color: var(--color-text-secondary);
}

.english-text {
    color: var(--color-text-primary);
}

/* --- Input Page Specifics (`prepare.html`) --- */
/* .guidance styles for prepare.html if you use it there */
.guidance {
    background-color: rgba(0,0,0, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid var(--color-accent-magenta);
    font-size: 0.95em;
}
.guidance h2 {
    font-size: 1.5em;
    color: var(--color-heading);
    margin-bottom: 10px;
    border-bottom: none;
}
/* ... other styles for .input-section etc. from previous style.css ... */
.input-section {
    margin-top: 20px;
    width: 100%; /* Uses the width of its parent .container */
    display: flex; /* Use flex to center the button if it's not full width */
    flex-direction: column;
    align-items: center; /* Center items like the button horizontally */
}

.input-section .input-row {
    display: flex;
    justify-content: space-between; /* Distributes space between input groups */
    align-items: flex-start; 
    gap: 15px; /* Reduced gap between input groups for a tighter look like screenshot */
    margin-bottom: 30px; 
    width: 100%; /* Row takes full width available */
}

.input-section .input-group {
    display: flex;
    flex-direction: column; /* Label on top of input */
    flex-grow: 1; 
    flex-basis: 0; 
    text-align: left; /* Align label text to the left */
}

.input-section .input-group label {
    margin-bottom: 6px; /* Reduced space between label and input */
    color: var(--color-text-secondary);
    font-weight: bold;
    font-size: 0.9em;
    display: block;
}

.input-section .input-group input[type="number"] {
    width: 100%; 
    padding: 10px 12px; /* Slightly smaller padding */
    border: 1px solid rgba(190, 121, 223, 0.4);
    border-radius: 6px;
    background-color: rgba(0,0,0, 0.3);
    color: var(--color-text-primary);
    font-size: 1em;
    font-family: var(--font-body);
}

/* --- Styling for the "Divine" button specifically --- */
/* This reuses the .action-button and .main-action (or just .action-button if you prefer)
   from the welcome page to get similar base styling and animations. */

/* General .action-button styles (if not already defined or if you want to ensure they apply) */
.action-button {
    display: inline-block; /* Important for width:auto and centering with margin */
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

/* Specific style for main action buttons like "Consult" and "Divine" */
/* Using #divineButton for more specificity if needed, but class .main-action is better */
button#divineButton.action-button.main-action,
.welcome-actions .action-button:not(.secondary) { /* Targets "Consult" on welcome & "Divine" */
    padding: 12px 25px; /* Example size - adjust to match "Consult" button */
    font-size: 1.1em;   /* Example size */
    min-width: 180px;   /* Example min-width, adjust to desired look */
    width: auto;        /* Let content + padding define width */
    margin-top: 10px; /* Space above the Divine button if it's directly after .input-row */

    background-color: var(--color-accent-magenta);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    
    animation: subtleButtonGlow 2.5s ease-in-out infinite,
               subtleWobble 3.5s ease-in-out infinite alternate;
}

button#divineButton.action-button.main-action:hover,
.welcome-actions .action-button:not(.secondary):hover {
    background-color: #a745c7; /* Darker magenta */
    animation-play-state: paused; /* Pause animation on hover */
}

button#divineButton.action-button.main-action:active,
.welcome-actions .action-button:not(.secondary):active {
    transform: translateY(1px);
}


/* Ensure Keyframe animations are defined globally ONCE in style.css */
/* If they are already defined, you DO NOT need to repeat them. */
@keyframes subtleButtonGlow {
    0%, 100% {
        box-shadow: 0 0 7px 1px rgba(190, 121, 223, 0.4),
                    0 0 10px 3px rgba(217, 200, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(190, 121, 223, 0.7),
                    0 0 20px 7px rgba(217, 200, 255, 0.5);
    }
}

@keyframes subtleWobble {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(-0.7deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(2px) rotate(0.7deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Responsive stacking for input fields on smaller screens */
@media (max-width: 768px) {
    .input-section .input-row {
        flex-direction: column;
        gap: 20px; 
    }

    .input-section .input-group {
        width: 100%; 
    }

    /* Make Divine button full width on small screens if desired */
    button#divineButton.action-button.main-action {
        width: 100%; 
        margin-left: 0;
        margin-right: 0;
    }
}


/* --- General Error Styling --- */
.error {
    color: #ff8f8f;
    font-weight: bold;
    margin-top: 15px;
    background-color: rgba(255, 0, 0, 0.1);
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

/* --- "Ask Another Question" Button on result page --- */
.back-button {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 20px;
    background-color: var(--color-accent-magenta);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-family: var(--font-heading);
    transition: background-color 0.3s ease;
}
.back-button:hover {
    background-color: #a745c7;
}

/* --- Welcome Page Specific Styles (`welcome.html`) --- */
.oracle-totem {
    width: 130px;
    height: 180px;
    margin-bottom: 15px; /* Less space above title */
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.oracle-totem img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    animation: spin-y-axis 13s linear infinite, subtle-glow 4s ease-in-out infinite alternate;
    transform-style: preserve-3d;
}

@keyframes spin-y-axis {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes subtle-glow {
    0% { filter: drop-shadow(0 0 5px rgba(220, 180, 255, 0.4)); }
    100% { filter: drop-shadow(0 0 15px rgba(220, 180, 255, 0.7)); }
}

.welcome-intro p {
    font-size: 1em;
    max-width: 650px;
    margin-bottom: 15px;
    color: var(--color-text-primary);
    line-height: 1.6;
}

.welcome-key-principle {
    font-size: 1.1em;
    color: var(--color-accent-gold);
    font-weight: bold;
    margin-bottom: 15px;
    font-family: var(--font-heading);
}

.welcome-note-asking p {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    margin-bottom: 1px; /* INCREASED MARGIN to push Guidelines button down a bit from this text */
    max-width: 640px;
    line-height: 1.5;
}

.welcome-actions {
    margin-top: 10px; /* REDUCED MARGIN to bring the whole button block higher */
    display: flex;
    flex-direction: column;
    gap: 45px; /* Gap between the two buttons */
    align-items: center;
}

.welcome-actions .action-button {
    display: inline-block;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    min-width: 150px;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.welcome-actions .action-button.secondary { /* Guidelines button */
    padding: 4px 10px;   /* Made SMALLER */
    font-size: 0.9em;    /* Made SMALLER */
    background-color: transparent;
    color: var(--color-accent-magenta);
    border: 2px solid var(--color-accent-magenta);
}
.welcome-actions .action-button.secondary:hover {
    background-color: rgba(190, 121, 223, 0.1);
    color: #d9c8ff;
}

/* Consult button - with glow and wobble */
.welcome-actions .action-button:not(.secondary) {
    padding: 13px 26px; /* Slightly adjusted */
    font-size: 1.1em;   /* Slightly adjusted */
    background-color: var(--color-accent-magenta);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    animation: subtleButtonGlow 2.5s ease-in-out infinite, /* Faster Glow */
               subtleWobble 3.5s ease-in-out infinite alternate; /* Faster Wobble, no delay needed here */
}
.welcome-actions .action-button:not(.secondary):hover {
    background-color: #a745c7;
    animation-play-state: paused;
}

@keyframes subtleButtonGlow {
    0%, 100% {
        box-shadow: 0 0 7px 1px rgba(190, 121, 223, 0.4), /* Adjusted Glow */
                    0 0 10px 3px rgba(217, 200, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(190, 121, 223, 0.7),
                    0 0 20px 7px rgba(217, 200, 255, 0.5);
    }
}

@keyframes subtleWobble {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-0.5deg); }
    50% { transform: translateY(0) rotate(0deg); } /* Added a middle still point */
    75% { transform: translateY(3px) rotate(0.5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}


/* Styles for result.html specific elements (if any beyond .container) */
#hexagramDisplaySection {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #444;
}



/* =================================== */
/*          RESPONSIVE STYLES          */
/* =================================== */

/* For tablets and larger phones (e.g., up to 768px) */
@media (max-width: 768px) {
    body {
        padding: 10px; /* Reduce body padding */
    }

    .container, .result-container, .welcome-container, .prepare-container {
        padding: 10px 8px; /* Reduce padding inside containers */
        margin: 10px;       /* Reduce margin around containers */
    }

    /* Welcome Page Title */
    .welcome-title .title-line-1 {
        font-size: 0.8em; /* Example: make title parts smaller */
    }


.welcome-title .title-line-2 { /* "- I CHING -" */
    font-size: 1.5em;  

}

    /* Preparation Page - Input Fields */
    .input-section .input-row {
        flex-direction: column; /* Stack input groups vertically */
        gap: 15px;
    }
    .input-section .input-group {
        width: 100%; /* Make each input group take full width */
    }
    .input-section .input-group label {
        font-size: 0.85em;
    }

    /* Buttons on Welcome/Prepare page */
    .welcome-actions .action-button,
    button#divineButton.action-button.main-action {
        font-size: 0.9em; /* Make buttons slightly smaller */
        padding: 12px 20px;
        
    }

    /* Result Page Hexagram Display */
    #hexagramDisplaySection {
        flex-direction: column; /* Stack symbol and text area */
        align-items: center; /* Center them when stacked */
        gap: 15px;
    }
    .hexagram-visual-area {
        flex-basis: auto; /* Allow it to size naturally */
        margin-bottom: 20px;
    }
    .hex-line { /* Maybe make hexagram lines slightly smaller */
        width: 120px;
        height: 15px;
        margin: 5px 0;
    }
    .hexagram-text-area h2, /* Hexagram name on result page */
    .result-container h1 { /* General H1 on result page if you have one */
        font-size: 1.8em; /* Reduce heading sizes */
    }
    .hexagram-text-area h3 {
        font-size: 1.3em;
    }
    .hexagram-text-area p, #movingLineSection p {
        font-size: 0.95em; /* Reduce paragraph font sizes */
    }

    /* Adjust totem size on welcome page */
    .oracle-totem {
        width: 70px;
        height: 100px; /* Or adjust to maintain aspect ratio */
        margin-bottom: 10px;
    }
}

/* For very small phones (e.g., up to 480px) */
@media (max-width: 480px) {
    .container > h1:first-child, .result-container > h1:first-child,
    .welcome-container > .welcome-title,
    .prepare-container h1 {
        font-size: 2em; /* Further reduce main titles */
        margin-bottom: 20px;
    }

    .welcome-title .title-line-1 {
        font-size: 0.8em;
    }
    .welcome-title .title-line-2 {
        font-size: 1.5em;
    }
    
    .intro-text {
        font-size: 0.8em;
    }

    .welcome-actions .action-button,
    button#divineButton.action-button.main-action {
        width: 50%; /* Make buttons full width */
        font-size: 0.9em;
        padding: 12px;
    }

    .hex-line {
        width: 100px;
        height: 12px;
    }
}