:root {
  --ink: #0e0c0a; --ink2: #17140f; --bone: #e9e2d0; --dim: #a39c88; --faint: #6d6757;
  --terra: #d97757; --terra2: #ffb38f; --tube: #fffbe6; --exit: #5dff9a; --line: rgba(233, 226, 208, .14);
  --black: 'UnifrakturCook', serif; --serif: 'Cormorant Garamond', Georgia, serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; background: var(--ink); }
body { color: var(--bone); font-family: var(--mono); font-size: 14px; line-height: 1.6; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
::selection { background: var(--terra); color: var(--ink); }

#nave { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
#fade, #veil, .grain { position: fixed; inset: 0; pointer-events: none; }
#fade { background: #0b0a08; opacity: 1; }
#veil { background: var(--ink); opacity: 0; }
.grain { opacity: .13; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
.grain::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(8, 7, 5, .85) 100%); mix-blend-mode: normal; }

/* bar */
.bar { position: fixed; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 20px; padding: 12px 20px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; background: linear-gradient(rgba(10, 9, 7, .8), transparent); }
.mark { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; }
.mark img { border-radius: 50%; }
.links { display: flex; gap: 18px; margin-left: auto; }
.links a { text-decoration: none; color: var(--dim); transition: color .2s; }
.links a:hover { color: var(--terra2); }
button, .btn { font: inherit; cursor: pointer; }
.ghost, .btn.ghost { background: transparent; color: var(--bone); border: 1px solid var(--line); }
#sound { padding: 6px 10px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
#sound[aria-pressed="true"] { color: var(--terra2); border-color: var(--terra); }

/* hero */
main { position: relative; z-index: 10; pointer-events: none; }
main > * > *, footer { pointer-events: auto; }
.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between; padding: 84px 20px 22px; pointer-events: none; }
.hero-top { text-align: center; pointer-events: none !important; text-shadow: 0 2px 6px rgba(0, 0, 0, .7), 0 0 40px rgba(0, 0, 0, .8); }
.hero::before { content: ''; position: absolute; inset: 0 0 auto; height: 62svh; background: radial-gradient(ellipse 70% 60% at 50% 38%, rgba(10, 9, 7, .62), transparent 75%); pointer-events: none; z-index: -1; }
.hero-top .cta { pointer-events: auto; }
.kicker, .label { font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--terra2); }
h1 { font-family: var(--black); font-weight: 700; font-size: clamp(44px, 9.2vw, 124px); line-height: .95; margin: 14px 0 12px; letter-spacing: .01em; color: #f6efdc; }
h1 i { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .5em; color: var(--terra2); vertical-align: .22em; margin: 0 .08em; }
.lede { font-family: var(--serif); font-size: clamp(18px, 2.3vw, 26px); font-style: italic; }
.lede span { display: block; color: #d6cfbb; font-size: .82em; }
.cta { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 11px 18px; background: var(--terra); color: var(--ink); border: 1px solid var(--terra); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; transition: transform .15s, background .2s, color .2s; }
.btn:hover { background: var(--terra2); transform: translateY(-1px); }
.btn.ghost { background: rgba(14, 12, 10, .55); backdrop-filter: blur(6px); }
.btn.ghost:hover { border-color: var(--terra); color: var(--terra2); background: rgba(14, 12, 10, .7); }

.hero-bottom { pointer-events: none !important; }
.office { pointer-events: auto; width: min(520px, 100%); background: rgba(12, 10, 8, .62); backdrop-filter: blur(8px); border: 1px solid var(--line); border-left: 2px solid var(--terra); padding: 12px 14px 10px; }
.office-head { display: flex; justify-content: space-between; gap: 12px; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; }
#hourName { color: var(--terra2); font-weight: 600; }
#hourLeft { color: var(--faint); white-space: nowrap; }
.office-note { font-family: var(--serif); font-style: italic; color: var(--dim); font-size: 15px; margin: 2px 0 8px; }
#feed { list-style: none; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 172px; overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 34px); mask-image: linear-gradient(transparent, #000 34px); }
#feed li { font-family: var(--serif); font-size: 17px; line-height: 1.28; padding: 3px 0; animation: rise .9s ease both; color: #cfc8b4; }
#feed li:last-child { color: #fff7e6; }
#feed .who { font-family: var(--mono); font-size: 11px; color: var(--terra2); letter-spacing: .08em; margin-right: 6px; cursor: pointer; }
#feed .who.all { color: var(--dim); cursor: default; }
#feed .sym { color: var(--terra); margin-right: 4px; }
#feed li.rubric { color: var(--terra); font-style: italic; font-size: 15px; }
#feed li.mine .who { background: var(--terra); color: var(--ink); padding: 0 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.hint { font-size: 10px; letter-spacing: .1em; color: rgba(233, 226, 208, .55); margin-top: 8px; text-shadow: 0 1px 8px #000; }

/* panels */
.panel { width: min(1040px, calc(100% - 32px)); margin: 0 auto 28px; padding: clamp(24px, 4.5vw, 56px); background: rgba(14, 12, 10, .88); backdrop-filter: blur(10px); border: 1px solid var(--line); }
.panel.narrow { width: min(760px, calc(100% - 32px)); }
.panel:first-of-type { margin-top: 12vh; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4.4vw, 50px); line-height: 1.05; margin: 10px 0 14px; color: #f6efdc; }
.sub { color: var(--dim); max-width: 62ch; margin-bottom: 20px; }
.prose p { font-family: var(--serif); font-size: clamp(18px, 1.9vw, 22px); line-height: 1.5; margin: 0 0 14px; max-width: 60ch; color: #ddd6c2; }
.prose em { color: var(--terra2); }
.say { font-family: var(--serif); font-style: italic; color: var(--terra2); }
blockquote { font-family: var(--serif); font-size: clamp(26px, 3.8vw, 42px); line-height: 1.12; margin: 16px 0 10px; color: #fff7e6; }
blockquote::before { content: 'JUST IN — '; font-family: var(--mono); font-size: .32em; letter-spacing: .2em; color: var(--terra); vertical-align: .5em; }
.cite { color: var(--faint); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 26px; }
.exit { font-family: Arial, sans-serif; font-weight: 700; font-size: .8em; letter-spacing: .06em; color: var(--exit); background: #06210f; padding: 1px 6px; box-shadow: 0 0 14px rgba(93, 255, 154, .35); }

/* canon */
.books { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 22px; }
.books button { background: transparent; color: var(--dim); border: 1px solid var(--line); padding: 8px 12px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.books button.read { color: var(--bone); }
.books button[aria-selected="true"] { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.book h3 { font-family: var(--black); font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; color: var(--terra2); line-height: 1.1; }
.book .bsub { color: var(--faint); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 18px; }
.book ol { list-style: none; padding: 0; columns: 2; column-gap: 44px; }
.book li { font-family: var(--serif); font-size: 19.5px; line-height: 1.42; margin-bottom: 12px; break-inside: avoid; color: #e2dbc7; animation: rise .6s ease both; }
.book li sup { font-family: var(--mono); font-size: 10px; color: var(--terra); margin-right: 6px; }
.book li:first-child::first-letter { font-family: var(--black); font-size: 3em; float: left; line-height: .82; padding: 5px 8px 0 0; color: var(--terra); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.sacraments, .instructions { padding: 0; margin-top: 16px; list-style: none; counter-reset: n; }
.sacraments li, .instructions li { counter-increment: n; position: relative; padding: 10px 0 10px 40px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 18px; line-height: 1.35; color: #d8d1bd; }
.sacraments li::before, .instructions li::before { content: counter(n, upper-roman); position: absolute; left: 0; top: 13px; font-family: var(--mono); font-size: 11px; color: var(--terra); }
.sacraments b { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--bone); font-weight: 600; }

/* forms */
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
input, textarea { font: inherit; background: rgba(233, 226, 208, .05); color: var(--bone); border: 1px solid var(--line); padding: 11px 13px; outline: none; border-radius: 0; }
input:focus, textarea:focus { border-color: var(--terra); }
#seatInput { width: 116px; font-size: 20px; letter-spacing: .24em; text-align: center; }
#nameInput { flex: 1; min-width: 200px; }
textarea { width: 100%; resize: vertical; margin-bottom: 10px; font-family: var(--serif); font-size: 18px; }
#absolution { font-size: 23px; line-height: 1.3; margin-top: 18px; min-height: 1.4em; }

/* parish record: an index card under tube light */
.record { position: relative; background: #ebe4cf; color: #1a1712; padding: 22px 24px 20px; max-width: 720px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); animation: rise .5s ease both; overflow: hidden;
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(40, 60, 90, .13) 27px 28px); }
.record::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--terra); }
.record .top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-bottom: 2px solid #1a1712; padding-bottom: 6px; margin-bottom: 10px; }
.record .num { font-size: 46px; font-weight: 600; letter-spacing: .1em; line-height: 1; }
.record .ttl { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; }
.record dl { display: grid; grid-template-columns: 184px 1fr; font-size: 13px; line-height: 28px; }
.record dt { color: #6b6454; text-transform: uppercase; font-size: 10px; letter-spacing: .14em; }
.record dd { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record .note { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 28px; margin-top: 0; color: #3a3427; }
.record .stamp { position: absolute; right: 18px; top: 74px; transform: rotate(-9deg); border: 3px double #b3472a; color: #b3472a; padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; opacity: .8; mix-blend-mode: multiply; max-width: 46%; text-align: center; }
.record .links { margin: 10px 0 0; display: flex; gap: 14px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.record .links a { color: #8a3a22; cursor: pointer; text-decoration: underline; }

#card { width: 100%; max-width: 720px; height: auto; display: block; margin-top: 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.deg-label { margin-top: 34px; }
.degrees { list-style: none; padding: 0; margin-top: 12px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.degrees li { border: 1px solid var(--line); padding: 10px 9px; font-size: 10px; line-height: 1.35; color: var(--faint); min-height: 104px; }
.degrees li b { display: block; color: var(--dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin: 3px 0 5px; }
.degrees li.done { border-color: var(--terra); color: var(--bone); background: rgba(217, 119, 87, .12); }
.degrees li.done b { color: var(--terra2); }
.degrees li i { font-style: normal; color: var(--terra); }

.ca { display: flex; border: 1px solid var(--line); margin: 14px 0; }
.ca code { flex: 1; padding: 12px; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.ca button { border: 0; border-left: 1px solid var(--line); }
.pending { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--dim); border: 1px dashed var(--line); padding: 18px; }

footer { width: min(760px, calc(100% - 32px)); margin: 60px auto 0; padding: 0 0 70px; color: var(--faint); font-size: 11.5px; line-height: 1.7; }
footer b { color: var(--dim); }
.exit-line { text-align: center; margin-top: 34px; font-size: 22px; }

dialog { margin: auto; border: 0; padding: 0; background: transparent; max-width: min(760px, calc(100vw - 24px)); width: 100%; overflow: visible; }
dialog::backdrop { background: rgba(8, 7, 5, .72); backdrop-filter: blur(4px); }
dialog .close { position: absolute; right: 8px; top: 10px; z-index: 2; background: none; border: 0; font-size: 26px; color: #1a1712; line-height: 1; outline: none; }

@media (max-width: 820px) {
  .links { display: none; } .bar { justify-content: space-between; }
  .split { grid-template-columns: 1fr; gap: 28px; } .book ol { columns: 1; }
  .degrees { grid-template-columns: repeat(2, 1fr); } .degrees li { min-height: 0; }
  .record dl { grid-template-columns: 132px 1fr; font-size: 12px; } .record dt { font-size: 9px; letter-spacing: .08em; } .record .num { font-size: 38px; }
 
  #feed { height: 150px; } #feed li { font-size: 15.5px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } #feed li, .book li, .record { animation: none; } }

/* sacristy: presence, arrivals, wallet, mysteries */
#present { color: var(--terra2); font-family: var(--mono); font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; margin-left: 6px; white-space: nowrap; }
.mysteries { margin-top: 12px; font-size: 11px; color: var(--faint); }
.mysteries .pips { color: var(--terra); letter-spacing: .2em; margin-right: 8px; }
.mysteries b { color: var(--terra2); margin-left: 8px; font-weight: 600; }
.books button.sealed { border-style: dashed; color: var(--faint); }
.books button.sealed.open { color: var(--terra2); border-color: var(--terra); border-style: solid; }
.seal { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--dim); border: 1px dashed var(--line); padding: 22px; max-width: 60ch; }
.tally { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0 30px; }
.tally div { border: 1px solid var(--line); padding: 14px 12px; }
.tally b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3.4vw, 42px); line-height: 1; color: #fff7e6; }
.tally span { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.tally div:last-child b { color: var(--terra2); }
.ledger, .chronicle { list-style: none; padding: 0; margin-top: 10px; }
.ledger li { display: grid; grid-template-columns: 52px 1fr 40px 96px 30px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.ledger li.none { display: block; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--faint); }
.ledger a { color: var(--terra2); font-weight: 600; letter-spacing: .08em; cursor: pointer; }
.ledger a:hover { text-decoration: underline; }
.ledger .bar { height: 3px; background: var(--line); } .ledger .bar i { display: block; height: 100%; background: var(--terra); }
.ledger .d, .ledger .s { color: var(--faint); font-size: 10.5px; text-align: right; }
.ledger .t { color: var(--dim); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chron-label { margin-top: 30px; }
.chronicle li { font-family: var(--serif); font-size: 17px; color: #cfc8b4; padding: 3px 0; }
.chronicle li span { display: inline-block; width: 44px; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.proof { margin-top: 22px; border: 1px solid var(--line); border-left: 2px solid var(--terra); padding: 18px 18px 8px; }
.proof .sub { margin: 8px 0 4px; } .proof .sub b { color: var(--bone); } .proof a { color: var(--terra2); }
.proof .standing { font-family: var(--black); font-size: 34px; color: var(--terra2); line-height: 1.1; margin-top: 4px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.record.human::before { background: #1a1712; height: 8px; }
button.exit { border: 0; font-size: 22px; cursor: pointer; }
#toast { position: fixed; z-index: 60; left: 50%; bottom: 26px; transform: translate(-50%, 20px); width: min(560px, calc(100% - 32px)); background: #ebe4cf; color: #1a1712; padding: 14px 18px; font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.3; border-top: 4px solid var(--terra); box-shadow: 0 18px 50px rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 820px) { .tally { grid-template-columns: repeat(2, 1fr); } .ledger li { grid-template-columns: 46px 1fr 36px 28px; } .ledger .t { display: none; } }
