blob: 4afbf6018e958c8fddd1e88879ac7a7d9cedaa56 [file]
/*
* Copyright 2026 The Fuchsia Authors
*
* Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
* <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
* license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
* This file may not be copied, modified, or distributed except according to
* those terms.
*/
/*
* Library frame: the building on the Denver Public Library bookplate
* (entablature, Corinthian columns, picture frame and pedestal) as a
* stretchable frame for any element, drawn entirely with SVG background
* images.
*
* <section class="library">...</section>
*
* The element's content sits in the picture frame between the columns.
*
* How it works: the element's border reserves room for the building, and its
* ::before and ::after pseudo-elements paint it as background layers. The four
* corners (the ends of the entablature and pedestal with the capitals and the
* column bases) are drawn once. Between them, the plain mouldings and the
* shafts stretch, and each band of ornament repeats on its own with `round`,
* so ornaments are never stretched by more than a fraction of one repeat. The
* lettering never stretches: it stays centred in its panel and shrinks only if
* the panel gets too narrow for it. Each corner reaches 1.5 units over the
* start of its edges, so the joins are overdrawn and cannot open into hairline
* gaps.
*
* Things to know:
* - The frame uses ::before and ::after, so they are not free for other uses.
* The element gets `position: relative` (any position but static works) and
* `isolation: isolate`.
* - Do not give the framed element itself an `overflow` other than visible: it
* would clip the frame. Put scrolling content in an inner element instead.
* - The element's border box is the outer edge of the building; ink may reach
* 3 units beyond it.
* - Keep the element at least 352 units wide and 487 units tall; below that
* the corners overlap.
* - The paper shows whatever is behind the element (or its own background).
* - To leave a panel blank, set `--library-lettering-top: none` (PUBLIC
* LIBRARY) or `--library-lettering-bottom: none` (PRESENTED BY) on the
* element; or set either to url("...") for lettering of your own.
*/
.library {
/*
* One design unit (a pixel of the original scan). The building is 545 x 839
* units in the original.
*/
--library-unit: clamp(0.5px, 0.125vw, 0.8px);
--library-padding: calc(16 * var(--library-unit));
position: relative;
isolation: isolate;
border-style: solid;
border-color: transparent;
border-width:
calc(168 * var(--library-unit))
calc(135 * var(--library-unit))
calc(182 * var(--library-unit))
calc(133 * var(--library-unit));
padding: var(--library-padding);
}
.library::before,
.library::after {
content: "";
position: absolute;
inset:
calc(-171 * var(--library-unit))
calc(-138 * var(--library-unit))
calc(-185 * var(--library-unit))
calc(-136 * var(--library-unit));
z-index: -1;
pointer-events: none;
box-sizing: border-box;
}
/*
* The lettering, then the entablature's and the pedestal's runs between the
* corners. Their padding marks out the runs (padding, not border: Chrome snaps
* border widths to whole device pixels, which would shift the runs off the
* corners).
*/
.library::before {
padding: 0 calc(171 * var(--library-unit)) 0 calc(181 * var(--library-unit));
background:
var(--library-lettering-top, url("images/library/text-public-library.svg"))
left calc(50% + 6.88 * var(--library-unit))
top calc(69 * var(--library-unit)) /
min(
calc(409.75 * var(--library-unit)),
100% - calc(123 * var(--library-unit))
)
calc(31.5 * var(--library-unit))
no-repeat border-box,
var(--library-lettering-bottom, url("images/library/text-presented-by.svg"))
left calc(50% + 2.25 * var(--library-unit))
bottom calc(120.25 * var(--library-unit)) /
min(
calc(218 * var(--library-unit)),
100% - calc(126 * var(--library-unit))
)
calc(20 * var(--library-unit))
no-repeat border-box,
url("images/library/frame-edge-top.svg")
left top / 100% calc(243.5 * var(--library-unit))
no-repeat content-box,
url("images/library/frame-edge-top-1.svg")
left top / calc(33.75 * var(--library-unit)) calc(243.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-top-2.svg")
left top / calc(29.5 * var(--library-unit)) calc(243.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-top-3.svg")
left top / calc(40 * var(--library-unit)) calc(243.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-top-4.svg")
left top / calc(30 * var(--library-unit)) calc(243.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-top-5.svg")
left top / calc(27.75 * var(--library-unit)) calc(243.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-bottom.svg")
left bottom / 100% calc(246.5 * var(--library-unit))
no-repeat content-box,
url("images/library/frame-edge-bottom-1.svg")
left bottom / calc(26 * var(--library-unit)) calc(246.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-bottom-2.svg")
left bottom / calc(34.5 * var(--library-unit)) calc(246.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-bottom-3.svg")
left bottom / calc(24 * var(--library-unit)) calc(246.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-bottom-4.svg")
left bottom / calc(32.25 * var(--library-unit)) calc(246.5 * var(--library-unit))
round no-repeat content-box,
url("images/library/frame-edge-bottom-5.svg")
left bottom / calc(24 * var(--library-unit)) calc(246.5 * var(--library-unit))
round no-repeat content-box;
}
/* The corners, then the shafts between them. */
.library::after {
padding: calc(242 * var(--library-unit)) 0 calc(245 * var(--library-unit)) 0;
background:
url("images/library/frame-corner-tl.svg")
left top / calc(182.5 * var(--library-unit)) calc(243.5 * var(--library-unit))
no-repeat border-box,
url("images/library/frame-corner-tr.svg")
right top / calc(172.5 * var(--library-unit)) calc(243.5 * var(--library-unit))
no-repeat border-box,
url("images/library/frame-corner-br.svg")
right bottom / calc(172.5 * var(--library-unit)) calc(246.5 * var(--library-unit))
no-repeat border-box,
url("images/library/frame-corner-bl.svg")
left bottom / calc(182.5 * var(--library-unit)) calc(246.5 * var(--library-unit))
no-repeat border-box,
url("images/library/frame-edge-left.svg")
left top / calc(182.5 * var(--library-unit)) 100%
no-repeat content-box,
url("images/library/frame-edge-right.svg")
right top / calc(172.5 * var(--library-unit)) 100%
no-repeat content-box;
}