/* danielpolice.essexchurches.info – the wall paintings of Romanesque churches, by Daniel Police.
   Colours borrow from the pigments he wrote about: red ochre, lapis blue, parchment. */

@font-face {
    font-family: "Source Serif";
    src: url("fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
    font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Source Serif";
    src: url("fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
    font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
    font-family: "Source Serif";
    src: url("fonts/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2");
    font-weight: 200 900; font-style: normal; font-display: swap;
    unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
    color-scheme: light;
    --bg: #f7f3ea;
    --paper: #fffdf8;
    --ink: #2b2420;
    --ink-2: #5a4f46;
    --ink-3: #7a6e63;
    --rule: #e3dacb;
    --ochre: #9a3324;      /* red ochre: headings, accents */
    --lapis: #23407a;      /* lapis lazuli: links */
    --lapis-hover: #152a55;
    --gold: #b0892f;
    --shadow: 0 1px 2px rgb(43 36 32 / .06), 0 6px 20px rgb(43 36 32 / .07);
    --serif: "Source Serif", Georgia, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --measure: 42rem;
    --wide: 72rem;
}
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #1b1714;
        --paper: #231e1a;
        --ink: #ece4d6;
        --ink-2: #c9bfb0;
        --ink-3: #a3988a;
        --rule: #3a322b;
        --ochre: #e08a6f;
        --lapis: #9db8ec;
        --lapis-hover: #c3d4f5;
        --gold: #d8b45a;
        --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .3);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 400 1.125rem/1.65 var(--serif); font-optical-sizing: auto;
    text-rendering: optimizeLegibility; font-kerning: normal;
}
img { max-width: 100%; height: auto; }
a { color: var(--lapis); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--lapis-hover); }
sup { font-size: .62em; line-height: 0; vertical-align: .5em; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 2px; border-radius: 2px; }
/* Anything marked hidden stays hidden, whatever its own display style (the glossary entries are grids). */
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* ------------------------------------------------------------------ header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.header-inner { max-width: var(--wide); margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); line-height: 1.15; margin-right: auto; }
.brand-title { font-size: 1.15rem; font-weight: 600; letter-spacing: .01em; }
.brand-sub { font: 500 .78rem/1.3 var(--sans); color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.main-nav { display: flex; gap: .2rem 1.1rem; flex-wrap: wrap; font: 500 .92rem/1.4 var(--sans); }
.main-nav a { color: var(--ink-2); text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ochre); }
.lang-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; font: 600 .8rem/1 var(--sans); }
.lang-switch a, .lang-switch span { padding: .42rem .7rem; text-decoration: none; color: var(--ink-2); letter-spacing: .05em; }
.lang-switch [aria-current="true"] { background: var(--ink); color: var(--bg); }
@media (max-width: 720px) {
    .header-inner { gap: .5rem .9rem; }
    .main-nav { order: 3; width: 100%; overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: .1rem; }
}

/* ------------------------------------------------------------------ layout */
main { display: block; }
.page { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.page-wide { max-width: var(--wide); }
.crumbs { font: 500 .85rem/1.4 var(--sans); color: var(--ink-3); margin: 0 0 1.25rem; }
.crumbs a { color: var(--ink-3); }
h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.6rem + 2vw, 2.9rem); margin: 0 0 .35rem; }
.lede { font-size: 1.25rem; color: var(--ink-2); margin: 0 0 2rem; }
.page-meta { font: 500 .95rem/1.5 var(--sans); color: var(--ink-3); margin: 0 0 2rem; }
.page-meta .church { display: block; font: italic 400 1.35rem/1.35 var(--serif); color: var(--ink-2); margin-bottom: .35rem; }

/* Daniel's section headings were written in capitals: shown as quiet small headings. */
.section-heading { font: 600 .95rem/1.4 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ochre);
    margin: 2.75rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.prose p { margin: 0 0 1.1em; }
.untranslated { position: relative; }
.untranslated-note { display: block; font: italic 400 .8rem/1.4 var(--sans); color: var(--ink-3); margin-bottom: .25rem; }

/* ------------------------------------------------------------------ photos (shown at their true size, never enlarged) */
.figures { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1.5rem 1.25rem; margin: 1.75rem 0 2rem; }
.page:not(.page-wide) .figures { margin-inline: calc(50% - min(50vw, 36rem) + 1.25rem); }
.figure { margin: 0; flex: 0 1 auto; max-width: 100%; text-align: center; }
.figure a { display: inline-block; line-height: 0; border-radius: 3px; box-shadow: var(--shadow); cursor: zoom-in; }
.figure img { border-radius: 3px; background: var(--rule); }
.figure figcaption { font: italic 400 .95rem/1.45 var(--serif); color: var(--ink-2); margin: .6rem auto 0; max-width: 32rem; text-wrap: pretty; }
.figures-caption { flex-basis: 100%; text-align: center; font: italic 400 .95rem/1.45 var(--serif); color: var(--ink-2); margin: -.75rem 0 0; }

/* ------------------------------------------------------------------ home */
.hero { text-align: center; padding: 3.5rem 1.25rem 2rem; max-width: 52rem; margin: 0 auto; }
.hero img { border-radius: 4px; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.hero h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.1rem); }
.hero .byline { font: italic 400 1.2rem/1.4 var(--serif); color: var(--ink-2); margin: .5rem 0 1.5rem; }
.hero .intro { font-size: 1.15rem; color: var(--ink-2); max-width: 40rem; margin: 0 auto; }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin: 2rem 0 3rem; }
.tile { display: block; padding: 1.1rem 1.25rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--ochre); color: var(--ink); }
.tile strong { display: block; font-size: 1.1rem; }
.tile span { font: 400 .9rem/1.45 var(--sans); color: var(--ink-3); }
.region { margin: 2.5rem 0 0; }
.region h2 { font-size: 1.5rem; margin: 0 0 .25rem; color: var(--ochre); }
.dept { margin: 1.25rem 0 0; }
.dept h3 { font: 600 .85rem/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 .5rem; }
.church-list { list-style: none; margin: 0; padding: 0; columns: 15rem auto; column-gap: 2rem; }
.church-list li { break-inside: avoid; padding: .2rem 0; }
.church-list small { color: var(--ink-3); font-family: var(--sans); font-size: .8rem; }

/* ------------------------------------------------------------------ glossary */
.glossary-tools { position: sticky; top: 4.2rem; background: var(--bg); padding: .75rem 0; z-index: 2; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; }
.glossary-tools input { width: 100%; font: 400 1.05rem/1.4 var(--sans); padding: .65rem .9rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); }
.letters { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font: 600 .9rem/1.6 var(--sans); margin-top: .6rem; }
.letters a { text-decoration: none; }
.entry { padding: 1rem 0; border-bottom: 1px solid var(--rule); display: grid; gap: .25rem 2rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .entry { grid-template-columns: 1fr 1fr; } }
.entry .term { font-weight: 650; }
.entry .other { color: var(--ink-2); }
.entry .other .term { font-weight: 600; font-style: italic; }
.entry .figures { grid-column: 1 / -1; margin: .75rem 0 .25rem; }
.entry .legend { grid-column: 1 / -1; font: 400 .9rem/1.6 var(--sans); color: var(--ink-2); white-space: pre-line; }
.letter-heading { font-size: 1.6rem; color: var(--ochre); margin: 2rem 0 .25rem; }

/* ------------------------------------------------------------------ maps */
.big-map { height: min(72vh, 46rem); min-height: 22rem; border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); background: var(--rule); margin: 1rem 0; }
.map-note { font: 400 .85rem/1.5 var(--sans); color: var(--ink-3); margin: .5rem 0; }
.where-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 720px) { .where-grid { grid-template-columns: 3fr 2fr; } }
.mini-map { height: 18rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--rule); }
.nearby { margin: 0; padding-left: 1.4rem; font-size: 1rem; }
.nearby li { padding: .2rem 0; }
.nearby small { font-family: var(--sans); color: var(--ink-3); font-size: .8rem; }
.where-links { font: 400 .9rem/1.5 var(--sans); margin: .75rem 0 0; }
.leaflet-container { font: 400 .9rem/1.4 var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: .7rem .8rem; }
.map-popup { display: flex; flex-direction: column; gap: .15rem; min-width: 9rem; }
.map-popup a { text-decoration: none; color: var(--lapis); }
.map-popup img { display: block; width: 100%; max-height: 9rem; object-fit: cover; border-radius: 3px; margin-bottom: .4rem; }
.map-popup strong { font: 600 1rem/1.3 var(--serif); }
.map-popup span { color: var(--ink-3); font-size: .82rem; }
.leaflet-tooltip { font: 500 .8rem/1.3 var(--sans); }

/* ------------------------------------------------------------------ footer and notices */
.notice { background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--gold); border-radius: 6px; padding: 1rem 1.25rem; margin: 2rem 0; font-size: 1rem; }
.lang-hint { background: var(--paper); border-bottom: 1px solid var(--rule); font: 500 .9rem/1.4 var(--sans); text-align: center; padding: .55rem 1rem; }
.lang-hint[hidden] { display: none; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font: 500 .95rem/1.4 var(--sans); }
.site-footer { border-top: 1px solid var(--rule); background: var(--paper); font: 400 .9rem/1.6 var(--sans); color: var(--ink-3); }
.footer-inner { max-width: var(--wide); margin: 0 auto; padding: 2rem 1.25rem 2.5rem; }
.footer-inner p { margin: 0 0 .5rem; }
.footer-inner .memorial { font: italic 400 1.05rem/1.5 var(--serif); color: var(--ink-2); }
.seven-langs p { margin: 0 0 1rem; }
.seven-langs [lang] { display: block; }
.seven-langs .label { font: 600 .75rem/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: block; }

/* ------------------------------------------------------------------ photo viewer */
.viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: rgb(18 14 12 / .96); color: #f1ebe0; }
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.viewer::backdrop { background: rgb(18 14 12 / .96); }
.viewer-top { display: flex; align-items: center; gap: 1rem; padding: .6rem .9rem .6rem 1.25rem; font: 500 .9rem/1.4 var(--sans); }
.viewer-count { margin-right: auto; color: #b9ae9e; }
.viewer button { font: inherit; color: #f1ebe0; background: rgb(255 255 255 / .08); border: 0; border-radius: 999px; min-width: 2.75rem; height: 2.75rem; cursor: pointer; font-size: 1.3rem; }
.viewer button:hover { background: rgb(255 255 255 / .18); }
.viewer-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 3.5rem; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px; user-select: none; }
.viewer-prev, .viewer-next { position: absolute; top: 50%; translate: 0 -50%; }
.viewer-prev { left: .6rem; } .viewer-next { right: .6rem; }
.viewer-caption { font: italic 400 1.05rem/1.5 var(--serif); text-align: center; padding: .9rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); max-width: 48rem; margin: 0 auto; }
@media (max-width: 600px) { .viewer-stage { padding: 0; } .viewer-prev, .viewer-next { display: none; } }

@media print {
    .site-header, .site-footer, .lang-hint, .pager { display: none; }
    body { background: #fff; color: #000; }
}
