:root {
    --primary: #b4573d;
    --primary-dark: #873e2c;
    --primary-soft: #f0ddd4;
    --accent: #2f5d50;
    --accent-soft: #dce7df;
    --highlight: #d4a85b;
    --background: #f5f1e8;
    --surface: #fbfaf6;
    --card-bg: #fffefa;
    --pure-white: #fffefa;
    --ink: #25231f;
    --text-primary: #25231f;
    --text-secondary: #68635b;
    --text-muted: #8a8379;
    --border: #dcd5c9;
    --border-dark: #b9b0a2;
    --shadow: rgba(52, 45, 36, 0.08);
    --shadow-dark: rgba(52, 45, 36, 0.14);
    --gradient-primary: linear-gradient(135deg, #b4573d 0%, #8f4632 100%);
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "DM Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --page-width: 1180px;
    --reading-width: 760px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--background);
    color: var(--text-primary);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

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

button {
    color: inherit;
}

a {
    color: inherit;
}

::selection {
    background: var(--primary-soft);
}

:focus-visible {
    outline: 3px solid rgba(180, 87, 61, 0.32);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--surface);
    text-decoration: none;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.container {
    min-height: 100vh;
    overflow: hidden;
}

.navbar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(calc(100% - 48px), var(--page-width));
    margin: 0 auto;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--ink);
    border-radius: 50%;
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link,
.nav-saved {
    position: relative;
    border: 0;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.nav-link::after {
    position: absolute;
    right: 0;
    bottom: -6px;
    left: 0;
    height: 1px;
    background: var(--primary);
    content: "";
    transform: scaleX(0);
    transition: transform 180ms ease;
}

.nav-link:hover,
.nav-saved:hover {
    color: var(--primary-dark);
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-saved {
    padding: 9px 14px;
    border: 1px solid var(--border-dark);
    border-radius: 999px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    gap: clamp(44px, 6vw, 82px);
    align-items: center;
    width: min(calc(100% - 48px), var(--page-width));
    margin: 0 auto;
    padding: clamp(48px, 6.5vw, 82px) 0 clamp(58px, 7vw, 92px);
}

.hero-content {
    min-width: 0;
    max-width: 740px;
}

.hero-kicker,
.section-kicker,
.featured-label {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.hero-title {
    margin: 14px 0 20px;
    font-family: var(--serif);
    font-size: clamp(54px, 7.2vw, 94px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.9;
}

.hero-title em {
    color: var(--primary);
    font-weight: 400;
}

.hero-subtitle {
    max-width: 630px;
    color: var(--text-secondary);
    font-family: var(--serif);
    font-size: clamp(19px, 2.2vw, 24px);
    line-height: 1.5;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin: 24px 0 26px;
}

.feature {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    font-size: 13px;
}

.feature-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    padding: 0 0 7px;
    border: 0;
    border-bottom: 1px solid var(--ink);
    background: transparent;
    cursor: pointer;
    font-weight: 600;
}

.cta-arrow {
    color: var(--primary);
    font-size: 20px;
    transition: transform 180ms ease;
}

.hero-cta:hover .cta-arrow {
    transform: translateY(4px);
}

.featured-verse {
    position: relative;
    min-width: 0;
    padding: 32px 0 4px 30px;
    border-left: 1px solid var(--border-dark);
}

.featured-verse::before {
    position: absolute;
    top: -21px;
    left: 26px;
    color: var(--primary-soft);
    content: "“";
    font-family: var(--serif);
    font-size: 120px;
    line-height: 1;
    pointer-events: none;
}

.featured-verse blockquote {
    position: relative;
    margin: 18px 0;
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.55;
}

.featured-verse cite {
    color: var(--text-muted);
    font-size: 13px;
    font-style: normal;
}

.main {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.search-section,
.results-section {
    width: min(calc(100% - 48px), var(--page-width));
    margin: 0 auto;
}

.search-section {
    padding: clamp(54px, 6.5vw, 78px) 0;
}

.search-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 42px;
}

.search-heading-row h2,
.results-header h2 {
    margin-top: 6px;
    font-family: var(--serif);
    font-size: clamp(36px, 5vw, 54px);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.collection-status {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 12px;
}

.search-label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.search-container {
    display: grid;
    grid-template-columns: 1fr auto;
    overflow: hidden;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: 0 18px 48px var(--shadow);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 18px 52px var(--shadow), 0 0 0 3px var(--primary-soft);
}

#searchInput {
    min-width: 0;
    padding: 22px 24px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(18px, 2vw, 22px);
}

#searchInput::placeholder {
    color: #9a9389;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 28px;
    margin: 6px;
    padding: 0 22px;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: var(--surface);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 180ms ease, transform 180ms ease;
}

.search-btn:hover {
    background: var(--primary-dark);
}

.search-btn:active {
    transform: scale(0.98);
}

.search-arrow {
    color: #e3b2a3;
    font-size: 18px;
}

.search-options {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 28px;
}

.option-label {
    padding-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 160ms ease;
}

.mode-btn:hover {
    border-color: var(--border-dark);
    background: var(--background);
    color: var(--ink);
}

.mode-btn.active {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--surface);
}

.mode-icon {
    min-width: 14px;
    color: var(--primary);
    text-align: center;
}

.mode-btn.active .mode-icon {
    color: #e3b2a3;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.suggestions-label {
    margin-right: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.suggestion-btn {
    padding: 7px 12px;
    border: 0;
    border-radius: 6px;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--serif);
    font-size: 14px;
    transition: background 160ms ease, color 160ms ease;
}

.suggestion-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.loading {
    display: none;
    width: min(calc(100% - 48px), var(--reading-width));
    margin: 0 auto;
    padding: 30px 0 80px;
    text-align: center;
}

.search-loader {
    position: relative;
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
}

.loader-rings,
.ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.ring {
    border: 1px solid transparent;
}

.ring-1 {
    border-top-color: var(--primary);
    animation: spin 1.6s linear infinite;
}

.ring-2 {
    inset: 8px;
    border-right-color: var(--accent);
    animation: spin 1.2s linear infinite reverse;
}

.ring-3 {
    inset: 16px;
    border-bottom-color: var(--highlight);
    animation: spin 1s linear infinite;
}

.loader-center {
    position: absolute;
    inset: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--background);
    color: var(--primary-dark);
    font-family: var(--serif);
    font-weight: 600;
}

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

.loading-message {
    color: var(--text-secondary);
    font-family: var(--serif);
    font-size: 18px;
}

.loading-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 10px;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.2s ease-in-out infinite;
}

.dot:nth-child(2) {
    animation-delay: 150ms;
}

.dot:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes pulse {
    50% {
        opacity: 0.25;
        transform: translateY(-3px);
    }
}

.results-section {
    display: none;
    padding: 0 0 96px;
}

.results-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.results-header h2 {
    font-size: clamp(32px, 4vw, 46px);
}

.results-meta {
    display: flex;
    gap: 8px;
    padding-bottom: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.results-container {
    display: grid;
    gap: 14px;
    max-width: 900px;
}

.verse-card {
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    box-shadow: 0 8px 28px rgba(52, 45, 36, 0.035);
    transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.verse-card:hover {
    border-color: var(--border-dark);
    box-shadow: 0 14px 36px var(--shadow);
    transform: translateY(-2px);
}

.verse-header {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.verse-reference {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.verse-score {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.verse-text {
    max-width: 760px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(19px, 2.2vw, 23px);
    line-height: 1.65;
}

.verse-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 160ms ease, color 160ms ease;
}

.action-btn:hover {
    background: var(--background);
    color: var(--primary-dark);
}

.btn-icon {
    font-size: 13px;
    filter: grayscale(1);
}

.no-results,
.error-message {
    padding: 48px 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    text-align: center;
}

.no-results h3,
.error-message h3 {
    margin-bottom: 8px;
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
}

.no-results p,
.error-message p {
    color: var(--text-secondary);
}

.cta-section {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: clamp(48px, 9vw, 120px);
    width: min(calc(100% - 48px), var(--page-width));
    margin: 0 auto;
    padding: clamp(76px, 10vw, 126px) 0;
}

.section-kicker-light {
    color: var(--accent);
}

.cta-title {
    max-width: 700px;
    margin: 14px 0 22px;
    font-family: var(--serif);
    font-size: clamp(38px, 5.5vw, 66px);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1.02;
}

.cta-description {
    max-width: 690px;
    color: var(--text-secondary);
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.65;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 32px;
}

.cta-primary,
.cta-secondary {
    padding: 12px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 180ms ease;
}

.cta-primary {
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--surface);
}

.cta-secondary {
    border: 1px solid var(--border-dark);
    background: transparent;
    color: var(--ink);
}

.cta-primary:hover {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}

.cta-secondary:hover {
    border-color: var(--ink);
    background: var(--surface);
}

.principles {
    border-top: 1px solid var(--border-dark);
}

.principle {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.principle span {
    color: var(--primary);
    font-family: var(--serif);
    font-size: 13px;
}

.principle p {
    color: var(--text-secondary);
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.45;
}

.footer {
    background: var(--ink);
    color: #eee8de;
}

.footer-content,
.footer-bottom {
    width: min(calc(100% - 48px), var(--page-width));
    margin: 0 auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 64px;
    padding: 66px 0 54px;
}

.footer .brand-mark {
    border-color: #eee8de;
}

.footer-brand h3 {
    font-size: 15px;
}

.footer-brand > p {
    margin-top: 16px;
    color: #a9a39a;
    font-family: var(--serif);
    font-size: 17px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.link-group {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.link-group h4 {
    margin-bottom: 5px;
    color: #a9a39a;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.link-group a,
.link-group button,
.link-group span {
    width: fit-content;
    border: 0;
    background: none;
    color: #eee8de;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
}

.link-group button {
    cursor: pointer;
}

.link-group span {
    color: #817c75;
}

.link-group a:hover,
.link-group button:hover {
    color: #e3b2a3;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    padding: 20px 0 28px;
    border-top: 1px solid #45413b;
    color: #817c75;
    font-size: 11px;
}

@media (max-width: 860px) {
    .hero,
    .cta-section {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero {
        gap: 64px;
    }

    .featured-verse {
        max-width: 540px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .navbar,
    .hero,
    .search-section,
    .results-section,
    .cta-section,
    .footer-content,
    .footer-bottom {
        width: min(calc(100% - 32px), var(--page-width));
    }

    .navbar {
        padding: 18px 0;
    }

    .nav-links .nav-link {
        display: none;
    }

    .nav-saved {
        display: none;
    }

    .brand-text {
        font-size: 14px;
    }

    .hero {
        padding: 52px 0 62px;
    }

    .hero-title {
        font-size: clamp(48px, 16vw, 64px);
    }

    .hero-subtitle {
        font-size: 19px;
    }

    .hero-content,
    .featured-verse {
        max-width: calc(100vw - 32px);
    }

    .hero-features {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 18px;
    }

    .featured-verse blockquote {
        overflow-wrap: anywhere;
        font-size: 20px;
    }

    .search-heading-row {
        align-items: start;
        margin-bottom: 32px;
    }

    .collection-status {
        margin-top: 8px;
    }

    .search-container {
        grid-template-columns: 1fr;
    }

    #searchInput {
        padding: 18px;
    }

    .search-btn {
        justify-content: space-between;
        min-height: 48px;
        margin: 0 6px 6px;
    }

    .search-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .option-label {
        padding-top: 0;
    }

    .results-header,
    .verse-header,
    .footer-bottom {
        align-items: start;
        flex-direction: column;
        gap: 8px;
    }

    .verse-actions {
        gap: 3px;
    }

    .action-btn {
        padding: 7px 8px;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .cta-primary,
    .cta-secondary {
        width: 100%;
    }

    .footer-links {
        grid-template-columns: 1fr 1fr;
        row-gap: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
