@font-face {
  font-family: "Marta";
  src: url("assets/font.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f1e8;
  --surface: #fffdf9;
  --surface-2: #efe7db;
  --text: #1c1917;
  --muted: #6f655b;
  --accent: #a8451f;
  --accent-soft: #f3dfd3;
  --accent-text: #ffffff;
  --badge: #1f7a4d;
  --border: #e5dbcf;
  --shadow: 0 18px 40px -28px rgba(60, 40, 20, 0.55);
  --shadow-hover: 0 26px 50px -24px rgba(60, 40, 20, 0.45);
  --skeleton: #e9e0d4;
  --skeleton-shine: #f6f0e7;
  --radius: 20px;
}

html[data-theme="dark"] {
  --bg: #12100e;
  --surface: #1d1916;
  --surface-2: #27211c;
  --text: #f4eee5;
  --muted: #b7aa9c;
  --accent: #e2794d;
  --accent-soft: #33221a;
  --accent-text: #1a120d;
  --badge: #46c98a;
  --border: #352c25;
  --shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.8);
  --shadow-hover: 0 26px 50px -24px rgba(0, 0, 0, 0.85);
  --skeleton: #241f1a;
  --skeleton-shine: #2e2822;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 90% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Marta", "Segoe UI", Tahoma, sans-serif;
  font-weight: 700;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-block: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: contain;
  box-shadow: var(--shadow);
}

.brand-word {
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.search {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.search-icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  translate: 0 -50%;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 12px 48px;
  outline: none;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.icon-button:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-moon {
  display: block;
}

/* Main */
.main {
  padding-block: 34px 100px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-block-end: 26px;
}

.toolbar-title h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
}

.toolbar-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Offers switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background-color 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: inset-inline-start 0.2s ease, background-color 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  inset-inline-start: 23px;
  background: var(--accent-text);
}

/* Select */
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrap select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 42px 10px 16px;
  outline: none;
  cursor: pointer;
  font-size: 0.88rem;
}

.select-wrap svg {
  position: absolute;
  inset-inline-start: 15px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 22px;
}

.card {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-2);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-media img {
  transform: scale(1.05);
}

.card-media img.fallback {
  object-fit: contain;
  padding: 20%;
  opacity: 0.35;
}

.badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: var(--badge);
  color: #06130c;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.5);
}

.badge-large {
  position: static;
  display: inline-flex;
  width: fit-content;
  margin-block-end: 12px;
  font-size: 0.8rem;
}

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

.card-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-details {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-block-start: auto;
  padding-block-start: 6px;
}

.price-now {
  font-size: 1.28rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  font-size: 0.86rem;
}

/* Skeleton */
.skeleton {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.skeleton-media {
  aspect-ratio: 1 / 1;
  background: linear-gradient(100deg, var(--skeleton) 30%, var(--skeleton-shine) 50%, var(--skeleton) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-line {
  height: 12px;
  margin: 14px 16px;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--skeleton) 30%, var(--skeleton-shine) 50%, var(--skeleton) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-line.short {
  width: 45%;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* States */
.state {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}

.state h2 {
  color: var(--text);
  margin: 14px 0 6px;
  font-size: 1.35rem;
}

.state p {
  margin: 0 0 20px;
}

.state-icon {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  margin-inline: auto;
  opacity: 0.55;
  filter: grayscale(0.3);
}

.state-mark {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.8rem;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

/* Footer */
.footer {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 25;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(18px);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -14px 40px -30px rgba(0, 0, 0, 0.55);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.62);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, 0.7);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  animation: pop-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.modal-media {
  background: var(--surface-2);
  min-height: 300px;
}

.modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-media img.fallback {
  object-fit: contain;
  padding: 18%;
  opacity: 0.35;
}

.modal-body {
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-body h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.35;
}

.modal-details {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.8;
  white-space: pre-line;
}

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

.modal-price .price-now {
  font-size: 1.8rem;
}

.modal-price .price-old {
  font-size: 1rem;
}

.modal-note {
  margin: 26px 0 0;
  padding-block-start: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

.modal-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 2;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 760px) {
  .container {
    width: calc(100% - 28px);
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand-copy small {
    display: none;
  }

  .search {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .toolbar-actions {
    justify-content: space-between;
  }

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

  .card-body {
    padding: 12px 12px 14px;
  }

  .price-now {
    font-size: 1.1rem;
  }

  .modal-card {
    grid-template-columns: 1fr;
    max-height: 88vh;
  }

  .modal-media {
    min-height: 220px;
    max-height: 320px;
  }

  .modal-body {
    padding: 24px 20px 28px;
  }
}

@media (max-width: 380px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .brand-copy strong {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
