:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6560;
  --accent: #c45c26;
  --accent-hover: #a34a1c;
  --border: #e8e2d9;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(26, 26, 26, 0.06);
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(1120px, calc(100% - 1.5rem));
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 0;
  padding-top: calc(0.85rem + env(safe-area-inset-top));
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 0;
}

.logo-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-mark {
  color: var(--accent);
  font-size: 1.25rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
}

.nav-link:hover {
  color: var(--text);
}

.cart-link {
  position: relative;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
}

.main-content {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

.footer-brands a {
  color: var(--text);
  font-weight: 500;
}

.footer-brands a:hover {
  color: var(--accent);
}

.hero {
  margin-bottom: 2.5rem;
}

.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 1rem;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0;
  max-width: 42rem;
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.category-chip {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.category-chip:hover,
.category-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(26, 26, 26, 0.1);
  }

  .product-card:hover .product-image {
    transform: scale(1.04);
  }
}

.product-image-link {
  aspect-ratio: 1;
  overflow: hidden;
  background: #f0ebe3;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}


.product-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.product-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.product-price {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0.25rem 0 0.75rem;
}

.add-form {
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

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

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  min-height: 40px;
}

.add-product-form {
  max-width: 32rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

.add-product-form .btn-primary {
  width: auto;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 400;
  margin: 0 0 1.5rem;
}

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.product-detail-image {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-detail-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.product-detail-title {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  margin: 0.25rem 0 0.75rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.product-detail-price {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}

.product-detail-desc {
  color: var(--muted);
  margin: 0 0 1rem;
}

.stock-note {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.detail-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.detail-add-form .btn-primary {
  width: auto;
  min-width: 10rem;
}

.qty-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.qty-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.qty-input {
  width: 4.5rem;
  min-height: 44px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cart-table th,
.cart-table td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cart-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #faf8f5;
}

.cart-product {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cart-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.cart-product a {
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.qty-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cart-summary {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.totals-breakdown {
  margin: 0;
  width: min(100%, 20rem);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 0.95rem;
}

.totals-row dt {
  color: var(--muted);
  font-weight: 500;
}

.totals-row dd {
  margin: 0;
  text-align: right;
}

.totals-row-total {
  border-top: 1px solid var(--border);
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  font-size: 1.05rem;
}

.free-badge {
  color: #2e7d32;
  font-weight: 600;
}

.shipping-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  text-align: right;
  width: min(100%, 20rem);
}

.checkout-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.checkout-form fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.checkout-form legend {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.checkout-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.checkout-form input,
.checkout-form textarea,
.checkout-form select {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.85rem;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
}

.checkout-form input[type="file"] {
  padding: 0.45rem 0;
  min-height: 0;
}

.checkout-note {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 1.25rem;
}

.order-summary {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.order-summary h2 {
  font-size: 1rem;
  margin: 0 0 1rem;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.summary-total {
  font-size: 1.1rem;
  margin: 0;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.alert-error {
  background: #fdecea;
  color: #8a1f11;
  border: 1px solid #f5c4be;
}

.alert-ok {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.test-mail-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1.5rem;
}

.test-mail-form .checkout-note {
  margin: 0;
}

.success-panel {
  text-align: center;
  max-width: 28rem;
  margin: 3rem auto;
}

.success-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.success-text {
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.success-totals {
  margin: 0 auto 1rem;
  text-align: left;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.order-meta {
  color: var(--muted);
  margin: -0.5rem 0 1.5rem;
}

.order-details h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.order-shipping-name {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.order-shipping-email,
.order-shipping-address {
  color: var(--muted);
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}

.nav-form {
  margin: 0;
}

.nav-button {
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.admin-login-form {
  max-width: 24rem;
}

.admin-table .muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eeeae4;
}

.status-new { background: #e8f0fe; color: #1a4d8f; }
.status-in_progress { background: #fff3e0; color: #a34a1c; }
.status-ready { background: #e8f5e9; color: #2e7d32; }
.status-shipped { background: #e8eaf6; color: #3949ab; }
.status-cancelled { background: #fdecea; color: #8a1f11; }
.status-paid { background: #e6f6ed; color: #0d6b32; }
.status-unpaid { background: #f4f1ea; color: #6b5e4e; }

.empty-state {
  color: var(--muted);
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
}

@media (max-width: 900px) {
  .product-detail,
  .checkout-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .container {
    width: min(1120px, calc(100% - 1.25rem));
  }

  .main-content {
    padding: 1.5rem 0 2.5rem;
  }

  .hero {
    margin-bottom: 1.75rem;
  }

  .hero-title {
    font-size: clamp(1.85rem, 8vw, 2.5rem);
  }

  .hero-title br {
    display: none;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .nav-links {
    gap: 0.35rem 0.85rem;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .product-body {
    padding: 0.85rem 0.9rem 1rem;
  }

  .product-name {
    font-size: 0.9rem;
  }

  .product-detail-title {
    font-size: 1.85rem;
  }

  .detail-add-form {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-add-form .btn-primary {
    width: 100%;
  }

  .cart-table,
  .cart-table tbody {
    display: block;
    width: 100%;
    overflow: hidden;
  }

  .cart-table thead {
    display: none;
  }

  .cart-table tr {
    display: block;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
  }

  .cart-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border: none;
    text-align: right;
  }

  .cart-table td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
    text-align: left;
  }

  .cart-table td.cart-product,
  .cart-table td:first-child {
    justify-content: flex-start;
    text-align: left;
  }

  .cart-table td.cart-product::before,
  .cart-table td[data-label=""]::before {
    content: none;
  }

  .cart-summary {
    align-items: stretch;
  }

  .cart-summary .btn-primary,
  .totals-breakdown,
  .shipping-hint,
  .checkout-form .btn-primary,
  .admin-login-form .btn-primary {
    width: 100%;
  }

  .shipping-hint {
    text-align: left;
  }

  .add-product-form {
    padding: 1.15rem;
  }

  .add-product-form .btn-primary {
    width: 100%;
  }

  .success-panel {
    margin: 1.5rem auto;
  }

  .success-actions .btn-primary,
  .success-actions .btn-ghost {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .logo {
    font-size: 1rem;
  }
}
