/* ================================================
   Kerygma Daily - Style System
   Google Flex Font + Responsive Design
   ================================================ */

:root {
    /* Colors - Kerygma Gray Mode */
    --primary: #334155;
    /* Deep Slate Gray */
    --primary-light: #475569;
    /* Lighter Slate */
    --accent: #d4af37;
    /* Classic Gold */
    --accent-light: #e5c158;
    /* Light Gold */
    --accent-glow: rgba(212, 175, 55, 0.4);
    --bg: #f8fafc;
    /* Off-white */
    --bg-dark: #334155;
    /* Deep Slate */
    --panel-bg: #ffffff;
    --text: #1e293b;
    /* Dark Slate */
    --text-muted: #64748b;
    /* Slate Gray */
    --border: rgba(51, 65, 85, 0.15);
    --success: #2a9d8f;
    /* Muted Teal */

    /* Typography */
    --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Noto Serif KR', Georgia, serif;
    --font-hebrew: 'Noto Sans Hebrew', 'SBL Hebrew', 'Ezra SIL', serif;
    --font-greek: 'Gentium Book Plus', 'Noto Serif', 'Noto Sans Greek', 'SBL Greek', 'Gentium Plus', serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* User Preferences (editable via JS) */
    --original-font-size: 1.6rem;
}

/* Dark Mode - Kerygma Gray Theme */
@media (prefers-color-scheme: dark) {
    :root:not(.light-mode) {
        --bg: #334155;
        --panel-bg: rgba(30, 41, 59, 0.9);
        --text: #f8fafc;
        --text-muted: #cbd5e1;
        --border: rgba(255, 255, 255, 0.08);
    }
}

/* Manual Dark Mode Toggle Override */
:root.dark-mode {
    --bg: #334155;
    --panel-bg: rgba(30, 41, 59, 0.9);
    --text: #f8fafc;
    --text-muted: #cbd5e1;
    --border: rgba(255, 255, 255, 0.08);
}

:root.light-mode {
    --bg: #f8fafc;
    --panel-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(51, 65, 85, 0.15);
}

/* ================================================
   Base Styles
   ================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-md);
    padding-bottom: 200px;
}

/* ================================================
   Header
   ================================================ */

header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.date-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* ================================================
   Verse Card
   ================================================ */

.verse-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    transition: box-shadow 0.2s ease;
}

.verse-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.verse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
}

.verse-ref {
    font-weight: 700;
    color: var(--text);
    font-size: 1.1rem;
}

.verse-label {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* Original Text */
.original-text {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    row-gap: 20px;
    margin-bottom: var(--space-lg);
    line-height: 1.2;
}

.hebrew {
    direction: rtl;
    font-family: var(--font-hebrew);
}

.greek {
    font-family: var(--font-greek);
}

/* Word Block */
.word-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, transform 0.1s ease;
}

.word-block:hover {
    background-color: rgba(211, 84, 0, 0.1);
    transform: translateY(-2px);
}

.word-block:active {
    transform: translateY(0);
}

.word-text {
    font-size: var(--original-font-size, 1.6rem);
    margin-bottom: var(--space-xs);
}

.word-sound {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

/* Translation Section */
.trans-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.02);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
}

@media (prefers-color-scheme: dark) {
    .trans-section {
        background: rgba(255, 255, 255, 0.03);
    }
}

.std-trans {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text);
}

.eng-trans {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.bsb-label {
    display: inline-block;
    background: #eef2f5;
    border: 1px solid #d1d9e6;
    color: #5c7cfa;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    margin-right: 6px;
    vertical-align: middle;
}

.lit-trans {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lit-label {
    font-size: 0.7rem;
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 5px;
    color: var(--text-muted);
}

/* ================================================
   Meditation Card
   ================================================ */

.meditation-card {
    background: var(--panel-bg);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.med-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.med-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: var(--space-lg);
    text-align: justify;
    word-break: keep-all;
}

.med-question {
    background: rgba(44, 62, 80, 0.05);
    padding: var(--space-md);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

@media (prefers-color-scheme: dark) {
    .med-question {
        background: rgba(255, 255, 255, 0.05);
    }
}

.q-text {
    font-size: 1rem;
    color: var(--text);
    font-weight: 500;
}

/* ================================================
   Parsing Panel
   ================================================ */

#parsing-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border-top: 3px solid var(--accent);
    padding: var(--space-lg);
    height: 160px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
}

#parsing-panel.visible {
    transform: translateY(0);
}

.panel-content {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-lg);
    align-items: center;
}

.panel-left {
    text-align: center;
    min-width: 120px;
}

.panel-word {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.panel-sound {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.panel-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.panel-lemma {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.panel-morph {
    color: var(--accent);
    font-weight: 700;
    font-family: monospace;
    font-size: 1rem;
}

.panel-gloss {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--success);
}

.close-panel {
    position: absolute;
    top: 12px;
    right: 16px;
    cursor: pointer;
    font-size: 2rem;
    color: var(--text-muted);
    line-height: 1;
    transition: color 0.15s ease;
}

.close-panel:hover {
    color: var(--text);
}

/* ================================================
   Loading & Error States
   ================================================ */

.loading-spinner {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-card {
    text-align: center;
    padding: var(--space-xl);
    background: var(--panel-bg);
    border-radius: var(--radius-md);
    border: 1px solid #e74c3c;
}

.error-card h2 {
    color: #e74c3c;
    margin-bottom: var(--space-md);
}

.error-card button {
    background: var(--accent);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    margin-top: var(--space-md);
    transition: background 0.15s ease;
}

.error-card button:hover {
    background: var(--accent-light);
}

/* ================================================
   Responsive Design
   ================================================ */

@media (max-width: 600px) {
    .container {
        padding: var(--space-sm);
        padding-bottom: 220px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .verse-card {
        padding: var(--space-md);
    }

    .word-text {
        font-size: 1.4rem;
    }

    .original-text {
        gap: 8px;
        row-gap: 16px;
    }

    .panel-content {
        grid-template-columns: 1fr;
        gap: var(--space-md);
        text-align: center;
    }

    .panel-left {
        min-width: auto;
        padding-bottom: var(--space-sm);
        border-bottom: 1px solid var(--border);
    }

    .panel-info {
        align-items: center;
    }

    #parsing-panel {
        height: auto;
        max-height: 50vh;
        padding: var(--space-md);
    }

    .panel-word {
        font-size: 2rem;
    }

    .panel-gloss {
        font-size: 1.2rem;
    }
}

/* ================================================
   Print Styles
   ================================================ */

@media print {
    .container {
        padding-bottom: 0;
    }

    #parsing-panel {
        display: none;
    }

    .verse-card,
    .meditation-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ================================================
   Footer
   ================================================ */

.site-footer {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    margin-top: var(--space-xl);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer strong {
    color: var(--accent);
    font-weight: 600;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.site-footer a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* Samsung Internet & Android Compatibility for Polytonic Greek */
:lang(grc),
:lang(greek),
.lang-greek {
    font-family: 'Gentium Book Plus', 'Noto Serif', serif !important;
}

/* ================================================
   Share Button & Toast
   ================================================ */

.med-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.share-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-color);
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.1s;
    border-radius: 50%;
}

.share-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

.share-btn:active {
    transform: scale(0.95);
}

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(50, 50, 50, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toast.visible {
    opacity: 1;
    visibility: visible;
}

/* ================================================
   Settings Panel
   ================================================ */

.settings-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 900;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-toggle:active {
    transform: scale(0.95);
}

.settings-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.settings-toggle:hover svg {
    color: var(--accent);
}

#settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100%;
    background: var(--panel-bg);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

#settings-panel.visible {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.settings-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.close-settings {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
    transition: color 0.15s ease;
}

.close-settings:hover {
    color: var(--text);
}

.settings-content {
    padding: var(--space-lg);
}

.setting-group {
    margin-bottom: var(--space-xl);
}

.setting-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Theme Toggle */
.theme-buttons {
    display: flex;
    gap: var(--space-sm);
}

.theme-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.theme-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Font Size Slider */
.font-size-control {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.font-size-slider {
    flex: 1;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: background .15s ease;
}

.font-size-slider::-webkit-slider-thumb:hover {
    background: var(--accent-light);
}

.font-size-value {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: var(--space-sm);
    text-align: right;
}

.font-preview {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.font-preview-text {
    font-family: var(--font-hebrew);
    font-size: var(--original-font-size);
    color: var(--text);
}

/* ================================================
   Liturgical Modal
   ================================================ */

.liturgical-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.liturgical-modal.visible {
    opacity: 1;
    visibility: visible;
}

.liturgical-modal-content {
    background: var(--panel-bg);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    max-width: 90%;
    width: 400px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.liturgical-modal.visible .liturgical-modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: var(--text);
}

#liturgical-modal-title {
    color: var(--accent);
    font-family: var(--font-serif);
    margin-bottom: var(--space-md);
    padding-right: 20px;
}

#liturgical-modal-desc {
    line-height: 1.6;
    color: var(--text);
}

.liturgical-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
    margin-left: 8px;
    transition: background 0.2s;
}

.liturgical-badge:hover {
    background: rgba(212, 175, 55, 0.2);
}