/* ============================================================================
   VerseGuard — Legal documents
   Concept: "front matter of a finely typeset edition."
   Letterpress / liturgical. Paper grain, wax-seal masthead, hung section
   numbers, a contents page with leader dots, a drop-capped opening, a colophon.
   Shared by privacy.html, terms.html, and faq.html.
   ========================================================================== */

:root {
    --page: #efece5;
    --paper: #f6efe2;
    --paper-deep: #ece4d2;
    --ink: #1a1c1c;
    --ink-warm: #2b2620;
    --body: #3a342d;
    --sub: #5d5c5b;
    --muted: #8c857b;
    --red: #b7131a;
    --red-deep: #8a0c12;
    --gold: #c9a36a;
    --gold-glint: #f1d58b;
    --hair: rgba(159, 128, 92, 0.30);
    --hair-soft: rgba(159, 128, 92, 0.16);

    --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --body-font: "Newsreader", "Iowan Old Style", Palatino, Georgia, serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    font-optical-sizing: auto;
    background-color: var(--page);
    color: var(--body);
    font-size: 19px;
    line-height: 1.72;
    letter-spacing: 0.002em;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Paper atmosphere — grain + warm top light + base vignette, fixed behind all */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.045;
    mix-blend-mode: multiply;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(125% 75% at 50% -12%, rgba(255, 251, 242, 0.7), transparent 58%),
        radial-gradient(150% 130% at 50% 125%, rgba(120, 90, 50, 0.10), transparent 55%);
}

/* Reading progress hairline */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--red), var(--red-deep));
    z-index: 60;
    transition: width 0.08s linear;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 70;
    background: var(--ink);
    color: var(--paper);
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ----------------------------------------------------------- Masthead */
.masthead {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    margin: 0 auto;
    padding: 30px 30px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
    color: var(--ink);
}
.brand img {
    width: 40px;
    height: 40px;
    display: block;
    filter: drop-shadow(0 1px 1.5px rgba(70, 30, 20, 0.18));
}
.colophon-seal {
    width: 46px;
    height: 46px;
    display: block;
    margin: 0 auto 18px;
    opacity: 0.94;
}
.wordmark {
    font-family: var(--display);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.005em;
}

.masthead-nav {
    display: flex;
    gap: 24px;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.masthead-nav a {
    color: var(--muted);
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 1.5px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.masthead-nav a:hover { color: var(--ink); }
.masthead-nav a[aria-current="page"] {
    color: var(--red);
    border-color: var(--red);
}

/* ----------------------------------------------------------- Document */
.doc {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 30px 40px;
}

.kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--red);
    margin-bottom: 22px;
}

.doc-head {
    position: relative;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--ink);
}
.doc-head::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1px;
    background: var(--gold);
}

.doc-title {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(2.6rem, 7vw, 4rem);
    line-height: 1.0;
    letter-spacing: -0.022em;
    color: var(--ink);
}
.doc-sub {
    font-family: var(--display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.15rem, 3.2vw, 1.5rem);
    line-height: 1.35;
    color: var(--sub);
    margin-top: 16px;
    max-width: 30ch;
}
.edition-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 13px;
    margin-top: 26px;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}
.edition-line .dot { color: var(--gold); }

/* ----------------------------------------------------------- Contents */
.toc {
    margin: 40px 0 8px;
}
.toc-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.26em;
    color: var(--muted);
    margin-bottom: 12px;
}
.toc ol {
    list-style: none;
}
.toc a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-decoration: none;
    color: var(--ink-warm);
    padding: 9px 0;
    border-bottom: 1px solid var(--hair-soft);
    transition: color 0.18s;
}
.toc a:hover,
.toc a:hover .toc-no,
.toc a.active,
.toc a.active .toc-no { color: var(--red); }
.toc-text {
    font-family: var(--display);
    font-weight: 400;
    font-size: 1.05rem;
}
.toc-dots {
    flex: 1;
    align-self: center;
    border-bottom: 1.5px dotted var(--hair);
}
.toc-no {
    font-family: var(--display);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    transition: color 0.18s;
}

/* ----------------------------------------------------------- Prose */
.prose { margin-top: 48px; }

.sec {
    margin-bottom: 42px;
    scroll-margin-top: 90px;
}
.sec-h {
    font-family: var(--display);
    font-weight: 500;
    font-size: 1.62rem;
    line-height: 1.18;
    letter-spacing: -0.012em;
    color: var(--ink);
    margin-bottom: 14px;
    position: relative;
}
.sec-no {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--red);
    letter-spacing: 0.1em;
    vertical-align: 0.35em;
    margin-right: 0.55em;
}

.prose p { margin-bottom: 1.05em; }
.prose p:last-child { margin-bottom: 0; }

.prose ul {
    list-style: none;
    margin: 0 0 1.15em;
}
.prose li {
    position: relative;
    padding-left: 1.5em;
    margin-bottom: 0.55em;
}
.prose li::before {
    content: "";
    position: absolute;
    left: 0.05em;
    top: 0.66em;
    width: 6px;
    height: 6px;
    background: var(--gold);
    transform: rotate(45deg);
}

.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }

.prose a {
    color: var(--red);
    text-decoration: none;
    background-image: linear-gradient(var(--red), var(--red));
    background-size: 0% 1.5px;
    background-repeat: no-repeat;
    background-position: 0 1.05em;
    transition: background-size 0.28s ease;
}
.prose a:hover { background-size: 100% 1.5px; }

/* Chapter-opening paragraph with drop cap */
.lede {
    font-size: 1.08em;
    color: var(--ink-warm);
}
.doc > .lede {
    margin-top: 48px;
}
.lede::first-letter {
    font-family: var(--display);
    font-weight: 500;
    float: left;
    font-size: 4.1em;
    line-height: 0.76;
    padding: 0.04em 0.14em 0 0;
    color: var(--red);
}

/* ----------------------------------------------------------- FAQ accordion */
.faq {
    margin-top: 48px;
    border: 1px solid var(--hair);
    border-radius: 4px;
    background: var(--paper);
    box-shadow:
        0 1px 0 rgba(255, 251, 242, 0.6) inset,
        0 8px 28px rgba(80, 50, 20, 0.06);
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid var(--hair-soft);
    scroll-margin-top: 90px;
}
.faq-item:last-child {
    border-bottom: none;
}

.faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.18s;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::marker { content: ""; }

.faq-item[open] .faq-q,
.faq-q:hover {
    background: rgba(246, 239, 226, 0.72);
}

.faq-q-text {
    font-family: var(--display);
    font-weight: 500;
    font-size: 1.12rem;
    line-height: 1.35;
    letter-spacing: -0.008em;
    color: var(--ink);
    text-align: left;
}

.faq-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    position: relative;
    color: var(--muted);
    transition: color 0.18s, transform 0.22s;
}
.faq-icon::before,
.faq-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.22s ease, opacity 0.18s;
}
.faq-icon::before {
    width: 14px;
    height: 1.5px;
    transform: translate(-50%, -50%);
}
.faq-icon::after {
    width: 1.5px;
    height: 14px;
    transform: translate(-50%, -50%);
}
.faq-item[open] .faq-icon {
    color: var(--red);
}
.faq-item[open] .faq-icon::after {
    transform: translate(-50%, -50%) scaleY(0);
    opacity: 0;
}

.faq-a {
    padding: 0 26px 24px;
}
.faq-a p {
    font-size: 0.98rem;
    color: var(--body);
}
.faq-a p:last-child {
    margin-bottom: 0;
}

.faq-contact {
    margin-top: 36px;
    text-align: center;
    font-family: var(--display);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--sub);
}
.faq-contact a {
    color: var(--red);
    text-decoration: none;
    background-image: linear-gradient(var(--red), var(--red));
    background-size: 0% 1.5px;
    background-repeat: no-repeat;
    background-position: 0 1.05em;
    transition: background-size 0.28s ease;
}
.faq-contact a:hover {
    background-size: 100% 1.5px;
}

/* ----------------------------------------------------------- Colophon */
.colophon {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 64px auto 0;
    padding: 40px 30px 80px;
    border-top: 1px solid var(--ink);
    text-align: center;
}
/* colophon-seal sizing + filter defined with masthead seal above */
.colophon-quote {
    font-family: var(--display);
    font-style: italic;
    font-size: 1.3rem;
    color: var(--sub);
    margin-bottom: 24px;
}
.colophon-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px 18px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.colophon-nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.colophon-nav a:hover { color: var(--red); }
.set-in {
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.set-in em { font-style: italic; color: var(--sub); }

/* ----------------------------------------------------------- Back to top */
.to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--hair);
    background: var(--paper);
    color: var(--red);
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s, border-color 0.2s;
    box-shadow: 0 6px 22px rgba(80, 50, 20, 0.14);
}
.to-top.show { opacity: 1; transform: none; }
.to-top:hover { border-color: var(--red); }

/* ----------------------------------------------------------- Focus + motion */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
    border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(14px);
        animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    }
    .reveal.d1 { animation-delay: 0.06s; }
    .reveal.d2 { animation-delay: 0.14s; }
    .reveal.d3 { animation-delay: 0.22s; }
    .reveal.d4 { animation-delay: 0.30s; }
    @keyframes rise { to { opacity: 1; transform: none; } }
}

/* ----------------------------------------------------------- Responsive */
@media (min-width: 900px) {
    .doc { max-width: 786px; }
    .colophon { max-width: 786px; }
    .sec-no {
        position: absolute;
        left: -3.6rem;
        top: 0.12em;
        width: 2.8rem;
        text-align: right;
        margin: 0;
        vertical-align: baseline;
    }
}

@media (max-width: 600px) {
    body { font-size: 18px; }
    .masthead { padding: 20px 22px 0; }
    .masthead-nav { gap: 16px; }
    .doc { padding: 42px 22px 30px; }
    .colophon { padding: 36px 22px 70px; }
    .faq-q { padding: 18px 20px; }
    .faq-a { padding: 0 20px 20px; }
    .faq-q-text { font-size: 1.05rem; }
}

/* ----------------------------------------------------------- Print */
@media print {
    body { background: #fff; color: #000; font-size: 11pt; line-height: 1.5; }
    body::before, body::after, .progress, .to-top, .masthead-nav { display: none !important; }
    .masthead, .doc, .colophon { max-width: none; }
    .doc { padding-top: 12pt; }
    .prose a { color: #000; background: none; }
    .prose a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 8.5pt;
        color: #555;
    }
    .sec { break-inside: avoid; }
    .faq-item { break-inside: avoid; }
    .faq-icon { display: none !important; }
    .faq-item .faq-a { display: block !important; }
    .reveal { opacity: 1 !important; transform: none !important; animation: none !important; }
}
