repository

BlowfishCMS

A small content management system for OpenBSD

version 0.45.6 · ISC · 2026-12-03 · releases

127 lines · 11.3 KB · download this file

/* Store add-on: the items-for-sale block, a product's own page and the cart.
   Everything takes the theme's colours (--ink on --window, --line, --accent
   with --accent-ink on it), its corners (--button-radius: 0 for square
   themes, 999px for round ones; cards and pictures round a little less) and
   its fonts, so the shop looks like part of whichever theme is on. */
.store-items,.store-product,.store-cart{--store-r:min(var(--button-radius,6px),10px);--store-r-pill:var(--button-radius,6px)}
.store-items{display:grid;gap:18px}
.store-items--grid{grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr))}
.store-item{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--line);border-radius:var(--store-r);padding:12px;background:transparent;color:inherit}
.store-items--list .store-item{flex-direction:row;align-items:flex-start}
.store-items--list .store-item__picture{width:min(40%,280px);flex:none}
.store-item__picture{display:block;border-radius:min(var(--store-r),6px);overflow:hidden}
.store-item__image{display:block;width:100%;aspect-ratio:1;object-fit:cover;transition:transform .2s}
.store-item__picture:hover .store-item__image{transform:scale(1.03)}
.store-item__text{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
.store-item__name{margin:0;font-size:1.05rem;line-height:1.3;overflow-wrap:anywhere}
.store-item__name a{color:inherit;text-decoration:none}
.store-item__name a:hover{text-decoration:underline}
.store-item__price{margin:0;font-weight:700}
.store-item__description{margin:0;font-size:.9rem;overflow-wrap:anywhere}
.store-item__actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:auto;padding-top:4px}
.store-item__actions .store-buy{display:contents}
.store-item__actions .buttonlike{text-align:center}
.store-item__view--main{flex:1 1 auto}
.store-buy__status{flex-basis:100%;margin:0;font-size:.85rem;min-height:0}
.store-buy__status:empty{display:none}
.store-item.is-sold-out .store-buy__button{opacity:.55}
@media(max-width:560px){.store-items--list .store-item{flex-direction:column}.store-items--list .store-item__picture{width:100%}}

/* A product's own page, laid out like a big shop's: on wide screens the
   thumbnails in a column beside the main picture, the details on the right,
   and the pictures staying in view while the details scroll; on phones the
   picture, a row of thumbnails, then the details. */
.store-product{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:32px;align-items:start}
.store-gallery{display:grid;grid-template-columns:minmax(0,1fr);grid-template-areas:"stage";gap:12px;min-width:0}
.store-gallery--many{grid-template-columns:72px minmax(0,1fr);grid-template-areas:"thumbs stage"}
@media(min-width:761px){.store-gallery{position:sticky;top:16px}}
.store-gallery__stage{grid-area:stage;position:relative;border:1px solid var(--line);border-radius:var(--store-r);overflow:hidden;background:var(--window,transparent)}
.store-gallery__stage--none{aspect-ratio:1}
.store-gallery__zoom{display:block;width:100%;padding:0;border:0;background:none;cursor:zoom-in}
.store-gallery__main{display:block;width:100%;aspect-ratio:1;object-fit:contain}
.store-gallery__nav{position:absolute;top:50%;transform:translateY(-50%);width:40px;height:40px;display:grid;place-items:center;border:1px solid var(--line);border-radius:var(--store-r-pill);background:var(--window,#fff);color:var(--ink,#111);font:700 1.4rem/1 var(--font-ui,inherit);cursor:pointer;opacity:.9}
.store-gallery__nav:hover,.store-gallery__nav:focus-visible{opacity:1;outline:2px solid var(--accent);outline-offset:1px}
.store-gallery__nav--prev{left:8px}
.store-gallery__nav--next{right:8px}
.store-gallery__count{position:absolute;right:8px;bottom:8px;margin:0;padding:2px 8px;border:1px solid var(--line);border-radius:var(--store-r-pill);background:var(--window,#fff);color:var(--ink,#111);font-size:.8rem;pointer-events:none}
.store-gallery__count:empty{display:none}
/* The column of thumbnails is as tall as the picture, and scrolls when there are more. */
.store-gallery__thumbs{grid-area:thumbs;list-style:none;margin:0;padding:3px;display:flex;flex-direction:column;gap:8px;height:0;min-height:100%;overflow-y:auto;scrollbar-width:thin}
.store-gallery__thumbs li[hidden]{display:none}
.store-gallery__thumb{flex:none;display:block;width:100%;aspect-ratio:1;padding:0;border:1px solid var(--line);border-radius:min(var(--store-r),6px);overflow:hidden;background:var(--window,transparent);cursor:pointer}
.store-gallery__thumb img{display:block;width:100%;height:100%;object-fit:cover}
.store-gallery__thumb[aria-pressed="true"]{outline:2px solid var(--accent);outline-offset:1px}
@media(max-width:760px){
 .store-product{grid-template-columns:minmax(0,1fr);gap:18px}
 .store-gallery--many{grid-template-columns:minmax(0,1fr);grid-template-areas:"stage" "thumbs"}
 .store-gallery__thumbs{flex-direction:row;height:auto;min-height:0;overflow-x:auto;overflow-y:visible}
 .store-gallery__thumb{width:64px;height:64px}
}
/* A picture full size. */
.store-lightbox{width:min(96vw,1100px);height:min(92vh,1100px);max-width:none;max-height:none;padding:0;border:1px solid var(--line);border-radius:var(--store-r);background:var(--window,#fff);color:var(--ink,#111)}
.store-lightbox::backdrop{background:rgba(0,0,0,.6)}
.store-lightbox img{display:block;width:100%;height:100%;object-fit:contain}
.store-lightbox__close,.store-lightbox__nav{position:absolute;display:grid;place-items:center;width:44px;height:44px;border:1px solid var(--line);border-radius:var(--store-r-pill);background:var(--window,#fff);color:var(--ink,#111);font:700 1.5rem/1 var(--font-ui,inherit);cursor:pointer}
.store-lightbox__close{top:10px;right:10px}
.store-lightbox__nav{top:50%;transform:translateY(-50%)}
.store-lightbox__nav--prev{left:10px}
.store-lightbox__nav--next{right:10px}
.store-product__info{display:flex;flex-direction:column;gap:14px;min-width:0}
.store-product__title{margin:0;font-size:clamp(1.4rem,3vw,2rem);line-height:1.15;overflow-wrap:anywhere}
.store-product__price{margin:0;font-size:1.3rem;font-weight:700}
.store-buy--page{display:flex;flex-direction:column;gap:16px}
.store-choice{margin:0;padding:0;border:0;min-width:0}
.store-choice legend{padding:0;margin-bottom:8px;font-weight:600}
.store-choice legend span{font-weight:400}
.store-choice__list{display:flex;flex-wrap:wrap;gap:8px}
/* Colours and sizes are buttons: a real radio button underneath, for keyboards and screen readers. */
.store-swatch,.store-pill{position:relative;display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:6px 12px;border:1px solid var(--line);border-radius:var(--store-r-pill);background:var(--window,transparent);color:var(--ink,inherit);cursor:pointer;font-size:.92rem;line-height:1.2}
.store-swatch input,.store-pill input{position:absolute;opacity:0;width:1px;height:1px;margin:0}
/* Chosen: a strong border in the theme's accent, the words staying in its ink (some themes' accent is too light to write on). */
.store-swatch:has(input:checked),.store-pill:has(input:checked){border-color:var(--accent);box-shadow:inset 0 0 0 2px var(--accent);font-weight:700}
.store-swatch:has(input:focus-visible),.store-pill:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}
.store-pill:has(input:disabled),.store-swatch:has(input:disabled){opacity:.45;cursor:not-allowed;text-decoration:line-through}
.store-swatch__chip{width:18px;height:18px;flex:none;border-radius:50%;border:1px solid color-mix(in srgb,var(--ink,#111) 35%,transparent);display:none}
.store-swatch__chip.has-colour{display:inline-block}
/* How many: − 1 + */
.store-qty{display:flex;flex-direction:column;gap:6px}
.store-qty label{font-weight:600}
.store-stepper{display:inline-flex;align-items:stretch;width:max-content;border:1px solid var(--line);border-radius:var(--store-r-pill);overflow:hidden;background:var(--window,transparent)}
.store-stepper__step{width:40px;border:0;background:transparent;color:var(--ink,inherit);font:700 1.15rem/1 var(--font-ui,inherit);cursor:pointer}
.store-stepper__step:hover,.store-stepper__step:focus-visible{background:color-mix(in srgb,var(--accent) 15%,transparent)}
.store-stepper input{width:3.2em;border:0;border-inline:1px solid var(--line);border-radius:0;background:transparent;color:var(--ink,inherit);font:inherit;font-weight:600;text-align:center;padding:8px 0;-moz-appearance:textfield;appearance:textfield}
.store-stepper input::-webkit-inner-spin-button,.store-stepper input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
/* The theme draws the buttons, as it draws all its others; only their size is the shop's. */
.store-buy--page .store-buy__button{align-self:stretch;padding-block:12px;font-weight:700;text-align:center}
.store-buy--page .store-buy__button:disabled{opacity:.55;cursor:not-allowed}
.store-product__description{overflow-wrap:anywhere}
.store-product__description>:first-child{margin-top:0}
.store-product__back{margin:0;font-size:.9rem}
.store-product.is-sold-out .store-product__price::after{content:" · sold out";font-weight:400}

/* The cart: a button in the corner while it has items, and its panel. */
.store-cart-toggle{position:fixed;right:18px;bottom:18px;z-index:50;padding:10px 16px;border:0;border-radius:var(--button-radius,999px);background:var(--accent,#2563eb);color:var(--accent-ink,#fff);font:inherit;font-weight:600;box-shadow:0 6px 18px rgba(0,0,0,.22);cursor:pointer}
.store-cart-toggle[hidden]{display:none}
.store-cart{width:min(440px,calc(100vw - 24px));max-height:min(80vh,640px);padding:0;border:1px solid var(--line);border-radius:var(--store-r);background:var(--window,#fff);color:var(--ink,#111)}
/* The cart is outside every panel: its words take the panels' colours, not the page's. */
.store-cart a{color:var(--accent,inherit)}
.store-cart select{color:var(--ink,#111);background:var(--window,#fff);border:1px solid var(--line);border-radius:min(var(--store-r),6px)}
.store-cart__remove,.store-cart__note{color:color-mix(in srgb,var(--ink,#111) 78%,var(--window,#fff))}
.store-cart::backdrop{background:rgba(0,0,0,.35)}
.store-cart__head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--line)}
.store-cart__head h2{margin:0;font-size:1.05rem}
.store-cart__close{border:0;background:none;color:inherit;font-size:1.4rem;line-height:1;cursor:pointer}
.store-cart>p{margin:12px 16px}
.store-cart__items{list-style:none;margin:0;padding:6px 16px;display:grid;gap:10px}
.store-cart__item{display:grid;grid-template-columns:auto 1fr auto auto;grid-template-areas:"img name qty price" "img remove remove remove";align-items:center;gap:4px 10px}
.store-cart__item img{grid-area:img;width:48px;height:48px;object-fit:cover;border-radius:min(var(--store-r),6px)}
.store-cart__name{grid-area:name;min-width:0;overflow-wrap:anywhere}
.store-cart__item select{grid-area:qty;padding:3px 4px;font:inherit}
.store-cart__price{grid-area:price;font-weight:600;white-space:nowrap}
.store-cart__remove{grid-area:remove;justify-self:start;border:0;background:none;padding:0;font:inherit;font-size:.82rem;text-decoration:underline;cursor:pointer}
.store-cart__total{margin:10px 16px 0;font-weight:700}
.store-cart__note{margin:2px 16px 10px;font-size:.85rem}
.store-cart__checkout{margin:0 16px 8px;width:calc(100% - 32px)}
.store-cart__status{margin:0 16px 14px;font-size:.85rem;min-height:1em}
.store-thanks{padding-left:1.2em}
@media print{.store-cart-toggle,.store-gallery__nav,.store-buy{display:none}}