@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600&family=Caveat:wght@500;700&display=swap');

:root {
  --paper: #faf6ee;
  --paper-line: #e3dbc8;
  --ink: #23324a;
  --ink-soft: #55637c;
  --blue: #2f5d8a;
  --blue-dark: #234666;
  --ochre: #e0a53b;
  --red: #c1443c;
  --card: #fffdf8;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(35, 50, 74, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 37px,
      var(--paper-line) 38px
    ),
    var(--paper);
  position: relative;
}

body::before {
  /* Margin rule, like a notebook page */
  content: '';
  position: fixed;
  top: 0;
  bottom: 0;
  left: 48px;
  width: 2px;
  background: rgba(193, 68, 60, 0.35);
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  body::before { left: 22px; }
}

a { color: var(--blue); }

h1, h2, h3 {
  font-family: 'Fraunces', serif;
  color: var(--ink);
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 0 64px;
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .wrap { padding: 0 18px 0 36px; }
}

/* ---------- Header ---------- */
header.site {
  padding: 28px 0 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.brand .mark {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.7rem;
  background: var(--ink);
  color: var(--paper);
  padding: 4px 12px;
  border-radius: 4px;
  transform: rotate(-1.5deg);
  display: inline-block;
}

.brand .tagline {
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  color: var(--red);
}

nav.categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 22px 0 6px;
}

nav.categories button {
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: 0.15s ease;
}

nav.categories button:hover { border-color: var(--blue); color: var(--blue); }

nav.categories button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ---------- Hero ---------- */
.hero {
  padding: 30px 0 38px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  max-width: 14ch;
  line-height: 1.1;
}

.hero p {
  color: var(--ink-soft);
  max-width: 46ch;
  font-size: 1.02rem;
}

.hero .ruler {
  height: 30px;
  width: 100%;
  max-width: 340px;
  background-image: repeating-linear-gradient(
    to right,
    var(--ink) 0,
    var(--ink) 1px,
    transparent 1px,
    transparent 12px
  );
  background-size: 100% 14px;
  background-repeat: no-repeat;
  background-position: bottom;
  opacity: 0.35;
  margin-top: 14px;
}

/* ---------- Product grid ---------- */
main.catalog { padding: 6px 0 60px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(35, 50, 74, 0.13);
}

.card .thumb {
  aspect-ratio: 4 / 3;
  background: #f1ecdf;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .thumb svg { width: 44px; height: 44px; opacity: 0.35; }

.card .body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card .cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  margin: 0;
}

.card .desc {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0;
  flex: 1;
}

.card .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.price-tag {
  font-family: 'Caveat', cursive;
  font-size: 1.55rem;
  color: var(--red);
  font-weight: 700;
}

.price-tag .sum { font-size: 0.95rem; margin-left: 2px; }

.buy {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.buy:hover { background: var(--blue-dark); }

.qty-row { margin-top: 4px; }

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--paper-line);
  border-radius: 7px;
  padding: 4px 6px;
}

.qty-btn {
  background: none;
  border: none;
  width: 22px;
  height: 22px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}

.qty-btn:hover { background: var(--card); }

.qty-val {
  min-width: 16px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

/* ---------- Cart drawer ---------- */
.cart-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 6px 18px rgba(193, 68, 60, 0.4);
  cursor: pointer;
  z-index: 5;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  background: var(--paper);
  border-left: 1px solid var(--paper-line);
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.drawer.open { transform: translateX(0); }

.drawer h2 { font-size: 1.3rem; }

.drawer .items { flex: 1; overflow-y: auto; margin: 12px 0; }

.drawer .item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--paper-line);
  font-size: 0.92rem;
}

.drawer .item button {
  border: none;
  background: none;
  color: var(--red);
  cursor: pointer;
  font-size: 0.8rem;
}

.drawer .total {
  font-weight: 700;
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 2px solid var(--ink);
}

.drawer .close-drawer {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.drawer .order-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 6px;
}

.checkout-form {
  border-top: 2px solid var(--ink);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkout-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.checkout-form input,
.checkout-form textarea {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--paper-line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.checkout-form textarea {
  min-height: 56px;
  resize: vertical;
}

.locate-btn {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--blue);
  color: var(--blue);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 2px;
}

.locate-btn:hover { background: rgba(47, 93, 138, 0.08); }

.locate-status {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.place-order-btn {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.place-order-btn:hover { background: #a5372f; }

.place-order-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#orderMsg .msg {
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 6px;
}

#orderMsg .msg.error { background: #fbe6e4; color: var(--red); }
#orderMsg .msg.ok { background: #e6f0e6; color: #2c6b2c; }

#phoneLine {
  margin-top: 4px;
  font-weight: 600;
  color: var(--ink);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(35,50,74,0.35);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.show { opacity: 1; pointer-events: auto; }

footer.site {
  padding: 30px 0 50px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

footer.site a { color: var(--ink-soft); text-decoration: underline; }
