@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif&display=swap');

:root {
  font: 16px/1.5 'DM Sans', Arial, sans-serif;
  color: var(--ink);
  background: var(--ivory);
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(1120px, calc(100% - 36px)); margin-inline: auto; }
header { background: var(--charcoal); color: var(--paper); padding-block: 16px; }
header a:focus-visible { outline-color: var(--gold); }
header .wrap, .section-title, .product, .line-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
a { color: inherit; text-underline-offset: 4px; }
main { padding-block: 36px 56px; }
h1, h2 { font: 400 clamp(42px, 7vw, 70px)/1 'Instrument Serif', Georgia, serif; margin: 0; }
h2 { font-size: 36px; }
main > p { margin: 12px 0 24px; max-width: 62ch; }
.customer-details { margin-bottom: 20px; }
.customer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
section { padding: 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); min-width: 0; }
.muted { color: var(--muted); font-size: .9rem; }
ul { list-style: none; padding: 0; margin: 0; }
.products { max-height: 560px; overflow: auto; }
.product, .line { padding: 12px 0; border-bottom: 1px solid var(--line); }
.product small, .line small { display: block; color: var(--muted); }
.product-info { display: flex; align-items: center; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.product > button { flex: none; }
.product.product-with-variant-buttons { flex-direction: column; align-items: stretch; }
.variant-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.variant-buttons button { background: var(--paper); color: var(--charcoal); min-height: 44px; }
.variant-buttons button:hover { background: var(--charcoal); color: white; }
.size-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.size-buttons button { text-align: left; line-height: 1.3; }
.size-buttons button small { color: inherit; margin-top: 3px; }
.cart-quantity:not([hidden]) {
  display: block;
  width: fit-content;
  margin: 4px auto 0;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--gold-tint);
  color: var(--charcoal);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}
.size-buttons .cart-quantity { margin-inline: 0; }
.add-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#manual-status:empty { margin: 0; }
.product-photo { flex: 0 0 76px; display: grid; place-items: center; min-height: 76px; border: 1px solid var(--line); border-radius: 4px; background: var(--ivory); }
.product-photo img { display: block; width: 74px; height: 74px; object-fit: contain; }
.variant-form { display: flex; align-items: center; gap: 7px; flex: 0 0 46%; }
.variant-form input, .variant-form select { min-width: 0; margin: 0; }
.variant-form button { margin: 0; }
.box-quantity-form { flex: none; align-items: flex-end; }
.box-quantity-form label { margin: 0; }
.box-quantity-form input { width: 4.5rem; }
details { margin-top: 18px; }
summary { cursor: pointer; font-weight: 700; }
button, input, textarea, select { font: inherit; }
button { background: var(--charcoal); color: white; border: 1px solid var(--charcoal); border-radius: 4px; padding: 7px 11px; min-height: 42px; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
.line-actions { justify-content: flex-start; margin-top: 7px; gap: 9px; }
.line-actions button { min-width: 42px; }
.line-actions .remove { margin-left: auto; background: var(--paper); color: var(--ink); border-color: var(--line); }
label { display: block; margin-top: 13px; font-weight: 700; }
input, textarea, select { width: 100%; display: block; margin-top: 4px; padding: 8px; border: 1px solid var(--control-border); border-radius: 3px; background: white; color: var(--ink); }
.customer-fields [aria-invalid="true"] {
  border-color: #b42318;
  background: #fff2f0;
  box-shadow: 0 0 0 1px #b42318;
}
.customer-fields [aria-invalid="true"]:focus {
  outline: 2px solid #b42318;
  outline-offset: 2px;
}
.field-error {
  margin: 4px 0 0;
  color: #991b1b;
  font-size: .875rem;
  font-weight: 600;
}
form > button { margin-top: 14px; }
.trap { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
@media (max-width: 740px) {
  .layout { grid-template-columns: 1fr; }
  section { padding: 16px; }
  header .wrap { font-size: .92rem; }
}
@media (max-width: 480px) {
  .customer-fields { grid-template-columns: 1fr; }
  .product.with-options { align-items: stretch; flex-direction: column; }
  .product-photo { flex-basis: 92px; min-height: 92px; }
  .product-photo img { width: 90px; height: 90px; }
}

.mobile-order-bar { display: none; }
@media (max-width: 740px) {
  body:has(.mobile-order-bar:not([hidden])) main { padding-bottom: calc(106px + env(safe-area-inset-bottom)); }
  .mobile-order-bar:not([hidden]) {
    display: flex;
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--charcoal);
    color: var(--paper);
    box-shadow: 0 -3px 14px rgb(26 25 23 / .17);
    padding: 8px max(18px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  .mobile-order-bar a {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 4px;
    background: var(--gold);
    color: var(--charcoal);
    font-weight: 700;
    text-decoration: none;
  }
  .mobile-order-bar a:focus-visible { outline-color: var(--paper); }
  #cart-heading { scroll-margin-top: 12px; }
}

.catalog-view-link { display: inline-block; padding-block: 8px; font-weight: 700; }
.seasonal-catalog { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.seasonal-catalog a { display: inline-flex; align-items: center; min-height: 44px; }
.catalog-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.catalog-filters label { font-weight: 700; }
.aisle-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  background: var(--warm-tint);
  color: var(--charcoal);
  font-size: 1rem;
}
.aisle-products { margin-bottom: 16px; }
.aisle-products:last-child { margin-bottom: 0; }
.catalog-mode :is(.customer-details, #cart, .cart-link, #order-intro, #add-status, .manual-product) { display: none; }
.catalog-mode .layout { grid-template-columns: minmax(0, 1fr); }
.catalog-mode .products { max-height: none; overflow: visible; }
.catalog-mode .aisle-heading { position: static; }
.catalog-mode .aisle-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
  margin-top: 8px;
}
.catalog-mode .product {
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.catalog-mode .product-info { align-items: flex-start; }
.order-item-link { display: inline-flex; align-items: center; min-height: 44px; align-self: start; color: var(--charcoal); font-weight: 700; }
@media (max-width: 560px) { .catalog-filters { grid-template-columns: 1fr; gap: 4px; } }

#send {
  background: var(--gold);
  color: var(--charcoal);
  border-color: var(--gold-edge);
}
#send:hover:not(:disabled) { background: var(--gold-hover); }

.draft-start { margin-top: 1rem; }
.draft-start p { margin: .45rem 0 0; }
.catalog-mode .draft-start { display: none; }
