/* Заварка — тёплый чайный магазин. Тёмная палитра, мобильный-first. */

:root {
  --bg: #1b1512;
  --bg-soft: #241c16;
  --bg-soft-2: #2c221a;
  --panel: #221b15;
  --border: rgba(245, 237, 225, 0.12);
  --border-strong: rgba(245, 237, 225, 0.22);
  --ink: #f5ede1;
  --ink-muted: #cbb9a4;
  --ink-faint: #9d8a76;
  --accent: #e0a85e;
  --accent-strong: #c98a3f;
  --accent-soft: rgba(224, 168, 94, 0.16);
  --accent-ink: #241508;
  --danger: #e08a7a;
  --danger-soft: rgba(224, 138, 122, 0.14);
  --ok: #9cc98a;
  --radius: 0.15rem;
  --radius-lg: 0.6rem;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-text: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(27, 21, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.site-nav a {
  color: var(--ink-muted);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; background: rgba(245, 237, 225, 0.06); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.cart-badge {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.logout-form { margin: 0; }

/* ---------- layout ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ---------- hero ---------- */
.hero { padding: 1.5rem 0 2.25rem; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); max-width: 18ch; }
.hero-sub { color: var(--ink-muted); font-size: 1.05rem; max-width: 42ch; margin: 0; }

.section-title {
  font-size: 1.45rem;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- catalog cards ---------- */
.catalog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

/* отогнутый уголок-ярлычок */
.card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
  border-radius: 0 0 0 var(--radius);
  opacity: 0.85;
  pointer-events: none;
}

@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
  .card:hover::before {
    content: "";
    position: absolute;
    top: 10px;
    right: 14px;
    width: 3px;
    height: 26px;
    background: linear-gradient(to top, rgba(224, 168, 94, 0), rgba(224, 168, 94, 0.55));
    border-radius: 3px;
    animation: steam 1.4s ease-out infinite;
    pointer-events: none;
  }
}

@keyframes steam {
  0% { transform: translateY(0) scaleX(1); opacity: 0; }
  40% { opacity: 0.9; }
  100% { transform: translateY(-18px) scaleX(0.4); opacity: 0; }
}

.card-photo {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-photo:hover { text-decoration: none; }

.card-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.card-name { margin: 0 0 0.35rem; font-size: 1.1rem; }
.card-name a { color: var(--ink); }
.card-name a:hover { color: var(--accent); text-decoration: none; }
.card-desc { color: var(--ink-muted); font-size: 0.92rem; margin: 0 0 0.9rem; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.card-price {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-text);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--ink-muted); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--ink); background: rgba(245, 237, 225, 0.06); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(224, 138, 122, 0.3); }
.btn-danger:hover { background: rgba(224, 138, 122, 0.22); }
.btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-add { white-space: nowrap; }

/* ---------- product detail ---------- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.88rem;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}
.breadcrumbs a { color: var(--ink-muted); }
.breadcrumbs span::before { content: "›"; margin-right: 0.5rem; color: var(--ink-faint); }

.product { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.product-photo {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.product-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-info h1 { font-size: 1.6rem; }
.product-desc { color: var(--ink-muted); }
.product-price { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.product-form { margin-top: 0.5rem; }
.qty-label { display: block; color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 0.4rem; }
.qty-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.qty-row input[type="number"] {
  width: 84px;
  min-height: 44px;
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- placeholder / empty ---------- */
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--ink-faint);
  background:
    radial-gradient(circle at 50% 40%, rgba(224, 168, 94, 0.1), transparent 60%),
    var(--bg-soft);
}
.photo-placeholder svg { opacity: 0.6; }
.photo-placeholder.large { aspect-ratio: 4 / 3; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-muted);
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-illustration { color: var(--accent); margin-bottom: 0.75rem; opacity: 0.9; }
.empty-state p { margin: 0 0 1rem; }

/* ---------- steps ---------- */
.steps { margin-top: 2.5rem; }
.steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
  display: grid;
  gap: 0.75rem;
}
.steps-list li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink-muted);
}
.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- cart ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.cart-line {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.cart-line-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-soft);
}
.cart-line-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line-img .photo-placeholder { border-radius: var(--radius); }
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name { font-weight: 600; margin: 0 0 0.2rem; color: var(--ink); }
.cart-line-name a { color: var(--ink); }
.cart-line-qty { color: var(--ink-muted); font-size: 0.88rem; margin: 0; }
.cart-line-sum { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.cart-line form { margin: 0; }

.cart-summary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  align-self: start;
}
.cart-summary .total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.cart-summary .total-row .total-val { color: var(--accent); font-variant-numeric: tabular-nums; }
.cart-summary .btn { width: 100%; }

/* ---------- forms ---------- */
.form { display: grid; gap: 1rem; max-width: 520px; }
.form-field { display: grid; gap: 0.4rem; }
.form-field label { color: var(--ink-muted); font-size: 0.9rem; }
.form-field input, .form-field textarea {
  width: 100%;
  min-height: 44px;
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font-family: var(--font-text);
  font-size: 1rem;
}
.form-field textarea { min-height: 96px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); outline: none; }
.form-hint { color: var(--ink-faint); font-size: 0.8rem; margin: 0; }

/* ---------- flash ---------- */
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.flash-ok { background: rgba(156, 201, 138, 0.14); color: var(--ok); border: 1px solid rgba(156, 201, 138, 0.3); }
.flash-err { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(224, 138, 122, 0.3); }

/* ---------- order confirm ---------- */
.confirm { max-width: 560px; margin: 1.5rem auto 0; text-align: center; }
.confirm-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
}
.confirm-number { font-size: 2.2rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.confirm .timeline { list-style: none; padding: 0; margin: 1.5rem 0; text-align: left; display: grid; gap: 0.75rem; }
.confirm .timeline li { padding-left: 1.75rem; position: relative; color: var(--ink-muted); }
.confirm .timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.confirm .timeline li.done::before { background: var(--ok); }
.confirm-detail { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1.25rem; }
.confirm-detail h3 { margin-bottom: 0.6rem; }
.confirm-detail p { margin: 0.25rem 0; color: var(--ink-muted); }

/* ---------- admin ---------- */
.admin-panel { display: grid; gap: 1.25rem; }
.admin-panel h1 { font-size: 1.6rem; }
.admin-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  max-width: 560px;
}
.admin-form h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.file-field input[type="file"] {
  color: var(--ink-muted);
  padding: 0.4rem 0;
  min-height: 0;
  border: none;
  background: transparent;
}
.file-field input[type="file"]::file-selector-button {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  margin-right: 0.7rem;
  font-family: var(--font-text);
  font-weight: 600;
  cursor: pointer;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.admin-table th, .admin-table td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th {
  position: sticky;
  top: 0;
  background: var(--bg-soft-2);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(245, 237, 225, 0.03); }
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-new { background: var(--accent-soft); color: var(--accent); }
.status-confirmed { background: rgba(156, 201, 138, 0.14); color: var(--ok); }
.status-shipped { background: rgba(140, 170, 220, 0.16); color: #a9c4e8; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.9rem; }
.pagination .count { color: var(--ink-muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.pagination .pages { display: flex; gap: 0.5rem; }

.admin-login { max-width: 420px; margin: 2rem auto 0; }
.admin-login h1 { font-size: 1.6rem; }

.order-detail { margin-top: 0.4rem; padding: 0.75rem; background: var(--bg-soft); border-radius: var(--radius); }
.order-detail ul { margin: 0; padding-left: 1.1rem; color: var(--ink-muted); }
.order-detail li { margin: 0.2rem 0; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  color: var(--ink-faint);
  display: grid;
  gap: 0.5rem;
}
.site-footer p { margin: 0; }
.footer-admin { font-size: 0.85rem; color: var(--ink-faint); }
.footer-admin:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
  .product { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .cart-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .steps-list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .card:hover { transform: none; }
  .card:hover::before { display: none; }
}
