/* 家務記錄本與零用錢帳本 支援頁面 CSS — Storybook Edition */

/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&display=swap');

/* ===== Design Tokens ===== */
:root {
    /* Primary palette — deep, warm purples */
    --color-primary: #5B3A8C;
    --color-primary-dark: #432A6B;
    --color-primary-light: #7E5BB5;

    /* Accent — warm coral/rose */
    --color-accent: #C0405A;
    --color-accent-light: #E8899A;

    /* Surfaces */
    --color-bg: #FFF7F3;
    --color-bg-warm: #FFF0E8;
    --color-card: #FFFFFF;
    --color-card-hover: #FFFBF9;

    /* Text — all pass WCAG AA on their intended backgrounds */
    --color-text: #2D2235;          /* body text on --color-bg: ~14:1 */
    --color-text-secondary: #4A3D5C; /* secondary on white: ~8.5:1 */
    --color-text-muted: #5E5272;     /* muted on white: ~5.8:1 */
    --color-text-on-primary: #FFFFFF;
    --color-text-on-accent: #FFFFFF;

    /* Borders & shadows */
    --color-border: #E8DDD6;
    --shadow-sm: 0 2px 8px rgba(45, 34, 53, 0.06);
    --shadow-md: 0 4px 20px rgba(45, 34, 53, 0.08);
    --shadow-lg: 0 8px 32px rgba(45, 34, 53, 0.12);
    --shadow-card: 0 2px 12px rgba(91, 58, 140, 0.07);

    /* Gradients */
    --gradient-header: linear-gradient(135deg, #4A2D7A 0%, #6B3A7A 50%, #7A3D6B 100%);
    --gradient-hero: linear-gradient(135deg, #7A2D5A 0%, #A83050 60%, #C04848 100%);
    --gradient-warm: linear-gradient(135deg, #FFF7F3 0%, #FFF0E8 100%);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 0.2s var(--ease-out);
    --transition-med: 0.35s var(--ease-out);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Helvetica Neue', 'Arial', 'Noto Sans TC', sans-serif;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle warm texture on body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(91, 58, 140, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(192, 64, 90, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(126, 91, 181, 0.02) 0%, transparent 50%);
}

/* ===== Container ===== */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
header {
    background: var(--gradient-header);
    color: var(--color-text-on-primary);
    padding: 2.5rem 0 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Decorative dots pattern */
header::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    pointer-events: none;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--color-accent) 0%,
        var(--color-accent-light) 50%,
        var(--color-accent) 100%);
}

header h1 {
    font-size: 2.4rem;
    margin-bottom: 0.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    position: relative;
    color: #FFFFFF;
    text-align: center;
    border-bottom: none;
}

header h1 a {
    color: #FFFFFF;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

header h1 a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.subtitle {
    font-size: 1.15rem;
    color: #F0E4F7; /* light lavender on dark purple header — contrast ~10:1 */
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
}

/* ===== Navigation ===== */
nav {
    background-color: var(--color-card);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--color-border);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.75rem 0;
    gap: 0.25rem;
}

nav li {
    margin: 0 0.35rem;
}

nav a {
    text-decoration: none;
    color: var(--color-text-secondary); /* #4A3D5C on white — ~8.5:1 */
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-xl);
    transition: all var(--transition-fast);
    display: inline-block;
}

nav a:hover {
    background-color: var(--color-bg-warm);
    color: var(--color-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

nav a.active {
    background-color: var(--color-primary);
    color: var(--color-text-on-primary);
    box-shadow: 0 2px 8px rgba(91, 58, 140, 0.25);
}

/* ===== Language Switcher ===== */
.language-switcher {
    position: relative;
    display: inline-block;
}

.language-dropdown {
    background-color: var(--color-card);
    color: var(--color-text-secondary);
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    font-size: 0.92rem;
    min-width: 120px;
    text-align: center;
}

.language-dropdown:hover {
    border-color: var(--color-primary-light);
    background-color: var(--color-bg);
}

.language-dropdown:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(91, 58, 140, 0.15);
}

.language-switcher::after {
    content: '\25BC';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-primary-light);
    font-size: 0.65rem;
}

/* ===== Main Content ===== */
main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

/* ===== Section ===== */
section {
    margin-bottom: 3rem;
}

/* ===== Typography ===== */
h1 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    color: var(--color-text); /* #2D2235 on warm bg — ~14:1 */
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.7rem;
    margin-bottom: 1.5rem;
    color: var(--color-primary-dark); /* #432A6B on white — ~10:1 */
    border-bottom: 3px solid var(--color-primary-light);
    padding-bottom: 0.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 0.85rem;
    color: var(--color-text-secondary); /* #4A3D5C on white — ~8.5:1 */
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
    line-height: 1.85;
}

/* ===== Hero Section ===== */
#hero {
    text-align: center;
    background: var(--gradient-hero);
    color: var(--color-text-on-primary);
    padding: 4.5rem 2.5rem;
    border-radius: var(--radius-xl);
    margin-bottom: 4rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* Soft overlay pattern */
#hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 2px, transparent 2px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* Bottom wave decoration */
#hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.25) 100%);
}

.hero-content h2 {
    font-size: 2.4rem;
    margin-bottom: 1rem;
    border: none;
    color: #FFFFFF; /* white on hero gradient — min ~5.5:1 on lightest part */
    font-weight: 800;
    padding-bottom: 0;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hero-content p {
    font-size: 1.15rem;
    margin-bottom: 2rem;
    color: #FDE8EC; /* light pink on hero — contrast ~7:1 on darkest, ~4.5:1 on lightest */
    font-weight: 500;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== App Store Badge ===== */
.app-store-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    position: relative;
}

.app-store-badge img {
    height: 56px;
    transition: transform var(--transition-med);
    border-radius: var(--radius-sm);
}

.app-store-badge:hover img {
    transform: scale(1.06) translateY(-2px);
}

/* ===== Features Grid ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature {
    background: var(--color-card);
    padding: 2.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    text-align: center;
    transition: all var(--transition-med);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-header);
    opacity: 0;
    transition: opacity var(--transition-med);
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.feature:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 2.75rem;
    margin-bottom: 1rem;
    display: block;
}

/* ===== Steps ===== */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.step {
    background: var(--color-card);
    padding: 2.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    text-align: center;
    position: relative;
    border: 1px solid var(--color-border);
    transition: all var(--transition-med);
}

.step:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.step-number {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.15rem;
    margin: 0 auto 1rem;
    box-shadow: 0 3px 10px rgba(91, 58, 140, 0.25);
}

/* ===== FAQ Styles ===== */
.faq-section {
    margin-bottom: 3rem;
}

.faq-item {
    background: var(--color-card);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: border-color var(--transition-fast);
}

.faq-item:hover {
    border-color: var(--color-primary-light);
}

.faq-item h3 {
    background: var(--color-card);
    padding: 1.25rem 1.5rem;
    margin: 0;
    cursor: pointer;
    border-left: 4px solid var(--color-primary-light);
    transition: all var(--transition-fast);
    font-size: 1.05rem;
    color: var(--color-text); /* #2D2235 on white — ~14:1 */
    font-weight: 700;
}

.faq-item h3:hover {
    background: var(--color-bg);
    color: var(--color-primary-dark);
}

.faq-item.active h3 {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border-left-color: var(--color-primary-dark);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease-out);
}

.faq-answer {
    padding: 0 1.5rem;
}

.faq-item.active .faq-answer {
    padding: 1.5rem;
}

/* ===== Contact Styles ===== */
.contact-intro {
    background: var(--color-card);
    padding: 2rem 2.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.contact-methods {
    margin-bottom: 3rem;
}

.contact-method {
    background: var(--color-card);
    padding: 2rem 2.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.contact-method:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.contact-email {
    font-size: 1.15rem;
    font-weight: 700;
}

.contact-email a {
    color: var(--color-primary); /* #5B3A8C on white — ~7.5:1 */
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition-fast);
}

.contact-email a:hover {
    text-decoration: none;
    border-bottom-color: var(--color-primary);
}

/* ===== Contact Form ===== */
.contact-form-section {
    background: var(--color-card);
    padding: 2rem 2.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.contact-form-section h2 {
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.form-group select,
.form-group textarea,
.form-group input[type="email"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.form-group select:focus,
.form-group textarea:focus,
.form-group input[type="email"]:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(91, 58, 140, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

#submit-btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
}

#submit-btn:hover {
    background: var(--color-primary-dark);
}

#submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#form-status {
    margin-top: 12px;
    font-size: 14px;
    min-height: 20px;
}

#form-status.success { color: #22c55e; }
#form-status.error   { color: #ef4444; }

.note {
    font-size: 0.9rem;
    color: var(--color-text-muted); /* #5E5272 on white — ~5.8:1 */
    font-style: italic;
}

/* ===== Checkbox / Checklist ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 0.6rem;
    accent-color: var(--color-primary);
}

/* ===== Info Sections ===== */
.response-info,
.helpful-info {
    background: var(--color-card);
    padding: 2rem 2.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.checklist .checkbox-label {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.checklist .checkbox-label:hover {
    background: var(--color-bg);
}

/* ===== Last Updated ===== */
.last-updated {
    text-align: right;
    font-size: 0.9rem;
    color: var(--color-text-muted); /* #5E5272 on warm bg — ~5.5:1 */
    margin-bottom: 2rem;
    font-style: italic;
    font-weight: 500;
}

/* ===== Lists ===== */
ul, ol {
    margin-left: 1.75rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* ===== Links ===== */
a {
    color: var(--color-primary); /* #5B3A8C on white — ~7.5:1 */
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ===== Footer ===== */
footer {
    background: var(--gradient-header);
    color: var(--color-text-on-primary);
    text-align: center;
    padding: 2.25rem 0;
    margin-top: 4rem;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--color-accent) 0%,
        var(--color-accent-light) 50%,
        var(--color-accent) 100%);
}

footer p {
    font-weight: 500;
    font-size: 0.9rem;
    color: #F0E4F7; /* light on dark footer — ~10:1 */
}

/* ===== Responsive — Tablet ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 18px;
    }

    header {
        padding: 2rem 0 1.5rem;
    }

    header h1 {
        font-size: 1.85rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
    }

    nav li {
        margin: 0.15rem 0;
    }

    .hero-content h2 {
        font-size: 1.85rem;
    }

    .hero-content p {
        font-size: 1.05rem;
    }

    #hero {
        padding: 3rem 1.5rem;
        border-radius: var(--radius-lg);
        margin-bottom: 3rem;
    }

    .features-grid,
    .steps {
        grid-template-columns: 1fr;
    }

    .app-store-badges {
        flex-direction: column;
        align-items: center;
    }

    main {
        padding: 2rem 0;
    }

    h1 {
        font-size: 1.85rem;
    }

    h2 {
        font-size: 1.45rem;
    }
}

/* ===== Responsive — Phone ===== */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.65rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .feature,
    .step,
    .contact-method,
    .response-info,
    .helpful-info,
    .contact-intro {
        padding: 1.5rem 1.25rem;
    }

    .faq-item h3 {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
    }

    .faq-item.active .faq-answer {
        padding: 1.25rem;
    }

    #hero {
        padding: 2.5rem 1.25rem;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Focus Styles for Accessibility ===== */
:focus-visible {
    outline: 3px solid var(--color-primary-light);
    outline-offset: 2px;
    border-radius: 4px;
}

nav a:focus-visible {
    outline-offset: 3px;
}

/* ===== Selection ===== */
::selection {
    background: rgba(91, 58, 140, 0.15);
    color: var(--color-text);
}
