/* Order page. Shares tokens/header/buttons with ../styles.css.
   Author rules like `display: grid` beat the browser's [hidden] rule, so
   restore it explicitly — otherwise "hidden" fields (delivery address, empty
   cart badge) would stay visible. */
[hidden] {
  display: none !important;
}

:root {
  --header-h: 70px;
  --success: #7fd69a;
}

.order-body {
  background:
    radial-gradient(circle at 8% 0%, rgba(188, 40, 29, 0.2), transparent 26rem),
    radial-gradient(circle at 90% 0%, rgba(219, 161, 75, 0.1), transparent 24rem),
    var(--charcoal);
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ---- Header -------------------------------------------------------------- */

.order-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.order-back {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.order-back:hover {
  color: var(--gold-bright);
}

.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 800;
}

/* ---- Hero ---------------------------------------------------------------- */

.order-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.order-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.order-hero .eyebrow {
  margin-bottom: 8px;
}

.order-hero h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

#store-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}

#store-status::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

#store-status[data-state="open"]::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(127, 214, 154, 0.18);
}

#store-status[data-state="paused"] {
  border-color: rgba(188, 40, 29, 0.5);
  color: #f3b9b3;
}

#store-status[data-state="paused"]::before {
  background: #e5574b;
}

/* ---- Layout -------------------------------------------------------------- */

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 22px;
  align-items: start;
}

.menu-panel,
.cart-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.menu-panel {
  padding: 0 22px 22px;
}

/* ---- Category bar (sticks under the header while the menu scrolls) --------- */

.menu-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  margin: 0 -22px 18px;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: rgba(23, 19, 15, 0.94);
  backdrop-filter: blur(10px);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tabs button {
  flex: 0 0 auto;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.category-tabs button:hover {
  border-color: rgba(219, 161, 75, 0.45);
  color: var(--cream);
}

.category-tabs button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
}

/* ---- Menu items ------------------------------------------------------------ */

.order-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.empty-note {
  grid-column: 1 / -1;
  margin: 24px 0;
  color: var(--muted);
  text-align: center;
}

.menu-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  grid-template-areas:
    "body media"
    "foot media";
  grid-template-rows: 1fr auto;
  column-gap: 14px;
  row-gap: 10px;
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.menu-item:hover {
  border-color: rgba(219, 161, 75, 0.45);
  background: rgba(251, 238, 217, 0.07);
  transform: translateY(-2px);
}

.menu-item-media {
  grid-area: media;
  align-self: stretch;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(251, 238, 217, 0.05);
}

.menu-item-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-item-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, rgba(219, 161, 75, 0.14), rgba(188, 40, 29, 0.08));
  color: rgba(242, 194, 110, 0.55);
}

.menu-item-body {
  grid-area: body;
  min-width: 0;
}

.menu-item h3 {
  margin: 0 0 6px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 17px;
  line-height: 1.25;
}

.menu-item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.menu-item-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
}

.menu-item-foot strong {
  color: var(--gold-bright);
  font-size: 16px;
  font-weight: 800;
}

.menu-item-add {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.2s, transform 0.2s;
}

.menu-item:hover .menu-item-add {
  background: var(--gold-bright);
  transform: scale(1.06);
}

/* ---- Cart panel -------------------------------------------------------------- */

.cart-panel {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  padding: 22px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.cart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cart-head h2 {
  margin: 0;
  font-size: 24px;
}

.cart-title-count {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 16px 0 18px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.type-toggle button {
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.type-toggle button.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
}

.cart-lines {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.empty-cart {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 22px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-cart svg {
  color: rgba(242, 194, 110, 0.6);
}

.empty-cart p {
  margin: 6px 0 0;
  color: var(--cream);
  font-weight: 700;
}

.empty-cart small {
  font-size: 13px;
}

.cart-line {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.cart-line-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
}

.cart-line-main strong {
  color: var(--cream);
  white-space: nowrap;
}

.cart-line small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.stepper button {
  width: 34px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--cream);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}

.stepper button:hover {
  background: rgba(251, 238, 217, 0.1);
}

.stepper span {
  min-width: 30px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.link-button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: #f3b9b3;
}

/* ---- Checkout form ------------------------------------------------------------ */

.checkout-form {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-heading {
  margin: 0 0 2px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 16px;
}

.checkout-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* 16px minimum so iOS Safari doesn't zoom the page when a field is focused. */
.checkout-form input,
.checkout-form textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--cream);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.checkout-form input::placeholder,
.checkout-form textarea::placeholder {
  color: rgba(251, 238, 217, 0.35);
}

.checkout-form input:focus,
.checkout-form textarea:focus {
  border-color: var(--gold);
  background: rgba(251, 238, 217, 0.07);
}

.checkout-form textarea {
  resize: vertical;
}

/* ---- Totals + submit ------------------------------------------------------------ */

.totals {
  display: grid;
  gap: 8px;
  margin: 20px 0 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.totals strong {
  color: var(--cream);
  font-weight: 700;
}

.total-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
}

.total-row span {
  color: var(--cream);
}

.total-row strong {
  color: var(--gold-bright);
  font-size: 20px;
  font-weight: 800;
}

.place-order {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 14px 30px rgba(219, 161, 75, 0.18);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}

.place-order:hover:not(:disabled) {
  filter: brightness(1.06);
}

.place-order:disabled {
  box-shadow: none;
  opacity: 0.38;
  cursor: not-allowed;
}

.checkout-message {
  margin: 0;
  color: var(--cream);
  font-size: 14px;
  line-height: 1.5;
}

.checkout-message:not(:empty) {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(219, 161, 75, 0.35);
  border-radius: 10px;
  background: rgba(219, 161, 75, 0.08);
}

/* ---- Item dialog ---------------------------------------------------------------- */

.item-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(90vh, 800px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--cream);
  box-shadow: var(--shadow);
}

.item-dialog[open] {
  display: flex;
  flex-direction: column;
}

.item-dialog::backdrop {
  background: rgba(8, 6, 5, 0.72);
  backdrop-filter: blur(4px);
}

#dialog-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(90vh, 800px);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(251, 238, 217, 0.25);
  border-radius: 50%;
  background: rgba(16, 14, 12, 0.72);
  backdrop-filter: blur(6px);
  color: var(--cream);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.dialog-close:hover {
  background: rgba(16, 14, 12, 0.92);
}

.dialog-image {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 24px 8px;
  overflow-y: auto;
}

.dialog-body h2 {
  margin: 0 36px 8px 0;
  font-size: 26px;
}

.dialog-description {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.choice-group {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
}

.choice-group h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 2px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 16px;
}

.choice-hint {
  color: var(--muted);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.choice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice-row:hover {
  border-color: rgba(219, 161, 75, 0.4);
}

.choice-row:has(input:checked) {
  border-color: var(--gold);
  background: rgba(219, 161, 75, 0.09);
}

.choice-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.choice-price {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.choice-row input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid rgba(251, 238, 217, 0.4);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice-row input[type="radio"] {
  border-radius: 50%;
}

.choice-row input[type="checkbox"] {
  border-radius: 6px;
}

.choice-row input:checked {
  border-color: var(--gold);
  background: var(--gold);
}

.choice-row input[type="radio"]:checked {
  box-shadow: inset 0 0 0 4px var(--panel);
}

.choice-row input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232a1c12' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.4 3 3 6-6.8'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
}

.choice-name select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--charcoal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fbeed9' stroke-opacity='.7' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
  color: var(--cream);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.dialog-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(188, 40, 29, 0.55);
  border-radius: 10px;
  background: rgba(188, 40, 29, 0.14);
  color: #f6c3bd;
  font-size: 14px;
}

.dialog-actions {
  flex: 0 0 auto;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.dialog-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.dialog-actions button:hover {
  filter: brightness(1.06);
}

/* ---- Footer + mobile cart bar ------------------------------------------------------ */

.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.order-footer p {
  margin: 0;
}

.mobile-cart-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  color: var(--ink);
  font-weight: 800;
}

.mobile-cart-info {
  display: grid;
  gap: 1px;
  font-size: 13px;
}

.mobile-cart-info strong {
  font-size: 17px;
}

.mobile-cart-action {
  font-size: 15px;
}

/* ---- Responsive -------------------------------------------------------------------- */

@media (max-width: 960px) {
  .order-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .order-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cart-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .mobile-cart-bar {
    display: flex;
  }

  .mobile-cart-bar[hidden] {
    display: none !important;
  }

  .order-body.has-cart .order-footer {
    margin-bottom: 76px;
  }

  #checkout {
    scroll-margin-top: calc(var(--header-h) + 12px);
  }
}

@media (max-width: 620px) {
  :root {
    --header-h: 56px;
  }

  .order-nav {
    gap: 12px;
  }

  .order-back {
    display: none;
  }

  .order-shell {
    padding: 24px 0 40px;
  }

  .menu-panel {
    padding: 0 14px 14px;
    border-radius: 16px;
  }

  .menu-toolbar {
    margin: 0 -14px 14px;
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
  }

  .order-menu-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .cart-panel {
    padding: 18px;
    border-radius: 16px;
  }

  .menu-item {
    min-height: 124px;
  }

  .item-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  #dialog-content {
    max-height: 92vh;
  }

  .dialog-image {
    height: 170px;
  }

  .dialog-body {
    padding: 20px 18px 6px;
  }

  .dialog-actions {
    padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
  }

  .order-footer {
    flex-direction: column;
    gap: 6px;
  }
}

