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

:root {
    --desk: #221a13;
    --desk-hi: #35291d;
    --parchment: #e9dcbc;
    --parchment-hi: #f3ead2;
    --parchment-lo: #d3bf94;
    --parchment-edge: #b89e6e;
    --ink: #33261a;
    --ink-soft: #6b573f;
    --wax: #7e2a20;
    --wax-hi: #9a382a;
    --gold: #97783f;
    --serif: 'IM Fell English', 'Iowan Old Style', 'Palatino', Georgia, serif;
    --serif-sc: 'IM Fell English SC', 'Iowan Old Style', 'Palatino', Georgia, serif;
}

body {
    font-family: var(--serif);
    background:
        radial-gradient(ellipse 120% 90% at 50% 0%, var(--desk-hi) 0%, var(--desk) 60%),
        var(--desk);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
}

.container {
    width: min(660px, 96vw);
    position: relative;
}

/* ---- Scroll rods (rolled ends) ---- */
.container::before,
.container::after {
    content: '';
    display: block;
    height: 30px;
    border-radius: 15px;
    background:
        linear-gradient(180deg,
            #8a6a42 0%, #c8a76e 22%, #f0dcae 45%,
            #a9835a 75%, #5e4227 100%);
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.55),
        inset -14px 0 18px -8px rgba(46, 30, 14, 0.8),
        inset 14px 0 18px -8px rgba(46, 30, 14, 0.8);
    position: relative;
    z-index: 2;
}

.container::before {
    margin-bottom: -12px;
}

.container::after {
    margin-top: -12px;
}

/* ---- Parchment sheet ---- */
.scroll-sheet {
    position: relative;
    z-index: 1;
    margin: 0 14px;
    background:
        radial-gradient(ellipse 90% 30% at 20% 8%, rgba(184, 158, 110, 0.18), transparent 70%),
        radial-gradient(ellipse 60% 25% at 85% 80%, rgba(184, 158, 110, 0.22), transparent 70%),
        linear-gradient(90deg,
            var(--parchment-lo) 0%, var(--parchment) 6%,
            var(--parchment-hi) 50%,
            var(--parchment) 94%, var(--parchment-lo) 100%),
        var(--parchment);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.6),
        inset 0 14px 22px -14px rgba(46, 30, 14, 0.55),
        inset 0 -14px 22px -14px rgba(46, 30, 14, 0.55);
    overflow: hidden;
}

/* parchment grain */
.scroll-sheet::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.36 0 0 0 0 0.22 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23p)'/%3E%3C/svg%3E");
}

/* unroll on load */
@keyframes unroll {
    from { clip-path: inset(0 0 96% 0); }
    to   { clip-path: inset(0 0 0 0); }
}

.scroll-sheet {
    animation: unroll 0.9s cubic-bezier(0.25, 0.7, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    .scroll-sheet {
        animation: none;
    }
}

/* ---- Header ---- */
header {
    text-align: center;
    padding: 46px 30px 0;
    position: relative;
}

header h1 {
    font-family: var(--serif-sc);
    font-weight: 400;
    font-size: clamp(2.1rem, 7vw, 2.9rem);
    letter-spacing: 0.14em;
    color: var(--ink);
}

.tagline {
    font-style: italic;
    font-size: 1.02rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

/* gilt ornament rule */
header::after {
    content: '❦';
    display: block;
    color: var(--gold);
    font-size: 1.1rem;
    margin: 20px auto 0;
    line-height: 1;
    background:
        linear-gradient(var(--gold), var(--gold)) no-repeat left 52% / 34% 1px,
        linear-gradient(var(--gold), var(--gold)) no-repeat right 52% / 34% 1px;
}

main {
    padding: 30px 34px 40px;
}

/* ---- Quote ---- */
.quote-container {
    padding: 26px 6px 30px;
    text-align: center;
}

#quote-text {
    font-style: italic;
    font-size: clamp(1.35rem, 4.5vw, 1.7rem);
    line-height: 1.65;
    color: var(--ink);
    quotes: '\201C' '\201D';
}

#quote-author {
    display: inline-block;
    margin-top: 22px;
    font-family: var(--serif-sc);
    font-style: normal;
    font-size: 1rem;
    letter-spacing: 0.22em;
    color: var(--ink-soft);
    padding-top: 10px;
    background: linear-gradient(var(--gold), var(--gold)) no-repeat top center / 46px 1px;
}

/* ---- Actions ---- */
.action-section {
    text-align: center;
    margin-top: 6px;
}

.btn-primary,
.btn-secondary {
    font-family: var(--serif-sc);
    font-size: 1.02rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* wax-seal button */
.btn-primary {
    border: none;
    color: #f3e4cf;
    background:
        radial-gradient(circle at 32% 28%, var(--wax-hi), var(--wax) 55%, #5c1d15 100%);
    padding: 16px 34px;
    border-radius: 40px / 34px;
    box-shadow:
        0 4px 10px rgba(46, 30, 14, 0.45),
        inset 0 2px 3px rgba(255, 230, 200, 0.35),
        inset 0 -3px 6px rgba(40, 8, 4, 0.55);
    max-width: 320px;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 7px 16px rgba(46, 30, 14, 0.5),
        inset 0 2px 3px rgba(255, 230, 200, 0.35),
        inset 0 -3px 6px rgba(40, 8, 4, 0.55);
}

.btn-primary:disabled {
    background: radial-gradient(circle at 32% 28%, #8d7d64, #6f6350 60%, #55493a 100%);
    cursor: not-allowed;
    transform: none;
}

/* inked-underline button */
.btn-secondary {
    display: block;
    margin: 30px auto 0;
    background: transparent;
    border: none;
    color: var(--ink);
    padding: 6px 4px;
    background:
        linear-gradient(var(--ink-soft), var(--ink-soft)) no-repeat bottom center / 100% 1px;
}

.btn-secondary:hover {
    color: var(--wax);
    background:
        linear-gradient(var(--wax), var(--wax)) no-repeat bottom center / 100% 2px;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.install-prompt button:focus-visible {
    outline: 2px dashed var(--wax);
    outline-offset: 3px;
}

.status-text {
    margin-top: 14px;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-soft);
    min-height: 1.2em;
}

/* Ad slot styled as a framed notice pinned to the parchment */
.ad-container {
    margin: 30px 0 0;
    padding: 10px;
    border: 1px solid var(--parchment-edge);
    outline: 1px solid var(--parchment-edge);
    outline-offset: 3px;
    background: rgba(184, 158, 110, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}

.ad-container:empty {
    display: none;
}

/* ---- Colophon ---- */
footer {
    text-align: center;
    padding: 0 30px 40px;
    font-family: var(--serif-sc);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: var(--ink-soft);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    main {
        padding: 22px 22px 32px;
    }

    header {
        padding-top: 38px;
    }
}

/* ---- PWA install prompt: a parchment slip ---- */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background:
        linear-gradient(90deg, var(--parchment-lo), var(--parchment-hi) 50%, var(--parchment-lo));
    color: var(--ink);
    font-family: var(--serif);
    font-style: italic;
    padding: 14px 22px;
    border: 1px solid var(--parchment-edge);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    gap: 14px;
    z-index: 1000;
    max-width: 94vw;
}

.install-prompt.show {
    display: flex;
}

.install-prompt span {
    white-space: nowrap;
}

.install-prompt button {
    font-family: var(--serif-sc);
    font-style: normal;
    letter-spacing: 0.08em;
    background: radial-gradient(circle at 32% 28%, var(--wax-hi), var(--wax) 60%, #5c1d15 100%);
    color: #f3e4cf;
    border: none;
    padding: 8px 18px;
    border-radius: 24px / 20px;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(255, 230, 200, 0.3), inset 0 -2px 4px rgba(40, 8, 4, 0.5);
}

.install-prompt button#dismiss-btn {
    background: transparent !important;
    color: var(--ink-soft) !important;
    box-shadow: none;
}
