:root {
  --paper: #faf6ef;
  --surface: #ffffff;
  --ink: #1f1b16;
  --muted: #6b635a;
  --line: #e2d9cc;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --accent-soft: #fdebdf;
  --error: #b42318;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, .logo {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.2;
  text-wrap: balance;
}
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 0.5rem; }

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 56px; min-height: 60vh; }
.narrow { max-width: 680px; margin: 0 auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header */
.testbar { background: var(--ink); color: #fff; text-align: center; font-size: 0.85rem; padding: 6px 16px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 5px; background-color: var(--accent);
  background-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0), linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
  background-size: 2px 14px, 2px 14px, 14px 2px, 14px 2px;
  background-position: 10px 6px, 15px 6px, 6px 10px, 6px 15px;
  background-repeat: no-repeat;
}
.search { display: flex; flex: 1 1 240px; max-width: 420px; margin-left: auto; }
.search input { flex: 1; min-width: 0; border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.search button { border-radius: 0 var(--radius) var(--radius) 0; }
.account-nav { display: flex; gap: 16px; align-items: center; white-space: nowrap; }
.cart-count { display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.8rem; text-align: center; }
.cats { border-top: 1px solid var(--line); font-size: 0.92rem; }
.cats .wrap { display: flex; gap: 20px; overflow-x: auto; padding-top: 9px; padding-bottom: 9px; white-space: nowrap; }
.cats a { color: var(--ink); text-decoration: none; }
.cats a:hover { color: var(--accent); text-decoration: underline; }

/* Forms */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #bfb5a6; border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #f59e6b; outline-offset: 1px; }
button { font: inherit; cursor: pointer; padding: 9px 14px; border: 1px solid #bfb5a6; border-radius: var(--radius); background: #fff; color: var(--ink); }
button:hover { border-color: var(--ink); }
.button, button.button {
  display: inline-block; padding: 11px 20px; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; text-align: center;
}
.button:hover, button.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.button.secondary { background: transparent; color: var(--accent-dark); }
.button.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
.button.block { display: block; width: 100%; }
.button.small { padding: 7px 12px; font-size: 0.9rem; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-dark); text-decoration: underline; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
form.inline select { width: auto; }
.field { margin: 0 0 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; }
.field.check label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.field.check input { margin-top: 5px; }
.help { margin: 5px 0 0; color: var(--muted); font-size: 0.88rem; }
.error { margin: 6px 0 0; color: var(--error); font-weight: 600; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--error); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flash, .notice { padding: 10px 14px; border: 1px solid #f0c9ae; border-radius: var(--radius); background: var(--accent-soft); }
.empty { padding: 32px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Home */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; padding: 24px 0 8px; }
.hero h1 { font-size: 2.7rem; }
.hero img { justify-self: center; width: 300px; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(60, 40, 20, 0.14); transform: rotate(2deg); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0; margin: 12px 0 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); display: block; width: 28px; height: 28px; margin-bottom: 8px; border-radius: 50%; background: var(--ink); color: #fff; text-align: center; line-height: 28px; font-weight: 700; }
.steps strong { display: block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); color: var(--ink); }
.tile strong { font-size: 1.1rem; }
.tile span { color: var(--muted); font-size: 0.92rem; }
.tile .count { margin-top: auto; padding-top: 6px; color: var(--accent-dark); font-weight: 600; }

/* Catalog */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-top: 14px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(60, 40, 20, 0.1); color: var(--ink); }
.card img { display: block; width: 100%; aspect-ratio: 17 / 15; object-fit: cover; object-position: top; border-bottom: 1px solid var(--line); background: #fff; }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; }
.card-title { font-weight: 600; line-height: 1.3; }
.price { font-weight: 700; margin-top: auto; }
.price.big { font-size: 1.6rem; margin: 4px 0 8px; }
.badge { align-self: flex-start; display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.sort { display: flex; align-items: center; gap: 8px; }
.sort select { width: auto; }
.pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.pager .current { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Product */
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.product-preview img { display: block; width: 100%; border: 1px solid var(--line); background: #fff; box-shadow: 0 8px 24px rgba(60, 40, 20, 0.1); }
.options { margin: 20px 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.field.qty select { width: 90px; }
.description { color: #3b352d; }

/* Cart and checkout */
.cart-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 32px; align-items: start; margin-top: 16px; }
table.cart { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cart th, .cart td { padding: 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.cart th { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.cart tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }
.opts { margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.summary, .checkout { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.summary h2, .checkout h2 { margin-top: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 12px 0 16px; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { padding-top: 8px; border-top: 1px solid var(--line); font-weight: 700; font-size: 1.15rem; }
.coupon { margin-bottom: 16px; }
.coupon label { display: block; font-weight: 600; margin-bottom: 5px; }
.coupon .row { display: flex; gap: 8px; }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.downloads { list-style: none; margin: 20px 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.downloads > li { display: flex; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.downloads > li:last-child { border-bottom: 0; }
.actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* Text pages */
.prose h2 { font-size: 1.15rem; margin-top: 1.8rem; font-family: inherit; }
.prose li { margin-bottom: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: 0.93rem; }
.footer-row { display: flex; gap: 48px; flex-wrap: wrap; justify-content: space-between; }
.footer-row p { margin: 4px 0 0; color: var(--muted); }
.footer-row nav { display: flex; flex-direction: column; gap: 6px; }
.site-footer .small { margin-top: 20px; color: var(--muted); }

@media (max-width: 800px) {
  .hero, .product, .cart-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
  .steps { grid-template-columns: 1fr; }
  .search { order: 3; max-width: none; flex-basis: 100%; margin-left: 0; }
  .account-nav { margin-left: auto; }
  .cart th:nth-child(4) { display: none; }
  .cart th, .cart td { padding: 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
