/* ============================================================
   Medappuram General Store — shared design system
   Thesis: a printed shop rate-list / bill book.
   Paper sheet on a deep green counter, ruled ledger grid,
   mono price type, one rubber-stamp red accent.
   ============================================================ */

:root {
  --paper: #f7f2e6;
  --paper-2: #efe8d5;
  --paper-3: #e4dabf;
  --ink: #232017;
  --ink-2: #5c5544;
  --ink-3: #6f6657;
  --line: #d9d0b7;
  --line-strong: #232017;
  --accent: #b23a26;        /* rubber-stamp red */
  --accent-deep: #93301f;
  --shell: #182720;         /* deep green counter */
  --ok: #2f6b46;
  --radius: 16px;
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Karla', 'Noto Sans Malayalam', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --shadow-sheet: 0 24px 60px -30px rgba(8, 14, 11, .65);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--shell);
  /* faint diagonal texture on the counter surface */
  background-image: repeating-linear-gradient(
    45deg,
    rgba(247, 242, 230, .025) 0 1px,
    transparent 1px 7px
  );
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding: clamp(8px, 2vw, 22px);
}

::selection { background: var(--accent); color: var(--paper); }

.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ---------- storefront loading ticket ---------- */
.store-loader { display: none; }
.store-loader[hidden] { display: none; }
.js.store-loading .store-loader:not([hidden]),
.store-loader.is-leaving:not([hidden]) {
  display: grid;
}
html.store-loading,
html.store-loading body { overflow: hidden; }
.store-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--shell);
  background-image:
    linear-gradient(rgba(247, 242, 230, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 242, 230, .025) 1px, transparent 1px),
    repeating-linear-gradient(45deg, rgba(247, 242, 230, .02) 0 1px, transparent 1px 7px);
  background-size: 44px 44px, 44px 44px, auto;
  transition: transform .72s var(--ease);
}
.store-loader::before {
  content: "";
  position: absolute;
  width: min(760px, 92vw);
  aspect-ratio: 1;
  border: 1px solid rgba(247, 242, 230, .1);
  border-radius: 50%;
  box-shadow:
    0 0 0 72px rgba(247, 242, 230, .018),
    0 0 0 144px rgba(247, 242, 230, .012);
}
.store-loader.is-leaving {
  transform: translateY(-102%);
  pointer-events: none;
}
.loader-paper {
  position: relative;
  isolation: isolate;
  width: min(380px, 100%);
  padding: 22px 26px 24px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 0 28px 70px -22px rgba(0, 0, 0, .72);
  animation: loader-ticket-in .65s var(--ease) both;
}
.loader-paper::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .42;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(92, 85, 68, .055) 27px 28px),
    radial-gradient(circle at 20% 10%, rgba(178, 58, 38, .055), transparent 34%);
}
.loader-paper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  border-top: 1px dashed var(--line);
}
.loader-ticket-no {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--ink-3);
}
.loader-mark {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  margin: 24px auto 15px;
  place-items: center;
  border: 1px solid var(--ink);
}
.loader-mark::before,
.loader-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--line);
}
.loader-mark::after {
  inset: -5px 28px;
  border-width: 1px 0;
  border-color: var(--accent);
  animation: loader-scan 1.6s var(--ease) infinite alternate;
}
.loader-mark span {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 1;
  color: var(--accent);
}
.loader-shop {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(37px, 11vw, 47px);
  line-height: .95;
  text-transform: uppercase;
}
.loader-kind {
  margin: 7px 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.loader-stamp {
  position: absolute;
  top: 18px;
  right: 20px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
  opacity: .72;
  transform: rotate(8deg);
}
.loader-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 15px;
}
.loader-rule::before,
.loader-rule::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
.loader-rule i {
  width: 5px;
  height: 5px;
  background: var(--ink);
  transform: rotate(45deg);
}
.loader-progress {
  height: 5px;
  overflow: hidden;
  background: var(--paper-3);
  border: 1px solid var(--line);
}
.loader-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .32s var(--ease);
}
.loader-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.loader-meta b {
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.js.store-loading body > .sheet {
  opacity: 0;
  transform: translateY(22px) scale(.985);
}
.js.store-ready body > .sheet {
  animation: store-sheet-in .82s var(--ease) both;
}
.js.store-ready .topbar,
.js.store-ready .hero-main,
.js.store-ready .hero-ledger {
  animation: store-part-in .62s var(--ease) both;
}
.js.store-ready .hero-main { animation-delay: .12s; }
.js.store-ready .hero-ledger { animation-delay: .2s; }
@keyframes loader-ticket-in {
  from { opacity: 0; transform: translateY(24px) rotate(-1deg); }
}
@keyframes loader-scan {
  from { transform: translateY(-6px); }
  to { transform: translateY(6px); }
}
@keyframes store-sheet-in {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes store-part-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- the paper sheet ---------- */
.sheet {
  max-width: 1240px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sheet);
  overflow: clip;
}

.pad { padding-inline: clamp(16px, 4vw, 44px); }

/* thin double rule used to separate major sections */
.rule {
  border: 0;
  border-top: 1px solid var(--line-strong);
  margin: 0;
  position: relative;
}
.rule::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 2px;
  border-top: 1px solid var(--line);
}
.js .rule { transform: scaleX(0); transform-origin: left center; }
.js .rule.drawn {
  transform: scaleX(1);
  transition: transform .5s var(--ease);
}

/* L-bracket corners — the bill-book framing detail */
.brackets { position: relative; }
.brackets > i {
  position: absolute; width: 12px; height: 12px;
  border: 2px solid var(--ink);
  pointer-events: none;
}
.brackets > i:nth-child(1) { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.brackets > i:nth-child(2) { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.brackets > i:nth-child(3) { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.brackets > i:nth-child(4) { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

/* ---------- type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
  line-height: .96;
  margin: 0;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-2);
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fdf9ef;
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fdf9ef; }

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
}
.btn-quiet:hover { background: var(--paper-3); color: var(--ink); }
.btn-under { text-decoration: underline; text-underline-offset: 3px; }

.btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}
.btn[disabled]:hover { background: var(--accent); color: #fdf9ef; }
.btn.btn[disabled]:not(.btn-primary):hover { background: var(--paper); color: var(--ink); }

:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
  flex-wrap: wrap;
}
.topbar .loc { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.topbar .loc svg { width: 13px; height: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cart-btn { position: relative; }
.cart-badge[hidden] { display: none; }
.cart-badge {
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fdf9ef;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  gap: 24px;
  padding-block: 32px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(40px, 7vw, 72px);
  text-transform: uppercase;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero-tag {
  max-width: 46ch;
  font-size: 17px;
  color: var(--ink-2);
  margin: 16px 0 0;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}
.hero-meta b { color: var(--ink); font-weight: 600; }

/* a true extract of the rate list, framed like a page of the bill book */
.hero-ledger {
  border: 1px solid var(--ink);
  background: var(--paper-2);
  padding: 20px;
  min-width: 0;
}
.ledger-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.ledger-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ledger-rows li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-block: 8px;
  border-bottom: 1px dashed var(--line);
}
.ledger-rows li:last-child { border-bottom: 0; }
.lr-n {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}
.lr-n::after {
  content: "";
  flex: 1;
  border-bottom: 1px dotted var(--ink-3);
  opacity: .55;
  transform: translateY(-3px);
}
.lr-p {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lr-p small { color: var(--ink-3); font-size: 11px; font-weight: 400; }
.ledger-note {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

@media (min-width: 880px) {
  .hero { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* ---------- sticky rate-list bar ---------- */
.sticky-sentinel { height: 1px; }
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .sticky-bar { background: color-mix(in srgb, var(--paper) 93%, transparent); }
}
@supports (backdrop-filter: blur(2px)) {
  .sticky-bar { backdrop-filter: blur(8px); }
}
.sticky-bar.is-stuck {
  border-bottom-color: var(--line);
}
.sticky-bar.is-stuck .toolbar h2 { color: var(--ink); }
@media (max-width: 640px) {
  .sticky-bar .count-note { display: none; }
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block: 16px;
}
.toolbar h2 {
  font-size: 20px;
  margin: 0;
  margin-right: 4px;
}
.count-note {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.search {
  flex: 1 1 190px;
  max-width: 320px;
  margin-inline-start: auto;
  position: relative;
}
.search svg {
  position: absolute; left: 12px; top: 50%;
  translate: 0 -50%;
  width: 16px; height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { background: var(--paper-2); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- ledger grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  margin-bottom: clamp(24px, 4vw, 44px);
}
.card {
  background: var(--paper);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 128px;
}
.card:hover { background: var(--paper-2); }
/* scroll reveal — only when JS is running (html.js), so content never hides without it */
.js .card:not(.is-in) { opacity: 0; transform: translateY(14px); }
.card {
  transition:
    background-color .15s var(--ease),
    opacity .38s var(--ease),
    transform .38s var(--ease);
}
.js .card { transition-delay: 0s, calc(var(--i, 0) * 45ms), calc(var(--i, 0) * 45ms); }
.card.is-in { opacity: 1; transform: none; }
.card-img {
  position: relative;
  margin: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background: var(--paper-2);
}
/* one grade for every photo, so 19 images from different sources read as one
   printed set: a touch less saturation, then a faint paper veil over the plate */
.card-img img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  filter: saturate(.86) contrast(1.05) brightness(1.02);
}
.card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--paper);
  opacity: .10;
  pointer-events: none;
}
.card.oos .card-img img { filter: grayscale(1) saturate(.6); opacity: .55; }
.card-name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
}
.card-price {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.card-price small {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}
.card-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-foot .ctrl {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 120px;
  min-width: 0;
}
.card-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--ink-3);
}
.wt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.wt .add-btn, .wt .stepper { align-self: flex-end; }
.wt-size {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 4px;
  width: 100%;
  min-width: 0;
}
.wt-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.wt-row .add-btn, .wt-row .stepper { align-self: stretch; }
.wt-custom {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
}
.wt-custom::placeholder { color: var(--ink-3); }
.wt-custom:focus { outline: none; border-color: var(--ink-3); }
@media (pointer: coarse) {
  .wt-custom { font-size: 16px; }   /* keep phones from zooming on focus */
}
.wt-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.wt-hint[hidden] { display: none; }
.add-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.add-btn:hover { background: var(--ink); color: var(--paper); }

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
}
.st-btn {
  width: 32px;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
  padding-block: 4px;
}
.st-btn:hover { background: var(--paper-3); }
.st-qty {
  min-width: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  border-inline: 1px solid var(--line);
}

/* out of stock */
.card.oos .card-name,
.card.oos .card-price { color: var(--ink-3); }
.oos-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--accent-deep);
  border: 1px solid currentColor;
  padding: 2px 7px;
  border-radius: 3px;
}

/* empty search / catalog */
.empty {
  border: 1px dashed var(--ink-3);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: clamp(24px, 4vw, 44px);
}
.empty p { margin: 0 0 4px; font-size: 14px; color: var(--ink-2); }
.empty .display { font-size: 22px; margin-bottom: 8px; }

/* ---------- find us ---------- */
.findus {
  display: grid;
  gap: 24px;
  padding-block: 32px;
}
@media (min-width: 880px) {
  .findus { grid-template-columns: 1.2fr 1fr; }
}
.findus h2 { font-size: clamp(26px, 4vw, 36px); }
.findus-info { display: grid; gap: 0; align-content: start; }
.findus-info .row {
  display: flex;
  gap: 12px;
  padding-block: 12px;
  border-bottom: 1px dashed var(--line);
  align-items: baseline;
}
.findus-info .row:last-child { border-bottom: 0; }
.findus-info .k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-3);
  min-width: 80px;
}
.findus-info .v { font-size: 15px; }
.findus-info a { color: var(--ink); text-underline-offset: 3px; }
.findus-info a:hover { color: var(--accent-deep); }

.map-frame {
  border: 1px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-2);
  min-height: 280px;
}
.map-frame iframe { display: block; width: 100%; height: 100%; min-height: 280px; border: 0; }

/* ---------- footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-block: 16px 20px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.foot a { color: var(--ink-2); }

/* ---------- cart drawer ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(24, 22, 15, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  z-index: 40;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(430px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--ink);
  transform: translateX(103%);
  transition: transform .3s var(--ease);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ink);
}
.drawer-head .display { font-size: 22px; }
.drawer-close {
  border: 1px solid var(--ink);
  background: var(--paper);
  width: 34px; height: 34px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.drawer-close:hover { background: var(--ink); color: var(--paper); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px 12px; }

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding-block: 12px;
  border-bottom: 1px dashed var(--line);
}
.cart-row .n { font-weight: 500; font-size: 15px; overflow-wrap: anywhere; }
.cart-row .p {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-align: right;
}
.cart-row .ctrl {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.rm-btn {
  border: 0; background: none;
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px 2px;
}
.rm-btn:hover { color: var(--accent-deep); }

.drawer-empty { text-align: center; padding: 48px 12px; }
.drawer-empty .display { font-size: 22px; margin-bottom: 8px; }
.drawer-empty p { font-size: 14px; color: var(--ink-2); margin: 0; }

.drawer-foot {
  border-top: 1px solid var(--ink);
  padding: 16px 20px;
  background: var(--paper-2);
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--ink-3);
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 4px 1px;
  color: var(--ink);
}
.field input:focus { border-bottom-color: var(--accent); }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 8px 12px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  margin-top: 4px;
}
.total-row .display { font-size: 18px; }
.total-row .amt {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.send-note {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin: 12px 0 0;
}
#send-btn { width: 100%; justify-content: center; padding-block: 12px; font-size: 14px; }
.drawer-foot .clear { display: flex; justify-content: center; margin-top: 8px; }

/* ---------- mobile order bar ---------- */
.orderbar {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 30;
  display: none;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border: 0;
  width: calc(100% - 24px);
  font-family: var(--font-mono);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
}
.orderbar .sum {
  font-size: 12.5px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.orderbar .go { font-size: 13px; font-weight: 600; color: var(--paper); }
.orderbar.show { display: flex; }
@media (max-width: 720px) {
  .drawer { width: 100%; }
}

/* ---------- admin ---------- */
.admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-block: 16px;
}
.admin-top .display { font-size: 24px; }
.admin-top .spacer { flex: 1; }
.status-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.status-chip.dirty { border-color: var(--accent-deep); color: var(--accent-deep); }

.gate {
  max-width: 380px;
  margin: 8vh auto 12vh;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  padding: 24px;
  text-align: center;
}
.gate .display { font-size: 24px; margin-bottom: 8px; }
.gate p { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); margin: 0 0 16px; }
.gate input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: .3em;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--ink);
  background: var(--paper);
  margin-bottom: 12px;
}
.gate .err { color: var(--accent-deep); font-family: var(--font-mono); font-size: 11.5px; min-height: 16px; margin: 8px 0 0; }

.admin-section { padding-block: 24px; }
.admin-section > h2 { font-size: 20px; margin-bottom: 4px; }
.admin-section > .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  margin: 0 0 16px;
}

.item-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  padding: 16px;
  margin-bottom: 16px;
}
.item-form .f { display: grid; gap: 4px; }
.item-form label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-2);
}
.item-form input, .item-form select, .settings-form input {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--ink-3);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.item-form input:focus, .item-form select:focus, .settings-form input:focus { border-color: var(--accent); }
.item-form .stock-f {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding-top: 18px;
}
.item-form .stock-f input { width: auto; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }

.tbl-wrap { overflow-x: auto; }
table.items {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.items th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-3);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
table.items td {
  padding: 9px 10px;
  border-bottom: 1px dashed var(--line);
  vertical-align: middle;
}
table.items tr.flash td { animation: rowflash 1.6s var(--ease); }
@keyframes rowflash { 0% { background: var(--paper-3); } }
table.items .mono { font-size: 13px; }
table.items td.actions { white-space: nowrap; text-align: right; }
table.items .mini {
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--ink-3);
  background: transparent;
  border-radius: 6px;
  padding: 4px 11px;
  cursor: pointer;
  color: var(--ink);
}
table.items .mini:hover { border-color: var(--ink); background: var(--paper-2); }
table.items .mini.nav { padding: 4px 8px; }
table.items .mini.nav:disabled { opacity: .3; cursor: default; }
table.items .mini.nav:disabled:hover { border-color: var(--ink-3); background: transparent; }
table.items .mini.danger { color: var(--accent-deep); border-color: var(--accent-deep); }
table.items .mini.danger:hover { background: var(--accent); border-color: var(--accent); color: #fdf9ef; }
table.items input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
/* search row above the items table */
.tbl-tools { display: flex; gap: 8px; align-items: center; margin: 10px 0 12px; max-width: 560px; }
.tbl-tools #item-search {
  flex: 1;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--ink-3);
  background: var(--paper);
  color: var(--ink);
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.tbl-tools #item-search:focus { border-color: var(--accent); outline: none; }
.tbl-tools #item-search::-webkit-search-cancel-button { -webkit-appearance: none; }
.tbl-note { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 10px; }

.cat-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 6px 8px 6px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.cat-pill .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.cat-pill button {
  border: 0; background: transparent;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
}
.cat-pill button:hover { color: var(--accent-deep); background: var(--paper-3); }

.cat-add { display: flex; gap: 10px; max-width: 420px; }
.cat-add input { flex: 1; }

.settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  max-width: 860px;
}
.settings-form .f { display: grid; gap: 4px; }
.settings-form label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-2);
}
.settings-form .wide { grid-column: 1 / -1; }
.settings-hint {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

/* live image check under the image field */
.img-check {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.img-check.warn {
  color: var(--red);
  border-left: 2px solid var(--red);
  padding-left: 8px;
}
.img-prev {
  margin-top: 6px;
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  overflow: hidden;
}
.img-prev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  max-width: 980px;
}
.publish-card {
  border: 1px solid var(--ink);
  padding: 16px;
  background: var(--paper);
  display: grid;
  gap: 8px;
  align-content: start;
}
.publish-card b { font-size: 14.5px; }
.publish-card p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  margin: 0 0 4px;
}
.publish-card ol {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  margin: 0;
  padding-left: 18px;
  text-align: left;
}

.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  translate: -50% 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 18px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), translate .2s var(--ease);
  z-index: 60;
}
.toast.show { opacity: 1; translate: -50% -6px; }

.banner {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-3);
  color: var(--ink-2);
}
.banner a { color: var(--accent-deep); }

/* ---------- small screens: the rate list reads as rows, not big tiles ---------- */
@media (max-width: 640px) {
  .card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-areas:
      "img name"
      "img price"
      "img foot";
    column-gap: 12px;
    row-gap: 2px;
    align-content: start;
    align-items: start;
    padding: 12px;
  }
  .card-img {
    grid-area: img;
    width: 92px;
    aspect-ratio: 1 / 1;
  }
  .card-name { grid-area: name; font-size: 14.5px; }
  .card-price { grid-area: price; font-size: 18px; }
  .card-foot { grid-area: foot; margin-top: 8px; }
  .card-foot .ctrl { flex-basis: 100%; }   /* controls get a full-width line on phones */
  .hero h1 { font-size: clamp(34px, 10vw, 44px); }
  .findus-info .k { min-width: 64px; }
}

/* ---------- motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .store-loader::before,
  .loader-mark::after { animation: none; }
  .store-loader.is-leaving { opacity: 0; transform: none; }
  .drawer { transform: translateX(0); visibility: hidden; }
  .drawer.show { visibility: visible; }
  /* keep everything static and fully visible */
  .js .card:not(.is-in) { opacity: 1; transform: none; }
  .js .rule { transform: scaleX(1); }
}
