/* Public-site shared styles — palette and header bar match the management admin. */

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #f4f1e8;
    color: #3a2a1f;
    font-family: Georgia, serif;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Library background — fixed so it stays put while content scrolls.
   Applied to body.home only; other pages keep the plain parchment. */
body.home {
    background-image:
        linear-gradient(rgba(244, 241, 232, 0.55), rgba(244, 241, 232, 0.55)),
        url('/assets/images/library-bg.jpg');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

a { color: #6b4e3d; text-decoration: underline; }
a:hover { color: #553e30; }

img { max-width: 100%; }

/* ===== HEADER BAR ===== */
.site-header {
    background: #6b4e3d;
    color: #fffdf7;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.site-brand {
    color: #fffdf7;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 22px;
    letter-spacing: 0.5px;
}
.site-brand:hover { color: #fffdf7; }
.site-brand img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #000;
    display: block;
}
.site-nav {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}
.site-nav a {
    color: #fffdf7;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a.active {
    color: #fffdf7;
    border-bottom-color: #fffdf7;
}

/* ===== SHELL & CARDS ===== */
.site-shell {
    flex: 1;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 32px 24px;
}

.site-card {
    background: #f8f5ec;
    border: 1px solid #c8bfae;
    border-radius: 6px;
    padding: 32px;
    margin-bottom: 24px;
}
.site-card h1,
.site-card h2,
.site-card h3 {
    margin-top: 0;
    color: #3a2a1f;
}
.site-card h1 { font-size: 28px; margin-bottom: 16px; }
.site-card h2 { font-size: 22px; margin-bottom: 14px; }
.site-card p {
    margin: 0 0 14px;
    font-size: 16px;
}
.site-card p:last-child { margin-bottom: 0; }
.site-card .lead { font-size: 17px; }
.site-list {
    margin: 8px 0 14px;
    padding-left: 22px;
}
.site-list li {
    margin-bottom: 10px;
    line-height: 1.55;
}
.site-list li:last-child { margin-bottom: 0; }
.site-list li::marker { color: #6b4e3d; }

/* Inline contact card */
.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.contact-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0d6bd;
}
.contact-list li:last-child { border-bottom: none; }
.contact-list .label {
    display: inline-block;
    width: 90px;
    color: #6b4e3d;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Contact form */
.contact-form { margin-top: 8px; }
.contact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
    margin-bottom: 14px;
}
.contact-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}
.contact-row .contact-field { margin-bottom: 0; }
.contact-field label {
    font-size: 13px;
    color: #5a4636;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.contact-field .required { color: #a02a2a; }
.contact-field input,
.contact-field textarea {
    padding: 10px 12px;
    border: 1px solid #c8bfae;
    background: #fffdf7;
    font-family: Georgia, serif;
    font-size: 16px;
    border-radius: 3px;
    width: 100%;
    box-sizing: border-box;
}
.contact-field input:focus,
.contact-field textarea:focus {
    outline: none;
    border-color: #6b4e3d;
    box-shadow: 0 0 0 2px rgba(107, 78, 61, 0.15);
}
.contact-field textarea { resize: vertical; }

.contact-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
}

.contact-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}
.contact-submit {
    background: #6b4e3d;
    color: #fffdf7;
    border: none;
    padding: 12px 26px;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 15px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}
.contact-submit:hover:not(:disabled) { background: #553e30; }
.contact-submit:disabled { opacity: 0.6; cursor: wait; }

.contact-status { font-size: 14px; }
.contact-status.ok { color: #2f6f2f; }
.contact-status.err { color: #a02a2a; }

@media (max-width: 600px) {
    .contact-row { grid-template-columns: 1fr; }
}

.muted { color: #8b7d6a; font-style: italic; }

/* Wants list (public) */
.wants-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}
.wants-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: #fffdf7;
    border: 1px solid #c8bfae;
    border-radius: 4px;
}
.wants-meta { flex: 1; min-width: 0; }
.wants-title {
    font-size: 19px;
    color: #3a2a1f;
    font-style: italic;
    line-height: 1.25;
}
.wants-year {
    color: #6b4e3d;
    font-style: normal;
    font-size: 16px;
    margin-left: 4px;
}
.wants-sub {
    font-size: 15px;
    color: #5a4636;
    margin-top: 4px;
}
.wants-author {
    font-size: 12px;
    color: #6b4e3d;
    margin-top: 6px;
    letter-spacing: 0.3px;
}
.wants-cta {
    flex-shrink: 0;
    background: #6b4e3d;
    color: #fffdf7;
    text-decoration: none;
    padding: 9px 16px;
    border-radius: 3px;
    font-size: 14px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.wants-cta:hover { background: #553e30; color: #fffdf7; }
@media (max-width: 600px) {
    .wants-item { flex-direction: column; align-items: stretch; }
    .wants-cta { text-align: center; }
}

/* Portfolio (public) */
.portfolio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.portfolio-header h2 { margin: 0; }

.density-toggle {
    display: inline-flex;
    border: 1px solid #c8bfae;
    border-radius: 4px;
    overflow: hidden;
    background: #fffdf7;
}
.density-btn {
    background: transparent;
    color: #6b4e3d;
    border: none;
    padding: 7px 14px;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 14px;
    letter-spacing: 0.3px;
    border-right: 1px solid #c8bfae;
}
.density-btn:last-child { border-right: none; }
.density-btn:hover { background: #f0ead8; }
.density-btn.active {
    background: #6b4e3d;
    color: #fffdf7;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 8px;
}

/* Compact density — one row per book, small thumbnail, key line of meta */
.portfolio-grid.compact {
    grid-template-columns: 1fr;
    gap: 8px;
}
.portfolio-grid.compact .portfolio-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
}
.portfolio-grid.compact .portfolio-hero {
    width: 80px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    border-right: 1px solid #c8bfae;
}
.portfolio-grid.compact .portfolio-body {
    padding: 10px 14px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.portfolio-grid.compact .portfolio-author { font-size: 11px; margin-bottom: 2px; }
.portfolio-grid.compact .portfolio-title { font-size: 16px; margin: 0; }
.portfolio-grid.compact .portfolio-details,
.portfolio-grid.compact .portfolio-prov,
.portfolio-grid.compact .portfolio-thumbs { display: none; }
.portfolio-grid.compact .portfolio-sub {
    font-size: 12px;
    color: #5a4636;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}
.portfolio-grid.compact .portfolio-compact-summary {
    color: #5a4636;
    font-size: 13px;
    margin-top: 3px;
}

/* In gallery mode, the inline single-line summary stays hidden */
.portfolio-grid:not(.compact) .portfolio-compact-summary { display: none; }
.portfolio-card {
    background: #fffdf7;
    border: 1px solid #c8bfae;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s, transform 0.15s;
}
.portfolio-card-clickable {
    cursor: pointer;
}
.portfolio-card-clickable:hover {
    box-shadow: 0 6px 18px rgba(58, 42, 31, 0.15);
    transform: translateY(-1px);
}
.portfolio-card-clickable:focus {
    outline: 2px solid #6b4e3d;
    outline-offset: 2px;
}
.portfolio-summary {
    color: #5a4636;
    font-size: 14px;
    margin-top: 8px;
}
.portfolio-hero {
    background: #ede4cf;
    border: none;
    padding: 0;
    cursor: zoom-in;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.portfolio-hero-static { cursor: inherit; }
.portfolio-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.portfolio-hero-placeholder { cursor: default; }
.portfolio-hero-placeholder img { opacity: 0.95; }
.portfolio-body { padding: 16px 18px; }
.portfolio-author {
    font-size: 12px;
    color: #6b4e3d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.portfolio-title {
    font-size: 18px;
    color: #3a2a1f;
    font-style: italic;
    line-height: 1.2;
    margin-bottom: 4px;
}
.portfolio-sub {
    font-size: 14px;
    color: #5a4636;
    margin-bottom: 10px;
}
.portfolio-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    font-size: 14px;
    color: #3a2a1f;
}
.portfolio-detail .label {
    color: #6b4e3d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: inline-block;
    width: 90px;
}
.portfolio-badge {
    display: inline-block;
    background: #ede4cf;
    color: #6b4e3d;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: max-content;
}
.portfolio-prov {
    margin-top: 12px;
    font-size: 14px;
    color: #3a2a1f;
    border-top: 1px solid #e0d6bd;
    padding-top: 10px;
}
.portfolio-prov strong { color: #6b4e3d; }
.portfolio-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.portfolio-thumb {
    width: 56px;
    height: 56px;
    border: 1px solid #c8bfae;
    background: #ede4cf;
    padding: 0;
    cursor: zoom-in;
    border-radius: 3px;
    overflow: hidden;
}
.portfolio-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Portfolio detail modal */
.portfolio-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}
.portfolio-modal-card {
    background: #f8f5ec;
    border: 1px solid #c8bfae;
    border-radius: 6px;
    width: 100%;
    max-width: 760px;
    padding: 28px 28px 24px;
    position: relative;
    color: #3a2a1f;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.portfolio-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b4e3d;
    cursor: pointer;
    padding: 4px 10px;
}
.portfolio-modal-close:hover { color: #3a2a1f; }
.portfolio-modal-head { margin-bottom: 18px; }
.portfolio-modal-author {
    color: #6b4e3d;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.portfolio-modal-title {
    font-size: 24px;
    margin: 0;
    color: #3a2a1f;
    font-style: italic;
}
.portfolio-modal-sub {
    margin-top: 6px;
    color: #5a4636;
    font-size: 16px;
}

.portfolio-tabs {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #c8bfae;
    flex-wrap: wrap;
}
.portfolio-tab {
    padding: 8px 16px;
    color: #6b4e3d;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    user-select: none;
    letter-spacing: 0.3px;
}
.portfolio-tab:hover { color: #3a2a1f; }
.portfolio-tab.active {
    color: #3a2a1f;
    border-bottom-color: #6b4e3d;
}
.portfolio-tab-pane {
    display: none;
}
.portfolio-tab-pane.active {
    display: block;
}
.portfolio-tab-pane .portfolio-detail {
    padding: 6px 0;
    border-bottom: 1px dashed #e0d6bd;
}
.portfolio-tab-pane .portfolio-detail:last-child { border-bottom: none; }
.portfolio-block {
    padding: 10px 0;
    border-bottom: 1px dashed #e0d6bd;
}
.portfolio-block:last-child { border-bottom: none; }
.portfolio-block .label {
    color: #6b4e3d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: block;
    margin-bottom: 4px;
}
.portfolio-block p {
    margin: 0;
    line-height: 1.5;
}
.portfolio-tab-pane p {
    margin: 0;
    line-height: 1.55;
}
.portfolio-modal-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.portfolio-modal-photo {
    background: #ede4cf;
    border: 1px solid #c8bfae;
    border-radius: 3px;
    padding: 0;
    cursor: zoom-in;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.portfolio-modal-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 600px) {
    .portfolio-modal { padding: 0; }
    .portfolio-modal-card {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .portfolio-modal-title { font-size: 20px; }
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
}

/* Lightbox prev/next navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    font-size: 28px;
    line-height: 1;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background 0.15s;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-counter {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    letter-spacing: 0.5px;
}
@media (max-width: 600px) {
    .lightbox-nav { width: 44px; height: 44px; font-size: 22px; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
}

.hidden { display: none !important; }

/* Pagination control (public pages) */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding: 10px 0;
    flex-wrap: wrap;
}
.pager .pager-info {
    color: #6b4e3d;
    font-size: 14px;
}
.btn-secondary-public {
    background: transparent;
    color: #6b4e3d;
    border: 1px solid #6b4e3d;
    padding: 8px 18px;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 14px;
    border-radius: 3px;
}
.btn-secondary-public:hover:not(:disabled) { background: #f0ead8; }
.btn-secondary-public:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== FOOTER ===== */
.site-footer {
    background: #ede4cf;
    color: #6b4e3d;
    text-align: center;
    padding: 16px 24px;
    font-size: 13px;
    border-top: 1px solid #c8bfae;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .site-header { flex-direction: column; align-items: flex-start; }
    .site-shell { padding: 20px 16px; }
    .site-card { padding: 22px; }
    .site-card h1 { font-size: 24px; }
}
