:root {
    color-scheme: light;
    --ink: #152238;
    --ink-soft: #3a4a63;
    --muted: #6b7a90;
    --surface: #ffffff;
    --line: rgba(21, 34, 56, 0.12);
    --navy: #1a2744;
    --navy-mid: #2a3d5c;
    --accent: #c4903a;
    --accent-deep: #9a6d28;
    --page: #eef2f7;
    --page-warm: #f7f4ef;
    --shadow: 0 14px 36px rgba(21, 34, 56, 0.1);
    --radius: 10px;
    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-ui: "Manrope", system-ui, sans-serif;
    --header-h: 64px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background:
        radial-gradient(ellipse 90% 55% at 0% -10%, rgba(196, 144, 58, 0.12), transparent 55%),
        radial-gradient(ellipse 70% 45% at 100% 0%, rgba(42, 61, 92, 0.1), transparent 50%),
        linear-gradient(180deg, var(--page) 0%, var(--page-warm) 48%, #e8edf4 100%);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--accent-deep);
    text-underline-offset: 0.14em;
}

a:hover {
    color: var(--navy);
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(196, 144, 58, 0.45);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---------- Header / nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(26, 39, 68, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(247, 244, 239, 0.08);
}

.header-top {
    width: min(100%, 1100px);
    margin: 0 auto;
    min-height: var(--header-h);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand-mark {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-decoration: none;
    color: #f7f4ef;
}

.brand-mark:hover {
    color: #ffffff;
}

.brand-name {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 4vw, 1.7rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(247, 244, 239, 0.62);
}

.nav-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(247, 244, 239, 0.22);
    border-radius: 8px;
    background: transparent;
    color: #f7f4ef;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-toggle:hover {
    background: rgba(247, 244, 239, 0.1);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-bars {
    position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-toggle-bars::before {
    top: -6px;
}

.nav-toggle-bars::after {
    top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

.site-nav {
    width: min(100%, 1100px);
    margin: 0 auto;
    padding: 4px 16px 16px;
    display: grid;
    gap: 4px;
    animation: nav-in 0.22s ease both;
}

.site-nav[hidden] {
    display: none;
}

.site-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.site-nav a:hover {
    background: rgba(247, 244, 239, 0.1);
    color: #ffffff;
}

@keyframes nav-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 900px) {
    .nav-toggle {
        display: none;
    }

    .site-header {
        display: flex;
        flex-direction: column;
    }

    .site-nav,
    .site-nav[hidden] {
        display: flex;
        flex-wrap: wrap;
        gap: 2px 4px;
        padding: 0 16px 12px;
        animation: none;
    }

    .site-nav a {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }
}

/* ---------- Hero (home only) ---------- */
.home-hero {
    position: relative;
    overflow: hidden;
    color: #f7f4ef;
    background:
        radial-gradient(ellipse 80% 70% at 12% 18%, rgba(196, 144, 58, 0.28), transparent 52%),
        radial-gradient(ellipse 60% 50% at 88% 75%, rgba(90, 120, 160, 0.22), transparent 48%),
        linear-gradient(155deg, #0f1729 0%, var(--navy) 45%, #243656 100%);
}

.home-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(247, 244, 239, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(247, 244, 239, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
}

.home-hero-inner {
    position: relative;
    width: min(100%, 1100px);
    margin: 0 auto;
    padding: clamp(40px, 9vw, 78px) 16px clamp(44px, 8vw, 72px);
    animation: rise 0.65s ease both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.home-brand {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 8vw, 4.1rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #ffffff;
}

.home-hero h1 {
    margin: 0 0 12px;
    font-family: var(--font-ui);
    font-size: clamp(1.05rem, 2.6vw, 1.35rem);
    font-weight: 500;
    color: #d4c4a0;
    letter-spacing: 0.02em;
}

.home-lede {
    margin: 0 0 24px;
    max-width: 36ch;
    color: rgba(238, 242, 247, 0.78);
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    line-height: 1.55;
}

.home-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
    color: var(--navy);
    background: #f0e2c4;
}

.btn-primary:hover {
    color: var(--navy);
    background: #ffffff;
    transform: translateY(-1px);
}

.btn-ghost {
    color: #f7f4ef;
    border: 1px solid rgba(247, 244, 239, 0.35);
    background: transparent;
}

.btn-ghost:hover {
    color: #ffffff;
    border-color: rgba(247, 244, 239, 0.6);
    background: rgba(247, 244, 239, 0.08);
}

.btn-secondary {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    color: var(--navy);
    background: rgba(255, 255, 255, 0.75);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
    color: var(--navy);
    background: #ffffff;
    border-color: rgba(196, 144, 58, 0.45);
}

.btn-share {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(196, 144, 58, 0.4);
    color: var(--accent-deep);
    background: #f7f0e4;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-share:hover,
.btn-share.is-shared {
    color: var(--navy);
    background: #f0e2c4;
    border-color: rgba(196, 144, 58, 0.55);
}

/* ---------- Main ---------- */
main {
    flex: 1;
    width: min(100%, 1100px);
    margin: 0 auto;
    padding: 22px 16px 48px;
}

.page-head {
    margin-bottom: 18px;
    animation: rise 0.5s ease both;
}

.page-head h1 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 4vw, 2.1rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--navy);
}

.page-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin: 0 0 18px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.65);
    font-size: 0.86rem;
    color: var(--muted);
}

.breadcrumbs a {
    color: var(--navy-mid);
    font-weight: 600;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent-deep);
    text-decoration: underline;
}

.section-label {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 650;
    color: var(--navy);
}

/* ---------- Folder grid ---------- */
.folders {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
    animation: rise 0.55s ease both;
}

@media (min-width: 520px) {
    .folders {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 860px) {
    .folders {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.folders a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 78px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(21, 34, 56, 0.04);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.folders a:hover {
    transform: translateY(-2px);
    border-color: rgba(196, 144, 58, 0.45);
    box-shadow: var(--shadow);
    color: var(--ink);
}

.folder-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--navy);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.folders a:hover .folder-title {
    color: var(--accent-deep);
}

.folder-meta {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
}

/* ---------- Gallery ---------- */
.gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 560px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.gallery-item {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(21, 34, 56, 0.05);
    animation: rise 0.5s ease both;
}

.gallery-thumb {
    display: block;
    background: #e8edf4;
    line-height: 0;
}

.gallery-thumb img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-item:hover .gallery-thumb img {
    transform: scale(1.02);
}

.gallery-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 14px;
}

.verse-label {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--navy);
    line-height: 1.25;
}

.image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.image-actions a,
.image-actions button {
    display: inline-flex;
    min-height: 40px;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.action-preview {
    color: var(--navy);
    background: #eef2f7;
    border: 1px solid var(--line);
}

.action-preview:hover {
    background: #e4eaf3;
    color: var(--navy);
}

.action-download {
    color: #fff;
    background: var(--navy);
    border: 1px solid var(--navy);
}

.action-download:hover {
    background: var(--navy-mid);
    color: #fff;
}

.action-share {
    color: var(--accent-deep);
    background: #f7f0e4;
    border: 1px solid rgba(196, 144, 58, 0.35);
}

.action-share:hover,
.action-share.is-shared {
    color: var(--navy);
    background: #f0e2c4;
    border-color: rgba(196, 144, 58, 0.55);
}

.empty-state {
    padding: 28px 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    text-align: center;
}

/* ---------- Image preview page ---------- */
.preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    animation: rise 0.55s ease both;
}

.preview-wrap img {
    width: min(100%, 860px);
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    background: #fff;
}

.preview-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.preview-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.back-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    margin-bottom: 14px;
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent-deep);
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: auto;
    padding: 28px 16px 32px;
    color: #c9d4e4;
    background: var(--navy);
    border-top: 1px solid rgba(247, 244, 239, 0.08);
    text-align: center;
    font-size: 0.86rem;
}

.site-footer p {
    margin: 0 auto 12px;
}

.site-footer a {
    color: #e8c98a;
    text-decoration: none;
    margin: 0 4px;
}

.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.site-footer .verse {
    color: #aebcd0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-style: italic;
}

.site-footer .footer-links {
    max-width: 860px;
    line-height: 2;
}

.site-footer .sep {
    color: rgba(201, 212, 228, 0.35);
    margin: 0 2px;
}

.site-footer .visitors {
    margin-bottom: 0;
    color: #8494ab;
}

.footer-install {
    margin: 4px auto 12px !important;
}

.footer-install-btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: 1px solid rgba(247, 244, 239, 0.28);
    border-radius: 8px;
    color: #1a2744;
    background: #f0e2c4;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.footer-install-btn:hover {
    background: #ffffff;
    transform: translateY(-1px);
}

.footer-install-btn[hidden] {
    display: none !important;
}

/* ---------- PWA install banner ---------- */
.pwa-install-banner {
    position: sticky;
    top: 0;
    z-index: 60;
    color: #f7f4ef;
    background: linear-gradient(135deg, #152238 0%, #2a3d5c 55%, #3a4a63 100%);
    border-bottom: 1px solid rgba(240, 226, 196, 0.2);
    box-shadow: 0 8px 24px rgba(21, 34, 56, 0.22);
    animation: banner-in 0.35s ease both;
}

.pwa-install-banner[hidden] {
    display: none !important;
}

@keyframes banner-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-banner-inner {
    width: min(100%, 1100px);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.pwa-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 160px;
    min-width: 0;
}

.pwa-banner-text strong {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.pwa-banner-text span {
    font-size: 0.82rem;
    color: rgba(247, 244, 239, 0.78);
    line-height: 1.35;
}

.pwa-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.pwa-btn-install,
.pwa-btn-cancel {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pwa-btn-install {
    border: none;
    color: #1a2744;
    background: #f0e2c4;
}

.pwa-btn-install:hover {
    background: #ffffff;
}

.pwa-btn-cancel {
    border: 1px solid rgba(247, 244, 239, 0.35);
    color: #f7f4ef;
    background: transparent;
}

.pwa-btn-cancel:hover {
    background: rgba(247, 244, 239, 0.1);
    border-color: rgba(247, 244, 239, 0.55);
}

@media (max-width: 560px) {
    .pwa-banner-actions {
        width: 100%;
        margin-left: 0;
    }

    .pwa-btn-install,
    .pwa-btn-cancel {
        flex: 1;
    }
}

@media (max-width: 519px) {
    .site-footer .footer-links {
        display: flex;
        flex-direction: column;
        gap: 2px;
        line-height: 1.4;
    }

    .site-footer .footer-links a {
        display: block;
        padding: 8px;
        margin: 0;
    }

    .site-footer .sep {
        display: none;
    }
}
