:root {
  color-scheme: light;
  --ink: #23201d;
  --muted: #645d55;
  --paper: #fffaf2;
  --panel: #ffffff;
  --line: #ddd2c2;
  --accent: #a94438;
  --accent-dark: #7d2e27;
  --sage: #607b65;
  --gold: #d29a38;
  --shadow: 0 16px 40px rgb(66 48 30 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgb(255 250 242 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

nav {
  align-items: center;
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-weight: 700;
}

nav a {
  text-decoration: none;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.hero {
  min-height: 66vh;
  display: grid;
  align-items: end;
  padding: clamp(30px, 7vw, 86px) clamp(18px, 4vw, 56px);
  background:
    linear-gradient(90deg, rgb(35 32 29 / 78%), rgb(35 32 29 / 24%)),
    url("https://images.unsplash.com/photo-1509440159596-0249088772ff?auto=format&fit=crop&w=1800&q=82") center / cover;
  color: white;
}

.hero-copy {
  max-width: 760px;
}

.hero h2 {
  margin: 8px 0 16px;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 610px;
  color: rgb(255 255 255 / 88%);
  font-size: 1.1rem;
}

.section {
  padding: clamp(34px, 5vw, 56px) clamp(18px, 4vw, 56px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 24px;
  align-items: start;
}

.order-grid {
  display: block;
}

.order-products > .eyebrow,
.cart-column > .eyebrow,
.checkout-form-column > .eyebrow {
  margin-bottom: 16px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.product-selection-panel {
  display: grid;
  gap: 16px;
}

.product-selection-panel > h2 {
  margin-bottom: 0;
}

.product-card,
.panel,
.calendar-shell,
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.calendar-shell,
dialog {
  background: var(--panel);
}

.product-card {
  background: var(--panel);
}

.product-card {
  display: grid;
  gap: 12px;
  position: relative;
  overflow: visible;
}

.product-card:hover,
.product-card:focus-within {
  z-index: 8;
}

.product-card > div:not(.product-image) {
  padding: 0 18px;
}

.product-card > div:not(.product-image):last-child {
  padding-bottom: 18px;
}

.product-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: white;
}

.product-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.product-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.product-card p {
  margin: 0;
  color: var(--muted);
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.date-card {
  max-width: 440px;
}

.date-note {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  padding: clamp(18px, 3vw, 24px);
}

.cart-column {
  max-width: 560px;
}

.cart-panel {
  position: static;
}

.checkout-grid > aside {
  margin-top: 28px;
}

.admin-shell {
  padding: clamp(34px, 5vw, 56px) clamp(18px, 4vw, 56px);
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  min-height: calc(100vh - 82px);
  display: grid;
  place-items: center;
  padding: clamp(34px, 6vw, 70px) clamp(18px, 4vw, 56px);
}

.orders-shell {
  padding: clamp(34px, 5vw, 56px) clamp(18px, 4vw, 56px);
}

.orders-page {
  max-width: 900px;
}

.auth-card {
  width: min(100%, 460px);
}

.auth-card h2 {
  margin-bottom: 8px;
}

.auth-legal {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.admin-login {
  max-width: 440px;
}

.admin-orders {
  display: grid;
  gap: 18px;
}

.admin-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.admin-summary .panel {
  display: grid;
  gap: 6px;
}

.admin-summary span {
  color: var(--muted);
  font-weight: 700;
}

.admin-summary strong {
  font-size: 1.55rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-table td span {
  display: block;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.good {
  background: rgb(96 123 101 / 14%);
  color: var(--sage);
}

.status-pill.pending {
  background: rgb(210 154 56 / 16%);
  color: #7a5520;
}

.status-pill.muted {
  background: rgb(100 93 85 / 13%);
  color: var(--muted);
}

.cart-items {
  display: grid;
  gap: 10px;
  min-height: 70px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.quantity-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.locked-controls {
  cursor: help;
}

.control-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 6;
  display: none;
  grid-template-columns: auto 1fr;
  gap: 10px;
  width: min(320px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  box-shadow: 6px 6px 0 rgb(35 32 29 / 16%);
  line-height: 1.35;
  text-align: left;
}

.control-tooltip::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -9px;
  width: 16px;
  height: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
  transform: rotate(45deg);
}

.locked-controls:hover .control-tooltip,
.locked-controls:focus-within .control-tooltip {
  display: grid;
}

.tooltip-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-dark);
  font-weight: 900;
  line-height: 1;
}

.tooltip-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.tooltip-copy {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin: 18px 0;
  font-size: 1.2rem;
}

.summary-line {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 800;
}

label,
legend {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 7px;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(169 68 56 / 16%);
}

input[readonly] {
  cursor: pointer;
}

#delivery-date {
  min-height: 48px;
  border-color: var(--accent);
  background: #fff6ed;
  color: var(--accent-dark);
  font-weight: 800;
  text-align: center;
}

#delivery-date::placeholder {
  color: var(--accent-dark);
  opacity: 1;
}

#delivery-date:hover {
  background: #faece1;
}

.button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
}

.button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.button:disabled,
.icon-button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.button:disabled:hover,
.icon-button:disabled:hover,
.button[aria-disabled="true"]:hover {
  border-color: var(--line);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.full {
  display: block;
  width: 100%;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-weight: 700;
}

.payment-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

#checkout-account-note {
  margin-bottom: 12px;
}

.checkout-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.account-panel {
  display: grid;
  gap: 14px;
}

.account-copy h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.account-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-history {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.order-history h4 {
  margin: 0;
  font-size: 1rem;
}

.order-history-list {
  display: grid;
  gap: 14px;
}

.order-history-item {
  display: grid;
  gap: 12px;
}

.order-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.order-history-head div {
  display: grid;
  gap: 4px;
}

.order-history-head span,
.order-history-head em,
.order-history-details span,
.order-notes {
  color: var(--muted);
}

.order-history-head em {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgb(96 123 101 / 14%);
  color: var(--sage);
  font-style: normal;
  font-weight: 800;
  text-transform: capitalize;
}

.order-history-item ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-history-item li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.order-history-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf6ed;
}

.order-history-details span,
.order-notes {
  display: grid;
  gap: 2px;
}

.order-history-details strong,
.order-notes strong {
  color: var(--ink);
}

.order-notes {
  margin: 0;
}

.status:empty {
  display: none;
}

.status.good {
  color: var(--sage);
}

.status.bad {
  color: var(--accent-dark);
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-shell {
  overflow: hidden;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row span {
  padding: 12px;
  background: #f4eadb;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.calendar-day {
  min-height: 112px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: white;
  text-align: left;
}

.calendar-day:nth-child(7n + 1) {
  border-left: 0;
}

.calendar-day.muted {
  color: #a19486;
  background: #fbf6ed;
}

.day-number {
  font-weight: 900;
}

.day-capacity {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf3ed;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 900;
}

.calendar-day.sold-out .day-capacity {
  background: #fae7e3;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-day.sold-out {
  background:
    linear-gradient(135deg, rgb(169 68 56 / 9%), rgb(255 255 255 / 0) 55%),
    white;
}

.calendar-day.sold-out .day-number {
  color: var(--accent-dark);
}

.calendar-day.selected {
  position: relative;
  border-color: var(--accent);
  background: #fff6ed;
  outline: 3px solid rgb(169 68 56 / 18%);
  outline-offset: -3px;
}

.calendar-day:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}

.segmented legend {
  width: 100%;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
}

.segmented input {
  width: auto;
  min-height: auto;
}

.checkout-form,
.mailing-form {
  display: grid;
  gap: 14px;
}

.form-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.confetti-burst {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  overflow: hidden;
}

.confetti-burst span {
  position: absolute;
  bottom: -18px;
  left: var(--x);
  width: 9px;
  height: 14px;
  border-radius: 2px;
  background: var(--color);
  animation: confetti-pop 1.45s cubic-bezier(0.14, 0.72, 0.36, 1) var(--delay) forwards;
}

.confetti-burst span:nth-child(3n) {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.confetti-burst span:nth-child(4n) {
  width: 12px;
  height: 6px;
}

@keyframes confetti-pop {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.7) rotate(0deg);
  }

  12% {
    opacity: 1;
  }

  58% {
    opacity: 1;
    transform: translate3d(var(--burst-x), calc(-1 * var(--burst-y)), 0) scale(1) rotate(var(--spin));
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--burst-x), calc(-1 * var(--burst-y) + var(--settle)), 0) scale(0.9) rotate(var(--spin));
  }
}

dialog {
  max-width: 460px;
  width: calc(100% - 36px);
  padding: 24px;
}

.calendar-modal {
  max-width: min(940px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: clamp(14px, 2vw, 20px);
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.calendar-modal h2 {
  margin-bottom: 0;
}

.calendar-modal .calendar-controls {
  margin-bottom: 10px;
}

.calendar-modal .weekday-row span {
  padding: 8px;
}

.calendar-modal .calendar-day {
  min-height: clamp(70px, 9vh, 92px);
  padding: 8px;
}

.calendar-modal .day-capacity {
  margin-top: 8px;
}

dialog::backdrop {
  background: rgb(35 32 29 / 45%);
}

@media (max-width: 820px) {
  .site-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-grid,
  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .checkout-grid > aside {
    margin-top: 0;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-summary {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 86px;
    padding: 8px;
  }

  .calendar-modal .calendar-day {
    min-height: 68px;
    padding: 6px;
  }
}

@media (max-width: 560px) {
  nav {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .hero {
    min-height: 60vh;
  }

  .weekday-row span {
    padding: 8px 4px;
    font-size: 0.7rem;
  }

  .day-capacity {
    font-size: 0.68rem;
    padding: 4px 5px;
  }

  .calendar-modal {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    padding: 12px;
  }

  .calendar-modal .calendar-day {
    min-height: 58px;
    padding: 5px;
  }

  .calendar-modal .day-capacity {
    margin-top: 5px;
  }

  .form-row.split,
  .inline-form,
  .checkout-choice {
    grid-template-columns: 1fr;
  }

  .account-row,
  .order-history-item {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .account-row {
    flex-direction: column;
  }

}
