:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1a1f1c;
  --muted: #5d6762;
  --accent: #1f6f43;
  --accent-dark: #16532f;
  --accent-soft: #e6f2eb;
  --highlight: #f2b134;
  --border: #dde3df;
  --surface: #eef2f0;
  --danger: #a33a2a;
  --danger-soft: #fbecea;
  --notice-bg: #fff4d6;
  --notice-text: #6b4e00;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 40, 26, 0.06), 0 2px 8px rgba(16, 40, 26, 0.05);
  --shadow-hover: 0 4px 10px rgba(16, 40, 26, 0.08), 0 12px 28px rgba(16, 40, 26, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); line-height: 1.2; margin: 0 0 20px; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; line-height: 1.3; }
:focus-visible { outline: 3px solid rgba(31, 111, 67, 0.45); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

main.container { flex: 1; width: 100%; padding-top: 28px; padding-bottom: 56px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 1.1rem;
  line-height: 1.15;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: inset 0 -3px 0 var(--highlight);
}
.brand-mark .icon { width: 22px; height: 22px; }

.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.main-nav a, .main-nav .link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
.main-nav a:hover, .main-nav .link-button:hover { background: var(--surface); color: var(--accent-dark); }
.main-nav .icon { width: 18px; height: 18px; color: var(--accent); }
.main-nav .nav-cta { background: var(--accent); color: #fff; }
.main-nav .nav-cta:hover { background: var(--accent-dark); color: #fff; }
.cart-badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--highlight);
  color: #3d2a00;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.placeholder-notice {
  background: var(--notice-bg);
  color: var(--notice-text);
  padding: 8px 0;
  font-size: 0.9rem;
}
.placeholder-inline { padding: 10px 14px; border-radius: var(--radius-sm); }

.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.message {
  background: var(--accent-soft);
  border: 1px solid #c4e0cf;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.message-error { background: var(--danger-soft); border-color: #f0c9c2; border-left-color: var(--danger); }
.message-warning { background: var(--notice-bg); border-color: #f2dea6; border-left-color: var(--highlight); }

.store-details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
.store-details dt { color: var(--muted); }
.store-details dd { margin: 0; }
.page-meta { color: var(--muted); font-size: 0.9rem; margin-top: 32px; }

/* Content pages get a card so long text stays readable */
.page, .product, .checkout-summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 32px);
  box-shadow: var(--shadow);
}
.page { max-width: 860px; }

/* Footer */
.site-footer { background: #13281c; color: #c9d6cf; font-size: 0.95rem; }
.site-footer a { color: #fff; }
.site-footer strong { color: #fff; }
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  padding-top: 36px;
  padding-bottom: 36px;
}
.footer-inner p { margin: 8px 0; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 8px; }
.footer-brand .brand-mark { width: 34px; height: 34px; }
.footer-line { display: flex; gap: 8px; align-items: flex-start; }
.footer-line .icon { width: 18px; height: 18px; margin-top: 3px; color: var(--highlight); }

@media (max-width: 480px) {
  .store-details { grid-template-columns: 1fr; }
  .store-details dd { margin-bottom: 8px; }
}

/* Search */
.search {
  position: relative;
  display: flex;
  flex: 1 1 280px;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 111, 67, 0.12); }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding-left: 38px; }
.search input:focus { outline: none; box-shadow: none; }
.search button { border-radius: 999px; padding: 6px 18px; }

input, select, textarea, button {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 111, 67, 0.12); }
button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:active { transform: translateY(1px); }

/* Home hero */
.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 36px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(242, 177, 52, 0.35), transparent 40%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 14px, transparent 14px 28px),
    linear-gradient(135deg, #1f6f43 0%, #13432a 100%);
  box-shadow: var(--shadow-hover);
}
.hero h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.8rem); margin-bottom: 12px; max-width: 18ch; }
.hero-lead { font-size: 1.1rem; max-width: 46ch; margin: 0 0 24px; color: #dcebe2; }
.hero-features { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.hero-features li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.95rem;
}
.hero-features .icon { width: 18px; height: 18px; color: var(--highlight); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; font-size: 1.5rem; }

/* Catalog */
.plain-list { list-style: none; padding: 0; margin: 0; }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.muted { color: var(--muted); font-size: 0.9rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: #c4d3ca; }
.tile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tile h2 { font-size: 1.1rem; margin: 0; }
.tile h2 a { color: var(--text); text-decoration: none; }
.tile h2 a:hover { color: var(--accent); }
.tile-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.chips a:hover { background: var(--accent); color: #fff; }

/* Subcategory tiles on a category page are whole-card links */
.tile-link { padding: 0; }
.tile-link a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.tile-link a:hover { color: var(--accent); }
.tile-link .icon { color: var(--accent); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.product-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.product-card a { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.product-card a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.product-card img, .photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.photo-placeholder {
  background:
    repeating-linear-gradient(45deg, rgba(31,111,67,0.05) 0 10px, transparent 10px 20px),
    var(--surface);
}
.product-card .product-name { padding: 0 4px; line-height: 1.35; }
.product-card .price, .product-card .status { margin: 0 4px; }
.product-card .price { margin-top: auto; }
.product-name { font-weight: 600; }
.price { font-weight: 750; font-size: 1.1rem; }
.price-unit { color: var(--muted); font-weight: 500; font-size: 0.9rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-in { color: var(--accent); background: var(--accent-soft); }
.status-out { color: var(--danger); background: var(--danger-soft); }

.product > h1 { margin-bottom: 24px; }
.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 32px; align-items: start; }
.product-photos { display: grid; gap: 10px; position: sticky; top: 96px; }
.product-photos img { width: 100%; border-radius: var(--radius); background: var(--surface); }
.product-photos img + img { width: calc(50% - 5px); }
.variants { width: 100%; border-collapse: separate; border-spacing: 0 10px; margin-top: -10px; }
.variants thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 0 14px; }
.variants th, .variants td { text-align: left; vertical-align: top; padding: 14px; }
.variants tbody td { background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.variants tbody td:first-child { border-left: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-weight: 600; }
.variants tbody td:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.variants td .muted { font-weight: 400; }
.variant-price { font-weight: 750; font-size: 1.1rem; white-space: nowrap; }
.sku { white-space: nowrap; }
.button-outline {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.button-outline:hover { background: var(--accent); color: #fff; }
.attributes { display: grid; grid-template-columns: max-content 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.attributes dt, .attributes dd { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.attributes dt { color: var(--muted); background: var(--bg); }
.attributes dt:nth-last-of-type(1), .attributes dd:last-child { border-bottom: 0; }
.product-description { margin-top: 32px; padding-top: 8px; border-top: 1px solid var(--border); max-width: 75ch; }

.pagination { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-top: 32px; }
.pagination a {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  text-decoration: none;
  font-weight: 600;
}
.pagination a:hover { border-color: var(--accent); }

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Forms */
.form {
  max-width: 560px;
  display: grid;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 3vw, 28px);
  box-shadow: var(--shadow);
}
.form button[type="submit"] { justify-self: start; padding: 10px 22px; }
.form-row { display: grid; gap: 6px; }
.form-row > label { font-weight: 600; font-size: 0.95rem; }
.form-row label:has(input[type="checkbox"]) { display: block; font-weight: 400; }
.form-row.has-error input, .form-row.has-error select, .form-row.has-error textarea { border-color: var(--danger); }
.errorlist { color: var(--danger); margin: 0; padding-left: 18px; font-size: 0.9rem; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; padding: 0; vertical-align: -3px; accent-color: var(--accent); margin-right: 6px; }

@media (max-width: 860px) {
  .product-layout { grid-template-columns: 1fr; }
  .product-photos { position: static; }
}
@media (max-width: 720px) {
  .variants { border-spacing: 0; margin-top: 0; }
  .variants thead { display: none; }
  .variants tr { display: grid; gap: 6px; margin-bottom: 10px; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .variants tbody td, .variants tbody td:first-child, .variants tbody td:last-child { border: 0; padding: 0; background: none; border-radius: 0; }
}

/* Accounts */
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 500; }
.link-button:hover { background: none; color: var(--accent-dark); text-decoration: underline; }
.form-links { margin-top: 16px; }
.form-links li { margin: 6px 0; }
.form-row ul:not(.errorlist) { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }

/* Cart and orders */
.cart-table, .orders-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.cart-table th, .cart-table td, .orders-table th, .orders-table td {
  text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.cart-table thead th, .orders-table thead th {
  background: var(--bg); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600;
}
.cart-table tfoot th, .cart-table tfoot td { border-bottom: 0; font-size: 1.15rem; background: var(--accent-soft); }
.orders-table tbody tr:hover td { background: #fafcfb; }
.cart-table tbody td:nth-child(4) { white-space: nowrap; font-weight: 700; }
.qty-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qty-form input { width: 5.5em; text-align: center; }
.qty-form button[value="decrease"], .qty-form button[value="increase"] {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 1.1rem; line-height: 1;
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.qty-form button[value="decrease"]:hover, .qty-form button[value="increase"]:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.add-form { margin-top: 10px; flex-wrap: nowrap; }
.add-form input { width: 4.5em; }
.add-form button { white-space: nowrap; }
.error { color: var(--danger); font-size: 0.9rem; }
tr.has-error td { background: var(--danger-soft); }
.cart-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  text-decoration: none;
  transition: background .15s;
}
.button:hover { background: var(--accent-dark); color: #fff; }
button.secondary { background: var(--card); color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--surface); border-color: #c4d3ca; }
.notice-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.order-status { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 650; }
.checkout-summary { margin-bottom: 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .cart-table thead, .orders-table thead { display: none; }
  .cart-table tr, .orders-table tr { display: grid; gap: 4px; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .cart-table td, .cart-table th, .orders-table td, .orders-table th { border: 0; padding: 2px 0; }
  .cart-table tfoot tr { background: var(--accent-soft); }
}

@media (max-width: 640px) {
  .site-header { position: static; }
  .header-inner { gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .main-nav { gap: 0; }
  .main-nav a, .main-nav .link-button { padding: 6px 8px; font-size: 0.9rem; }
  .brand-text { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
