html, body { margin: 0; min-height: 100%; }

:root {
    --riva-ivory: #f7f1e5;
    --riva-paper: #efe7d5;
    --riva-ink: #4f4128;
    --riva-ink-soft: #7a6a4d;
    --riva-clay: #b4653f;
    --riva-clay-deep: #9c5433;
    --riva-sage: #9db3a0;
    --riva-hairline: #e2d7c1;
    --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-text: "Jost", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body {
    background: var(--riva-ivory);
    color: var(--riva-ink);
    font-family: var(--font-text);
    font-weight: 400;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.riva-page { max-width: 760px; margin: 0 auto; padding: 0 22px 40px; }
img { max-width: 100%; }

/* Reveal-on-scroll motion */
.riva-reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1); }
.riva-reveal.riva-in { opacity: 1; transform: none; }

/* Hero */
.riva-hero {
    margin: 0 -22px 8px;
    padding: 40px 22px 28px;
    background:
        radial-gradient(120% 85% at 50% -12%, #e0a98b 0%, #cf9068 24%, rgba(207, 144, 104, 0) 60%),
        radial-gradient(150% 100% at 50% 118%, #bccbb5 0%, rgba(188, 203, 181, 0) 52%),
        var(--riva-ivory);
    border-radius: 0 0 30px 30px;
    text-align: center;
    animation: riva-hero-in 0.9s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
@keyframes riva-hero-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.riva-hero > img {
    width: min(230px, 60%);
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(79, 65, 40, 0.28);
    margin-bottom: 18px;
    animation: riva-logo-in 1.1s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
@keyframes riva-logo-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.riva-hero h1 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -0.01em;
    line-height: 1.15;
}
@media (min-width: 768px) { .riva-hero h1 { font-size: 40px; } }
.riva-hero .riva-tagline { margin: 0 auto; max-width: 46ch; color: var(--riva-ink-soft); font-size: 16px; }

/* Ornament divider */
.riva-ornament { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 2px; }
.riva-ornament span { width: 56px; height: 1px; background: var(--riva-clay); opacity: 0.55; }
.riva-ornament i { width: 7px; height: 7px; background: var(--riva-clay); transform: rotate(45deg); }

/* Sections */
.riva-sec { margin-top: 38px; }
.riva-eyebrow {
    margin: 0 0 6px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--riva-clay);
}
.riva-sec-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 27px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
@media (min-width: 768px) { .riva-sec-title { font-size: 31px; } }
.riva-sec p { margin: 0 0 12px; }
.riva-caption { font-size: 13px; color: var(--riva-ink-soft); }

/* Flipbook */
.riva-bookwrap { margin: 12px 0 6px; overflow-x: clip; }
.riva-book {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 1240 / 1755;
    perspective: 2000px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}
.riva-book:active { cursor: grabbing; }
.riva-book::before {
    content: '';
    position: absolute;
    inset: 0;
    transform: translate(7px, 6px);
    background: var(--riva-paper);
    border-radius: 6px;
    box-shadow: 0 16px 38px rgba(79, 65, 40, 0.3);
}
.riva-book::after {
    content: '';
    position: absolute;
    top: 2px;
    bottom: 2px;
    right: -4px;
    width: 5px;
    background: repeating-linear-gradient(to bottom, var(--riva-paper) 0 2px, #d3c5a9 2px 3px);
    border-radius: 0 3px 3px 0;
}
.riva-book-base, .riva-leaf { position: absolute; inset: 0; }
.riva-book-base { border-radius: 6px; overflow: hidden; }
.riva-book-base img, .riva-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.riva-base-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(50, 38, 20, 0.55), rgba(50, 38, 20, 0) 45%);
    pointer-events: none;
}
.riva-leaf {
    transform-style: preserve-3d;
    transform-origin: 0% 50%;
    transition: transform 0.5s cubic-bezier(0.3, 0.05, 0.2, 1);
    will-change: transform;
    border-radius: 6px;
}
.riva-snap { transition: none !important; }
.riva-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(79, 65, 40, 0.22);
}
.riva-front-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to left, rgba(50, 38, 20, 0.5), rgba(50, 38, 20, 0) 30%);
    pointer-events: none;
}
.riva-back {
    transform: rotateY(180deg);
    background:
        repeating-linear-gradient(135deg, rgba(79, 65, 40, 0.03) 0 6px, rgba(79, 65, 40, 0) 6px 12px),
        linear-gradient(160deg, #f2ebd9, #e6dcc4);
    display: flex;
    align-items: center;
    justify-content: center;
}
.riva-paper {
    font-family: var(--font-display);
    font-size: 26px;
    letter-spacing: 0.35em;
    color: rgba(79, 65, 40, 0.18);
    text-indent: 0.35em;
}

/* Controls */
.riva-book-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 16px;
}
.riva-book-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0 0 2px;
    border-radius: 50%;
    border: 1px solid var(--riva-ink);
    background: transparent;
    color: var(--riva-ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.riva-book-controls button:hover:not(:disabled) { background: var(--riva-ink); color: var(--riva-ivory); }
.riva-book-controls button:active:not(:disabled) { transform: scale(0.92); }
.riva-book-controls button:disabled { opacity: 0.28; cursor: default; }
.riva-book-count { color: var(--riva-ink-soft); font-size: 14px; min-width: 58px; text-align: center; }

/* CTA */
.riva-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 30px;
    border-radius: 999px;
    background: var(--riva-clay);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(180, 101, 63, 0.35);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.riva-cta:hover { background: var(--riva-clay-deep); transform: translateY(-2px); box-shadow: 0 14px 28px rgba(156, 84, 51, 0.4); }
.riva-cta:active { transform: scale(0.97); }

/* Facts */
.riva-facts { margin: 6px 0 14px; }
.riva-fact {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid var(--riva-hairline);
    font-size: 15px;
}
.riva-fact b { font-weight: 600; text-align: right; }
.riva-fact span { color: var(--riva-ink-soft); }

.riva-links a { color: var(--riva-clay); text-decoration: none; font-weight: 600; }
.riva-links a:hover { text-decoration: underline; }

.riva-closing {
    margin-top: 44px;
    padding-top: 16px;
    border-top: 1px solid var(--riva-hairline);
    font-size: 13px;
    color: var(--riva-ink-soft);
}

/* Item lists */
.riva-items { margin: 18px 0 8px; }
.riva-cat { border: 1px solid var(--riva-hairline); border-radius: 14px; margin: 10px 0; background: #fffdf7; overflow: hidden; }
.riva-cat summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; cursor: pointer; list-style: none;
    font-family: var(--font-display); font-size: 18px; font-weight: 600;
}
.riva-cat summary::-webkit-details-marker { display: none; }
.riva-cat summary::after { content: '+'; font-family: var(--font-text); color: var(--riva-clay); font-size: 20px; }
.riva-cat[open] summary::after { content: '−'; }
.riva-cat-n { font-family: var(--font-text); font-size: 12px; color: var(--riva-ink-soft); font-weight: 400; margin-left: auto; margin-right: 10px; }
.riva-cat-list { padding: 4px 12px 12px; }
.riva-item { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-top: 1px solid var(--riva-hairline); }
.riva-item-img {
    width: 44px; height: 44px; border-radius: 10px; flex: none; overflow: hidden;
    background: linear-gradient(150deg, var(--riva-paper), #e2d5ba);
    display: flex; align-items: center; justify-content: center;
}
.riva-item-img img { width: 100%; height: 100%; object-fit: cover; }
.riva-item-img b { font-family: var(--font-display); color: var(--riva-clay); font-size: 19px; }
.riva-item-mid { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.riva-item-mid b { font-weight: 600; font-size: 15px; }
.riva-item-mid i { font-style: normal; font-size: 13px; color: var(--riva-ink-soft); }
.riva-add {
    width: 40px; height: 40px; flex: none; border-radius: 50%;
    border: 1.5px solid var(--riva-clay); background: transparent; color: var(--riva-clay);
    font-size: 21px; line-height: 1; cursor: pointer; font-family: inherit;
    transition: transform 0.15s, background 0.2s, color 0.2s;
}
.riva-add:hover { background: var(--riva-clay); color: #fff; }
.riva-add-hit { animation: riva-pop 0.35s ease; }
@keyframes riva-pop { 40% { transform: scale(1.25); background: var(--riva-clay); color: #fff; } }

/* Cart bar */
.riva-cartbar {
    position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 90px);
    z-index: 40; display: flex; align-items: center; gap: 16px;
    min-height: 54px; padding: 0 20px; border: none; border-radius: 999px;
    background: var(--riva-ink); color: var(--riva-ivory);
    font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
    box-shadow: 0 14px 34px rgba(50, 38, 20, 0.45);
    transition: transform 0.35s cubic-bezier(0.2, 0.6, 0.2, 1);
    white-space: nowrap;
}
.riva-cartbar-on { transform: translate(-50%, 0); }
.riva-cartbar-left { display: flex; align-items: center; gap: 9px; }
.riva-cartbadge {
    min-width: 24px; height: 24px; border-radius: 999px; background: var(--riva-clay);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; padding: 0 6px;
}
.riva-cartbar-view { color: var(--riva-sage); }

/* Cart sheet */
.riva-noscroll { overflow: hidden; }
.riva-overlay {
    position: fixed; inset: 0; z-index: 50; background: rgba(50, 38, 20, 0.5);
    display: flex; align-items: flex-end; justify-content: center;
    animation: riva-fade 0.25s ease both;
}
@keyframes riva-fade { from { opacity: 0; } }
.riva-sheet {
    width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto;
    background: var(--riva-ivory); border-radius: 22px 22px 0 0; padding: 18px 20px 26px;
    animation: riva-sheet-in 0.32s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
@keyframes riva-sheet-in { from { transform: translateY(60px); opacity: 0.4; } }
.riva-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.riva-sheet-head h3 { font-family: var(--font-display); font-size: 22px; margin: 4px 0 10px; }
.riva-sheet-x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--riva-hairline); background: #fff; font-size: 19px; cursor: pointer; color: var(--riva-ink); }
.riva-cartrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--riva-hairline); font-size: 14px; }
.riva-cartrow b { flex: 1; font-weight: 600; }
.riva-cartrow > span { color: var(--riva-ink-soft); }
.riva-step { display: flex; align-items: center; gap: 8px; }
.riva-step button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--riva-ink); background: transparent; color: var(--riva-ink); font-size: 16px; cursor: pointer; line-height: 1; }
.riva-step i { font-style: normal; min-width: 18px; text-align: center; font-weight: 600; }
.riva-cartform { margin-top: 14px; }
.riva-cartform label { display: block; font-size: 13px; font-weight: 600; color: var(--riva-ink-soft); margin: 10px 0 0; }
.riva-cartform input {
    width: 100%; box-sizing: border-box; margin-top: 4px; font: inherit; color: var(--riva-ink);
    background: #fff; border: 1px solid var(--riva-hairline); border-radius: 10px; padding: 11px 12px;
}
.riva-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.riva-sheet-foot b { font-size: 18px; }
.riva-send { border: none; cursor: pointer; font-family: inherit; }
.riva-send:disabled { opacity: 0.55; cursor: default; }
.riva-cart-status { min-height: 20px; font-size: 14px; color: var(--riva-ink-soft); margin: 10px 0 0; }
.riva-cart-ok { color: #3c7a3c; font-weight: 600; }
