/* ===========================================================
   Pusoman Shared Theme System
   =========================================================== */

:root {
    /* Default tokens (Mayon) */
    --bg-page: #f7f3ef;
    --bg-surface: #ffffff;
    --bg-gradient: #e8ded5;
    --text-primary: #3e2723;
    --text-secondary: #5d4037;
    --text-on-accent: #ffffff;
    --accent: #8b4513;
    --accent-2: #228b22;
    --border: #d7ccc8;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.1);
    --transition-base: 0.2s;
    --transition-slow: 0.35s;
}

/* ----------------------- Philippine Themes ----------------------- */

body.theme-mayon {
    --bg-page: #f7f3ef;
    --bg-surface: #ffffff;
    --bg-gradient: #e8ded5;
    --text-primary: #3e2723;
    --text-secondary: #5d4037;
    --text-on-accent: #ffffff;
    --accent: #8b4513;
    --accent-2: #228b22;
    --border: #d7ccc8;
}

body.theme-boracay {
    --bg-page: #e6f7ff;
    --bg-surface: #ffffff;
    --bg-gradient: #ccf0f7;
    --text-primary: #003c4a;
    --text-secondary: #006064;
    --text-on-accent: #ffffff;
    --accent: #1e90ff;
    --accent-2: #00ced1;
    --border: #b2ebf2;
}

body.theme-sampaguita {
    --bg-page: #fffaf5;
    --bg-surface: #ffffff;
    --bg-gradient: #f3e5f5;
    --text-primary: #4a4a4a;
    --text-secondary: #6a6a6a;
    --text-on-accent: #4a4a4a;
    --accent: #ffb6c1;
    --accent-2: #90ee90;
    --border: #f8bbd0;
}

body.theme-chocolate-hills {
    --bg-page: #f5e6d3;
    --bg-surface: #fff8f0;
    --bg-gradient: #e6d0b3;
    --text-primary: #4e342e;
    --text-secondary: #6d4c41;
    --text-on-accent: #ffffff;
    --accent: #8b4513;
    --accent-2: #d2691e;
    --border: #d7ccc8;
}

body.theme-puerto-galera {
    --bg-page: #fff0e6;
    --bg-surface: #ffffff;
    --bg-gradient: #ffe0d6;
    --text-primary: #4a2c2a;
    --text-secondary: #795548;
    --text-on-accent: #ffffff;
    --accent: #00bfff;
    --accent-2: #ff7f50;
    --border: #ffccbc;
}

/* ----------------------- Base Page ----------------------- */

html {
    color-scheme: light;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-page) 0%, var(--bg-gradient) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition-slow) ease, color var(--transition-base) ease;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    margin-top: 0;
}

p, span, div, label {
    color: var(--text-primary);
}

a {
    color: var(--accent);
    transition: color var(--transition-base) ease;
}

a:hover {
    color: var(--accent-2);
}

/* ----------------------- Animation Levels ----------------------- */

:root {
    --transition-base: 0.2s;
    --transition-slow: 0.35s;
}

body.anim-subtle {
    --transition-base: 0.12s;
    --transition-slow: 0.2s;
}

body.anim-subtle *,
body.anim-subtle *::before,
body.anim-subtle *::after {
    animation-duration: 0.2s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
}

body.anim-moderate {
    --transition-base: 0.25s;
    --transition-slow: 0.4s;
}

body.anim-moderate *,
body.anim-moderate *::before,
body.anim-moderate *::after {
    animation-duration: 0.3s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.25s !important;
}

body.anim-heavy {
    --transition-base: 0.4s;
    --transition-slow: 0.7s;
}

body.anim-heavy *,
body.anim-heavy *::before,
body.anim-heavy *::after {
    animation-duration: 0.5s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.4s !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----------------------- Card Base ----------------------- */

.card,
.parameter-group,
.output-box {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform var(--transition-base) ease,
                box-shadow var(--transition-base) ease,
                background var(--transition-base) ease;
}

/* ----------------------- Card Styles ----------------------- */

/* Minimal */
body.card-style-minimal .card,
body.card-style-minimal .parameter-group,
body.card-style-minimal .output-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: none;
}

/* Glassmorphism */
body.card-style-glassmorphism .card,
body.card-style-glassmorphism .parameter-group,
body.card-style-glassmorphism .output-box {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Neumorphism */
body.card-style-neumorphism .card,
body.card-style-neumorphism .parameter-group,
body.card-style-neumorphism .output-box {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.08),
                -8px -8px 16px rgba(255, 255, 255, 0.9);
    border: none;
}

body.card-style-neumorphism .card:active,
body.card-style-neumorphism .parameter-group:active,
body.card-style-neumorphism .output-box:active,
body.card-style-neumorphism button:active {
    box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.08),
                inset -4px -4px 8px rgba(255, 255, 255, 0.9);
}

/* ----------------------- Buttons & Inputs ----------------------- */

button,
.btn,
input,
select,
textarea {
    font-family: inherit;
    border-radius: 8px;
    transition: all var(--transition-base) ease;
}

button,
.btn {
    min-height: 48px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
    background: var(--accent-2);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    box-sizing: border-box;
    min-height: 48px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ----------------------- Utility ----------------------- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ----------------------- Site footer ----------------------- */

.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.site-footer .footer-legal {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.site-footer .footer-legal a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
}

.site-footer .footer-legal a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ----------------------- Site topbar / brand ----------------------- */

.site-topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    min-height: 56px;
    padding: 0 24px;
    margin: 0 auto;
    background: var(--bg-gradient);
    background: color-mix(in srgb, var(--bg-page), black 5%);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.brand {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease;
}

.brand:hover,
.brand:focus-visible {
    color: var(--accent);
}
