/* --- General Styles --- */
body {
    font-family: 'Georgia', serif;
    background-color: #f8f8f8;
    color: #333;
}

.navbar-light {
    background-color: #f1f1f1 !important;
}

.navbar-brand img {
    max-height: 44px;
}

.hero {
    background-image: url('/images/stoic-8431544_1280.webp');
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 100px 0;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 0;
}

.hero h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.65rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

h2 {
    font-family: 'Montserrat', sans-serif;
    color: #212529;
    margin-top: 3rem;
}

.topics-heading {
    margin: 0 0 1.5rem;
    font-size: clamp(1.5rem, 2.5vw, 1.75rem);
    font-weight: 500;
    line-height: 1.3;
}
.topics-heading-sidebar {
    margin: 0.5rem 0 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #495057;
}
@media (max-width: 767.98px) {
    .topics-heading-sidebar { margin-top: 2rem; }
}

.card {
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

a .card-title {
    color: #78613a;
    text-decoration: none;
}

a:hover .card-title {
    text-decoration: underline;
}

/* --- Reading and quote actions --- */
.topic-quote-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 1.5rem 0;
    padding: 0;
}
.topic-quote-list > li { min-width: 0; }
.topic-quote-list .quote { margin: 0; }
.quote {
    background-color: #f8f9fa;
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.5rem;
    text-align: left;
    overflow-wrap: anywhere;
}
.quote-body { margin: 0; }
.quote blockquote { margin: 0 0 0.65rem; }
.quote .quote-text {
    font-size: 1.2rem;
    font-style: normal;
    line-height: 1.75;
    max-width: 65ch;
    margin: 0;
}
.quote-attribution { line-height: 1.6; color: #495057; }
.quote-author { font-size: 1rem; }
.quote-source { font-size: 0.95rem; font-style: normal; color: #62686d; }
.quote-editorial {
    position: relative;
    isolation: isolate;
    padding: 1.5rem 1.5rem 1.25rem 3rem;
    background-color: #fff;
    border: 1px solid #ece9e3;
    border-radius: 0.65rem;
    box-shadow: 0 1px 3px #00000005;
}
.quote-editorial .quote-text, .quote-editorial .quote-attribution,
.quote-editorial > .quote-footer { position: relative; z-index: 1; }
.quote-opening, .quote-watermark {
    position: absolute;
    font-family: Georgia, serif;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.quote-opening {
    top: 1.25rem;
    left: 1rem;
    font-size: 3rem;
    color: #d8d6d1;
}
.quote-watermark {
    top: 0.5rem;
    right: 1rem;
    font-size: 22rem;
    height: 0.6em;
    color: #d8d6d1;
    opacity: 0.3;
    z-index: 0;
}
@media (min-width: 1200px) {
    .quote-editorial .quote-body { padding-right: 9rem; }
    .quote-editorial blockquote { position: relative; }
    .quote-editorial .quote-watermark {
        /* Let the visible glyph hang just below the passage end, allowing for font whitespace.
           Keep short quotations from pushing the decoration above the card. */
        top: max(-0.1em, calc(100% - 0.32em));
        right: -9.5rem;
    }
}
@media (max-width: 1199.98px) {
    .quote-editorial .quote-body { position: relative; }
    .quote-editorial .quote-watermark {
        top: auto;
        bottom: -0.4rem;
        right: -0.5rem;
        font-size: 9rem;
        opacity: 0.22;
    }
}
.saved-origin { margin: 0.75rem 0 0; font-size: 0.95rem; }
.quote-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.quote-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    min-width: 44px;
    padding: 0.45rem 0.8rem;
    border: 1px solid #c5b99f;
    border-radius: 0.4rem;
    background: transparent;
    color: #78613a;
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
}
.quote-action:hover, .quote-action[aria-pressed="true"] { background: #eee8dd; }
.quote-action[data-copy-quote], #saved-quotes .quote-action[data-save-quote] { border-color: transparent; }
.quote-action:focus-visible, .more-link:focus-visible, .nav-link:focus-visible {
    outline: 2px solid #78613a;
    outline-offset: 3px;
}
.quote-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    max-width: calc(100% - 2rem);
    width: max-content;
    background: #292722;
    color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px #0002;
    font-family: system-ui, sans-serif;
}
.quote-undo { flex-shrink: 0; border-color: transparent; color: #fff; text-decoration: underline; text-underline-offset: 0.2em; }
.quote-undo:hover { background: #ffffff18; }
.quote-undo:focus-visible { outline-color: #fff; }
[hidden] { display: none !important; }
.more-link {
    display: inline-block;
    padding: 0.5rem 0;
    color: #78613a;
    text-underline-offset: 0.2em;
}
.more-link:hover { color: #514024; }
.saved-quotes-page { min-height: 60vh; }
.saved-help { max-width: 65ch; color: #495057; line-height: 1.6; }
/* Carousel controls sit beside the card; pause stays visible for touch and keyboard users. */
.carousel {
    position: relative;
    max-width: 1100px;
    margin: 0 auto 2rem;
    background-color: transparent;
}
.carousel-content { padding: 1.5rem 3rem; }
.carousel-content .quote { margin: 0; padding: 1.5rem 5rem; text-align: center; }
.carousel .quote-body { padding-right: 0; }
.carousel .quote blockquote { position: relative; margin: 0 0 1rem; padding-left: 0; border-left: 0; }
/* A zero-width inline anchor follows the first word without shifting centered text. */
.carousel .quote-opening-anchor { position: relative; display: inline-block; width: 0; }
.carousel .quote-opening { top: auto; bottom: calc(-0.18em - 10px); left: auto; right: 0.08em; }
.carousel .quote-editorial .quote-watermark {
    top: max(-0.1em, calc(100% - 0.32em));
    bottom: auto;
    right: -4rem;
    font-size: 18rem;
    opacity: 0.22;
}
.carousel .quote-text { margin-inline: auto; }
.carousel .quote-footer {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr) 8rem;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
}
.carousel .quote-topic-link { grid-column: 2; font-size: 0.95rem; }
.carousel .quote-actions { grid-column: 3; justify-self: end; margin: 0 3rem 0 0; }
.carousel .quote-action { border: 0; padding: 0.45rem; }
.carousel-toolbar { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.carousel-toolbar .quote-action { position: absolute; pointer-events: auto; }
.carousel-toolbar [data-carousel-prev], .carousel-toolbar [data-carousel-next] {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
}
.carousel-toolbar [data-carousel-prev] { left: 0; }
.carousel-toolbar [data-carousel-next] { right: 0; }
.carousel-toggle { right: 4.5rem; bottom: 3rem; }
@media (max-width: 767.98px) {
    .carousel-content .quote { padding: 1.25rem 1.5rem; }
    .carousel .quote-opening { font-size: 2.25rem; }
    .carousel .quote-editorial .quote-watermark { right: -0.75rem; font-size: 9rem; opacity: 0.22; }
    .carousel .quote-footer { grid-template-columns: 1fr 1fr; }
    .carousel .quote-topic-link { grid-column: 1 / -1; }
    .carousel .quote-actions { grid-column: 1; justify-self: start; margin: 0; }
}
@media (max-width: 575.98px) {
    .quote { padding: 1rem; }
    .quote-editorial { padding: 1.15rem 1rem 1rem 2.15rem; }
    .quote-opening { top: 1rem; left: 0.5rem; font-size: 2.25rem; }
    .quote .quote-text { font-size: 1.125rem; line-height: 1.7; }
    .carousel-content { padding: 1rem 2.75rem; }
    .carousel-toggle { right: 3.75rem; bottom: 2.25rem; }
}
