:root {
  color-scheme: light;
  --paper: #fbf6f3;
  --surface: #fffdfb;
  --ink: #302327;
  --muted: #6e565d;
  --line: #e4d5d6;
  --accent: #662f49;
  --accent-hover: #52243a;
  font-family: system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: min(calc(100% - 2rem), 60rem); margin-inline: auto; }
.bar { border-bottom: 1px solid var(--line); background: var(--surface); }
.bar-inner { min-height: 4.1rem; padding-block: max(.7rem, env(safe-area-inset-top), var(--tg-safe-area-inset-top, 0px)) .7rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.wordmark { font: bold 1.65rem Georgia, serif; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark span { color: var(--accent); }
.profile { margin: 0; max-width: 15rem; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; text-align: end; }
.storefront { padding-block: 1.5rem 4rem; }
.hero {
  min-height: clamp(16rem, 40vw, 23rem);
  display: flex;
  align-items: end;
  background: #f0dbd1;
  background-image: linear-gradient(90deg, #f0dbd1 0%, #f0dbd1 33%, #f0dbd100 70%), url('/assets/serum.webp');
  background-size: cover, auto 133%;
  background-position: center, right 12% center;
  background-repeat: no-repeat;
  border-radius: 1.45rem;
  overflow: hidden;
}
.hero-copy { padding: clamp(1rem, 4vw, 2.65rem); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, serif; font-weight: 500; line-height: 1.09; }
h1 { font-size: clamp(2.4rem, 7vw, 4.55rem); letter-spacing: -.045em; margin-bottom: 1.3rem; }
h2 { font-size: clamp(1.8rem, 4vw, 2.55rem); letter-spacing: -.035em; margin-bottom: 1rem; }
h3 { font-size: 1.3rem; letter-spacing: -.015em; margin-bottom: .5rem; }
.muted { color: var(--muted); }
.catalog { margin-top: 2.4rem; scroll-margin-top: 1.25rem; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: .6rem; margin-bottom: 1.2rem; }
input:not([type=checkbox]), select, textarea { border-radius: .65rem; border: 1px solid var(--line); padding: .65rem .72rem; width: 100%; min-height: 2.75rem; background: var(--surface); color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .95; }
textarea { resize: vertical; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; border-radius: 2rem; border: 1px solid var(--accent); padding: .6rem 1.1rem; background: var(--accent); color: #fff; text-decoration: none; font-size: .88rem; font-weight: 650; cursor: pointer; }
.button:hover { background: var(--accent-hover); }
.button:disabled { opacity: .55; cursor: default; }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--accent); }
.button.secondary:not(:disabled):hover { background: #f4e7e8; }
.products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.product { display: flex; flex-direction: column; min-width: 0; padding: 0; color: var(--ink); text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 1.05rem; overflow: hidden; cursor: pointer; }
.product:hover { border-color: var(--accent); }
.product-photo { display: block; width: 100%; aspect-ratio: 6 / 5; object-fit: cover; background: #f0e1dc; }
.product-copy { display: flex; flex: 1; width: 100%; flex-direction: column; padding: .9rem; overflow-wrap: anywhere; }
.product-meta { color: var(--muted); font-size: .8rem; margin-bottom: .4rem; }
.product-name { display: block; font: 1.25rem Georgia, serif; margin-bottom: .75rem; }
.product-price { display: block; margin-top: auto; color: var(--accent); font-size: .9rem; font-weight: 700; }
#more { margin-top: 1.2rem; }
#catalog-status:empty { display: none; }
.details { width: min(calc(100vw - 2rem), 28rem); max-height: 90dvh; border: 1px solid var(--line); border-radius: 1.2rem; padding: 1rem; color: var(--ink); background: var(--surface); }
.details::backdrop { background: #30232780; }
.details .product-photo { border-radius: .75rem; aspect-ratio: 16 / 9; margin-bottom: 1rem; }
.dialog-actions { display: flex; justify-content: end; margin-bottom: .75rem; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; }
.variant-list { list-style: none; margin: 0; padding: 0; }
.variant-list li { display: flex; align-items: start; justify-content: space-between; gap: .9rem; padding: .65rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.variant-list span:last-child { flex: 0 0 auto; color: var(--accent); }
.admin-layout { max-width: 45rem; padding-block: 2rem 4rem; }
.admin-header { padding: clamp(1.1rem, 4vw, 1.8rem); margin-bottom: 1rem; border-radius: 1rem; background: linear-gradient(105deg, #f0dbd1, #f3e3e8); }
.admin-layout h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
.admin-header h1 { margin: 0; }
.panel { display: grid; gap: 1rem; padding: clamp(1rem, 4vw, 1.8rem); background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
.panel h2, .panel p { margin: 0; }
.panel label { font-size: .88rem; font-weight: 650; }
.panel label > :is(input:not([type=checkbox]), select, textarea) { margin-top: .35rem; }
.panel .muted { font-weight: 400; }
.panel fieldset { margin: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .65rem; min-width: 0; }
.panel legend { padding: 0 .4rem; font-weight: 650; }
.panel button { justify-self: start; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.photo-field { display: flex; align-items: center; gap: .9rem; }
.photo-control { flex: 1; min-width: 0; }
.file-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-block: .35rem; }
.file-picker span { font-size: .8rem; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px !important; height: 1px; min-height: 0 !important; padding: 0 !important; border: 0 !important; clip-path: inset(50%); overflow: hidden; }
.file-picker input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }
#image-preview { width: 4.25rem; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; }
.variant-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .7fr) auto; align-items: end; gap: .55rem; margin-bottom: .8rem; }
.remove-variant { width: 2.75rem; padding-inline: .6rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
#admin-status { margin-top: .9rem; }
.small-link { font-size: .9rem; }

@media (max-width: 40rem) {
  .hero { background-size: cover, auto 112%; background-position: center, right -3rem center; }
  .hero-copy { background: linear-gradient(90deg, #f0dbd1e8, #f0dbd100); padding-right: 2.5rem; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .product-copy { padding: .73rem; }
  .product-name { font-size: 1.1rem; }
  .variant-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .variant-label { grid-column: 1 / -1; }
}
@media (max-width: 27rem) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
}
