/* Playfair Display, served from static/fonts (SIL Open Font License, see
   fonts/OFL.txt). One variable font file per style and character set. */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/playfair-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/playfair-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/playfair-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/playfair-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
* {
  font-family: "Playfair Display", Georgia, serif;
  a {
    text-decoration: none;
    color: var(--text);
  }
}

/* ---------- colours: studio grey, light and dark ----------
   With no choice saved the site follows the device's setting. The header
   toggle saves a choice, which the server puts on <html data-theme>. */
:root {
  color-scheme: light;
  --bg: #d8d8d8;
  --card: #ececec;
  --text: #141414;
  --muted: #474747;
  --rule: #141414;
  --line: #bdbdbd;
  --dashed: #8a8a8a;
  --no-photo: #c4c4c4;
  --savebar: #c8c8c8;
  --btn: #f5f5f5;
  --btn-hover: #ffffff;
  --btn-border: #6a6a6a;
  --btn-shadow: rgba(0, 0, 0, 0.12);
  --input: #f7f7f7;
  --primary: #141414;
  --primary-hover: #3a3a3a;
  --on-primary: #ffffff;
  --danger: #8e1c2e;
  --on-danger: #ffffff;
  --danger-bg: #f1e2e5;
  --danger-bg-hover: #f8eef0;
  --danger-input: #fbf1f3;
  --danger-text: #5e1220;
  --card-glow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 1rem 0.1rem rgba(0, 0, 0, 0.24);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #3c3835;
    --card: #4a4541;
    --text: #f2eee9;
    --muted: #c7c0b8;
    --rule: #f2eee9;
    --line: #554f4a;
    --dashed: #7f7872;
    --no-photo: #57514c;
    --savebar: #45403c;
    --btn: #55504b;
    --btn-hover: #615b55;
    --btn-border: #8a837c;
    --btn-shadow: rgba(0, 0, 0, 0.35);
    --input: #433e3a;
    --primary: #f2eee9;
    --primary-hover: #ffffff;
    --on-primary: #1d1a18;
    --danger: #ff9aa8;
    --on-danger: #3c3835;
    --danger-bg: #4f3234;
    --danger-bg-hover: #5b393b;
    --danger-input: #47302f;
    --danger-text: #ffd0d6;
  --card-glow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 1rem 0.1rem rgba(255, 255, 255, 0.18);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #3c3835;
  --card: #4a4541;
  --text: #f2eee9;
  --muted: #c7c0b8;
  --rule: #f2eee9;
  --line: #554f4a;
  --dashed: #7f7872;
  --no-photo: #57514c;
  --savebar: #45403c;
  --btn: #55504b;
  --btn-hover: #615b55;
  --btn-border: #8a837c;
  --btn-shadow: rgba(0, 0, 0, 0.35);
  --input: #433e3a;
  --primary: #f2eee9;
  --primary-hover: #ffffff;
  --on-primary: #1d1a18;
  --danger: #ff9aa8;
  --on-danger: #3c3835;
  --danger-bg: #4f3234;
  --danger-bg-hover: #5b393b;
  --danger-input: #47302f;
  --danger-text: #ffd0d6;
  --card-glow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 1rem 0.1rem rgba(255, 255, 255, 0.18);
}

html {
  background-color: var(--bg);
  color: var(--text);
  overflow-y: scroll;
  scroll-behavior: smooth;
  /* keep things scrolled to (by keyboard focus) clear of the sticky header */
  scroll-padding-top: 4rem;
  height: 100%;
  font-size: 20px;
}

/* 60% of the window on a computer, as before; on tablets and phones, where
   60% would be too narrow, nearly the full width with a small gutter. */
body {
  max-width: max(60%, min(100% - 2rem, 36rem));
  margin: 0 auto 1rem;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem 1.2rem;
  margin: 0 0 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rule);

  /* A slim header that stays at the top while the page scrolls under it. */
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);

  h1 {
    font-size: 1.55rem;
    line-height: 1.3;
    margin: 0;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
    font-size: 0.9rem;
  }
}

.topbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 1rem;
}

/* The light/dark toggle looks like a header link. Only the button that
   switches away from the theme being shown is visible. */
.theme-toggle {
  display: flex;
}
.theme-toggle button,
.theme-toggle button:hover {
  font-size: 0.9rem;
  color: var(--text);
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.theme-toggle .to-light {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .to-dark {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .to-light {
  display: inline-block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .to-dark {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .to-light {
    display: inline-block;
  }
}

/* keep the line breaks typed into a product description */
.description {
  white-space: pre-line;
}

/* ---------- shared pieces ---------- */

/* Text sizes step down from the shop name (1.55rem) to product names
   (1.35rem) to page headings, then the 1rem body text. */
h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin: 0 0 0.6rem;
}

/* Layouts below adapt to the width of the content area, not the window. */
#content {
  container-type: inline-size;
}

button,
.button {
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--text);
  background: var(--btn);
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--btn-shadow);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  display: inline-block;
}
button:hover,
.button:hover {
  background: var(--btn-hover);
}
button:disabled,
button:disabled:hover {
  background: var(--btn);
  box-shadow: none;
  opacity: 0.35;
  cursor: default;
}
.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 600;
  padding: 0.3rem 0.8rem;
}
.primary:hover {
  background: var(--primary-hover);
}
.danger {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-bg);
}
.danger:hover {
  background: var(--danger-bg-hover);
}
/* Text links (and the light/dark toggle) fade in a thin underline when the
   mouse is over them. */
a:where(:not(.button):not(.card-link)),
.theme-toggle button {
  text-decoration: underline 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}
a:where(:not(.button):not(.card-link)):hover,
.theme-toggle button:hover {
  text-decoration-color: currentColor;
}
@media (prefers-reduced-motion: reduce) {
  a,
  .theme-toggle button {
    transition: none;
  }
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

input[type="text"],
input[type="password"],
textarea {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
  width: 100%;
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--text);
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
input[aria-invalid="true"] {
  border: 2px solid var(--danger);
  background: var(--danger-input);
}
.field-error {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.7rem;
}
textarea {
  min-height: 7em;
  resize: vertical;
}
input[type="file"] {
  font-size: 0.7rem;
  width: 100%;
  min-width: 0;
}

/* A problem with the whole form, in a box with a "!" mark. */
.error {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  padding: 0.4rem 0.55rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 4px;
  color: var(--danger-text);
  font-size: 0.8rem;
}
.error::before {
  content: "!";
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--danger);
  color: var(--on-danger);
  font-weight: 700;
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}

/* Error pages and empty lists: what happened and where to go next. */
.notice {
  background: var(--card);
  border-radius: 4px;
  padding: 0.8rem 0.9rem;
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  max-width: 28rem;
}
.notice h2,
.notice p {
  margin: 0;
}
.notice.empty {
  max-width: none;
  justify-items: center;
  text-align: center;
  background: transparent;
  border: 2px dashed var(--dashed);
  margin-bottom: 0.8rem;
}
.hint {
  font-size: 0.65rem;
  color: var(--muted);
}
.badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-primary);
  background: var(--primary);
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
}
img {
  display: block;
}
.no-photo {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  background: var(--no-photo);
  color: var(--muted);
  font-size: 0.7rem;
}

/* ---------- product cards: the public list and the admin list ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.8rem;
}
/* The card colour runs all round the photo, like a mount in a frame. */
.card {
  background: var(--card);
  border-radius: 6px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s ease;
}
.card img,
.card .no-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
/* The link covers the whole card, mount included. */
.card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: -0.35rem;
  padding: 0.35rem;
  border-radius: 6px;
}
.card:has(.card-link:hover),
.card:has(.card-link:focus-visible) {
  box-shadow: var(--card-glow);
}
.card .body {
  padding: 0.4rem 0.1rem 0.1rem;
  display: grid;
  gap: 0.1rem;
  align-content: start;
}
.card .name {
  font-weight: 600;
}
.price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.card .price {
  font-size: 0.85rem;
}
.card .meta {
  font-size: 0.7rem;
  color: var(--muted);
}
.card .desc {
  font-size: 0.75rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.admin-cards img,
.admin-cards .no-photo {
  aspect-ratio: 1;
}
.card .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem 0.1rem 0;
  margin-top: auto;
}
.card .controls .pos {
  margin-left: auto;
  display: flex;
  gap: 0.2rem;
}
.addline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.addline h2 {
  margin: 0;
}

/* ---------- one product: the public product page and the admin view ---------- */

.back {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
}
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
}
.gallery a:first-child {
  grid-column: 1 / -1;
}
.gallery img,
.gallery .no-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
.detail h2 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  line-height: 1.2;
  text-wrap: balance;
}
.detail .price {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}
.detail dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.1rem 0.6rem;
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
}
.detail dt {
  font-weight: 600;
}
.detail dd {
  margin: 0;
}
.detail .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  margin-top: 1rem;
}
.detail .actions a:not(.button) {
  text-decoration: underline;
  font-size: 0.8rem;
}
@container (max-width: 30rem) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- product page photo viewer (see photoViewer in products.templ) ---------- */

.viewer {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.3rem;
}
/* Kept for keyboard and screen reader use, but not shown. */
.viewer .pick {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.viewer .big {
  display: none;
  grid-column: 1 / -1;
  grid-row: 1;
}
.viewer .pick:checked + .big {
  display: block;
}
.viewer img,
.viewer .no-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
.viewer .no-photo {
  grid-column: 1 / -1;
}
.viewer .thumb {
  cursor: pointer;
  border-radius: 4px;
  outline: 2px solid transparent;
  outline-offset: 1px;
  opacity: 0.7;
}
.viewer .thumb:hover {
  opacity: 1;
}
.viewer .pick:checked + .big + .thumb {
  outline-color: var(--text);
  opacity: 1;
}
.viewer .pick:focus-visible + .big + .thumb {
  outline: 2px dashed var(--text);
}
/* With only one photo there is nothing to choose between. */
.viewer .thumb:only-of-type {
  display: none;
}

/* ---------- admin edit page: photos first, then the details ---------- */

.edit {
  display: grid;
  gap: 0.9rem;
}
.edit h2 {
  margin: 0;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}
.hero .main {
  display: grid;
  gap: 0.25rem;
}
.hero img,
.hero .no-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
.photo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}
/* the small arrow and remove buttons on photos and admin cards */
.photo-controls button,
.card .controls .pos button {
  min-width: 1.8em;
  padding: 0.15rem 0.4rem;
}
.photo-controls .danger {
  margin-left: auto;
}
.hero .order {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  align-content: start;
}
.hero ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); /* room for ← → ✕ on one row */
  gap: 0.5rem;
}
.hero li {
  display: grid;
  gap: 0.15rem;
  font-size: 0.65rem;
}
.drop {
  min-width: 0;
  border: 2px dashed var(--dashed);
  border-radius: 4px;
  padding: 0.5rem;
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  text-align: center;
  font-size: 0.8rem;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.8rem;
}
.field {
  display: grid;
  gap: 0.15rem;
  align-content: start;
}
.field label {
  font-weight: 600;
  font-size: 0.8rem;
}
.field.wide {
  grid-column: 1 / -1;
}
.savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.9rem;
  padding: 0.5rem 0.7rem;
  background: var(--savebar);
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}
.formacts {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.formacts a {
  text-decoration: underline;
}
@container (max-width: 26rem) {
  .hero,
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero .main {
    max-width: 12rem;
  }
}

/* ---------- login ---------- */

.login {
  display: grid;
  place-items: center;
  padding: 1.2rem 0;
}
.login-box {
  width: 100%;
  max-width: 15rem;
  box-sizing: border-box;
  background: var(--card);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.7rem;
}
.login-box h2,
.login-box .error {
  margin: 0;
}
.login-box button {
  width: 100%;
}

/* ---------- home and contact ---------- */

.home {
  display: grid;
  gap: 0.8rem;
}
.lead {
  font-size: 1.05rem;
  max-width: 36ch;
  margin: 0;
}
.home .more {
  justify-self: start;
  text-decoration: underline;
}

.contact {
  display: grid;
  gap: 1rem;
  align-items: start;
}
.contact.with-photo {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}
.contact img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
.contact .text {
  display: grid;
  gap: 0.6rem;
}
.contact h2 {
  margin: 0;
}
.contact .lines {
  display: grid;
  gap: 0.1rem;
  border-top: 2px solid var(--rule);
  padding-top: 0.6rem;
}
.contact .lines a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
@container (max-width: 26rem) {
  .contact.with-photo {
    grid-template-columns: minmax(0, 1fr);
  }
  .contact img {
    max-width: 12rem;
  }
}

/* ---------- "Uploading…" while a form is being sent ----------
   htmx adds .htmx-request to the hx-indicator element during the request.
   Its own indicator styles are turned off (they are inline, which the
   Content-Security-Policy blocks), so they are here instead. */
.progress {
  display: none;
  font-weight: 700;
}
.progress.htmx-request {
  display: inline;
}
