@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --ink: #17221d;
    --muted: #718078;
    --paper: #f4f1e9;
    --card: #fffdf8;
    --line: #dfe4dc;
    --green: #235c4d;
    --lime: #d6e57b;
    --coral: #e87c5e;
    --shadow: 0 20px 60px rgba(35, 57, 44, .09);
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: 'DM Sans', sans-serif;
}

body:before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .25;
    background-image: radial-gradient(#b2bbb0 0.6px, transparent .6px);
    background-size: 15px 15px;
}

.navbar {
    height: 76px;
    padding: 0 clamp(20px, 5vw, 72px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 253, 248, .86);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 2;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -.3px;
}

.brand em {
    font-family: 'Playfair Display';
    font-weight: 600;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--paper);
    background: var(--green);
    border-radius: 50% 50% 50% 8px;
    font-size: 11px;
    letter-spacing: 1px;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.login-button {
    color: var(--paper);
    background: var(--green);
    border-radius: 99px;
    padding: 10px 17px;
    font-size: 13px;
    font-weight: 700;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero {
    padding: 72px 0 54px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
}

.eyebrow {
    color: var(--coral);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
}

h1 {
    max-width: 640px;
    margin-top: 12px;
    font-size: clamp(44px, 6vw, 78px);
    line-height: .98;
    letter-spacing: -2px;
}

.hero-copy {
    max-width: 310px;
    color: var(--muted);
    line-height: 1.65;
    font-size: 15px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 22px;
}

.section-heading h2 {
    font-size: 30px;
}

.count {
    color: var(--muted);
    font-size: 13px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding-bottom: 80px;
}

.book-card,
.book-card:hover,
.book-card:visited,
.book-card:active,
.book-card * {
    text-decoration: none;
}

.book-card {
    display: block;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 12px;
    transition: transform .25s, box-shadow .25s;
}

.book-card:hover {
    transform: translateY(-6px) rotate(-.4deg);
    box-shadow: 0 25px 60px rgba(35, 57, 44, .16);
}

.cover-wrap {
    aspect-ratio: .72;
    overflow: hidden;
    background: #dbe2d7;
}

.cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-info {
    padding: 17px 5px 7px;
}

.book-info h3 {
    color: var(--ink);
    font-size: 20px;
    line-height: 1.12;
}

.author {
    color: var(--muted);
    font-size: 13px;
    margin: 7px 0 12px;
}

.rating {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--coral);
    font-size: 15px;
}

.rating small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.footprints {
    color: var(--muted);
    font-size: 12px;
    margin: 8px 0 0;
}

.detail {
    padding: 56px 0 80px;
}

.back-link {
    display: inline-block;
    color: var(--green);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 34px;
}

.detail-main {
    display: grid;
    grid-template-columns: minmax(280px, 390px) 1fr;
    gap: clamp(35px, 7vw, 90px);
    align-items: center;
}

.detail-cover {
    width: 100%;
    aspect-ratio: .72;
    object-fit: cover;
    box-shadow: 22px 25px 0 var(--lime), var(--shadow);
}

.detail-text h1 {
    font-size: clamp(42px, 5vw, 70px);
}

.detail-text .author {
    font-size: 16px;
    margin-top: 16px;
}

.description {
    max-width: 570px;
    color: #58665e;
    line-height: 1.8;
    margin: 25px 0;
}

.detail-rating {
    font-size: 21px;
}

.comments-area {
    margin-top: 100px;
    max-width: 760px;
}

.comments-area h2 {
    font-size: 34px;
    margin-bottom: 25px;
}

.comment-form {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 22px;
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    padding: 13px 14px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    outline-color: var(--coral);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.primary-button {
    background: var(--coral);
    color: white;
    padding: 12px 18px;
    font-weight: 700;
    justify-self: start;
}

.comment {
    border-bottom: 1px solid var(--line);
    padding: 17px 0;
}

.comment-head {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

.comment strong {
    color: var(--ink);
}

.comment p {
    line-height: 1.6;
    margin: 9px 0 0;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding: 55px 0 32px;
}

.admin-top h1 {
    font-size: 50px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 30px;
    padding-bottom: 70px;
}

.admin-panel {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 24px;
}

.admin-panel h2 {
    font-size: 25px;
    margin-bottom: 20px;
}

.admin-form {
    display: grid;
    gap: 11px;
}

.admin-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.admin-form input,
.admin-form textarea {
    margin-top: 5px;
}

.admin-list {
    display: grid;
    gap: 12px;
}

.admin-row {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.admin-row img {
    width: 58px;
    height: 76px;
    object-fit: cover;
}

.admin-row h3 {
    font-size: 18px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.row-actions a {
    color: var(--ink);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.row-actions a:hover {
    color: var(--coral);
}

.row-actions button {
    background: transparent;
    color: var(--coral);
    font-size: 12px;
    font-weight: 700;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--ink);
    color: white;
    padding: 13px 18px;
    transform: translateY(150%);
    transition: transform .25s;
    z-index: 10;
    font-size: 13px;
}

.toast.show {
    transform: translateY(0);
}

.empty {
    color: var(--muted);
    padding: 20px 0;
}

.modal-box {
    border: 0;
    border-radius: 0;
    background: var(--card);
}

.modal-box h2 {
    font-family: 'Playfair Display', serif;
}

.offcanvas {
    width: min(400px, 100%);
    box-shadow: var(--shadow);
}

.book-qr {
    margin: 60px auto 0;
    padding: 30px;
    max-width: 340px;
    background: var(--card);
    border: 1px solid var(--line);
}

.book-qr h2 {
    font-size: 19px;
    margin-bottom: 16px;
}

.qr-detail-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.qr-table {
    background: transparent;
}

.qr-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.qr-table td {
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 14px;
}

.qr-steps {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.qr-thumb-cover {
    display: inline-block;
    width: 32px !important;
    height: 42px !important;
    max-width: 32px;
    max-height: 42px;
    object-fit: cover;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.qr-thumb {
    display: inline-block;
    width: 40px !important;
    height: 40px !important;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    padding: 2px;
    flex-shrink: 0;
}

.qr-preview {
    display: flex;
    justify-content: center;
    padding: 14px 0;
}

.qr-preview canvas,
.qr-current-image {
    display: block;
    width: 160px !important;
    height: 160px !important;
    max-width: 160px;
    max-height: 160px;
    object-fit: contain;
}

@media (max-width:800px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        display: block;
        padding-top: 52px;
    }

    .hero-copy {
        margin-top: 22px;
    }

    .detail-main,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .detail-cover {
        width: min(300px, 100%);
    }

    .comments-area {
        margin-top: 75px;
    }
}

@media (max-width:480px) {
    .navbar {
        padding: 0 16px;
    }

    nav {
        gap: 7px;
    }

    .nav-home {
        display: none;
    }

    .login-button {
        padding: 9px 11px;
        font-size: 12px;
    }

    .page-shell {
        width: min(100% - 28px, 1180px);
    }

    h1 {
        font-size: 45px;
    }

    .book-grid {
        gap: 10px;
    }

    .book-card {
        padding: 8px;
    }

    .book-info {
        padding: 12px 3px 5px;
    }

    .book-info h3 {
        font-size: 17px;
    }

    .admin-top {
        display: block;
    }
}