@font-face {
  font-family: "Factor A";
  src: url("/assets/fonts/factor-a-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Factor A";
  src: url("/assets/fonts/factor-a-medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Factor A";
  src: url("/assets/fonts/factor-a-extrabold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #14171b;
  --surface: #1d2127;
  --text: #f3f2ee;
  --muted: #a7a39a;
  --line: #313843;
  --line-soft: #262d36;
  --accent: #d67a3d;
  --brand-highlight: #e4a35c;
  --brand-cool: #6d7b6a;
  --radius-lg: 18px;
  --radius-md: 12px;
}

:root[data-theme="light"] {
  --bg: #faf7f0;
  --surface: #ffffff;
  --text: #1f1a15;
  --muted: #6d655a;
  --line: #ded4c6;
  --line-soft: #e9e2d7;
  --accent: #c86534;
  --brand-highlight: #d9954f;
  --brand-cool: #5e6b58;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Factor A", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.menu-nav a {
  font-family: "Factor A", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 800;
}

.section-head p,
.card .desc,
.menu-note,
.footer {
  font-weight: 500;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(214, 122, 61, 0.13) 0%, transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(109, 123, 106, 0.11) 0%, transparent 40%),
    radial-gradient(circle at top left, #1f252e 0%, var(--bg) 38%);
}

:root[data-theme="light"] body {
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 69px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(20, 23, 27, 0.9);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  height: 48px;
  width: auto;
  display: block;
  transform: translateY(3px);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes tap-pop {
  0% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(1px) scale(0.93);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes tap-ripple {
  0% {
    opacity: 0.35;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  height: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle .theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.22s ease, opacity 0.2s ease, stroke 0.2s ease;
}

.theme-toggle .icon-moon {
  display: none;
}

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

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

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle:hover .theme-icon {
  stroke: var(--accent);
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  transform: rotate(-16deg);
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  transform: rotate(16deg);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
  position: absolute;
  width: 16px;
  height: 1.8px;
  border-radius: 999px;
  background: var(--text);
  transform-origin: center;
  transition: transform 0.22s ease, opacity 0.2s ease, width 0.22s ease, background-color 0.2s ease;
}

.menu-toggle span:nth-child(1) {
  transform: translateY(-5px);
}

.menu-toggle span:nth-child(2) {
  width: 12px;
  transform: translateY(0) translateX(1px);
}

.menu-toggle span:nth-child(3) {
  width: 9px;
  transform: translateY(5px) translateX(3px);
}

.menu-toggle:hover {
  transform: translateY(-1px);
}

.menu-toggle:hover span {
  background: var(--accent);
}

.theme-toggle::after,
.menu-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 111, 77, 0.28);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  pointer-events: none;
}

.theme-toggle::before,
.menu-toggle::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.theme-toggle:hover::before,
.menu-toggle:hover::before,
.theme-toggle:focus-visible::before,
.menu-toggle:focus-visible::before,
.menu-toggle.is-open::before {
  opacity: 1;
}

.theme-toggle.is-pressed::after,
.menu-toggle.is-pressed::after {
  animation: tap-ripple 0.45s ease-out;
}

.theme-toggle.is-pressed,
.menu-toggle.is-pressed {
  animation: tap-pop 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menu-toggle.is-open span:nth-child(1) {
  width: 16px;
  transform: rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle.is-open span:nth-child(3) {
  width: 16px;
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .menu-toggle,
  .theme-toggle .theme-icon,
  .menu-toggle span {
    transition: none;
    animation: none;
  }
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 72px 20px 28px;
  overflow-y: auto;
  background: rgba(20, 23, 27, 0.96);
  backdrop-filter: blur(12px);
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}

:root[data-theme="light"] .topbar {
  border-bottom-color: color-mix(in srgb, var(--line) 55%, var(--line-soft) 45%);
  /* Slight separation from page background without competing with the logo. */
  background: color-mix(in srgb, var(--bg) 88%, var(--line) 12%);
  box-shadow: 0 8px 22px rgba(31, 26, 21, 0.06);
  backdrop-filter: none;
}

:root[data-theme="light"] .mobile-menu {
  background: color-mix(in srgb, var(--bg) 96%, white 4%);
}

.mobile-menu.open {
  transform: translateY(0);
}

.menu-close {
  position: absolute;
  right: 14px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 44px;
}

.menu-subtitle {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-nav {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.menu-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 32px;
  line-height: 1.05;
}

.menu-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.page {
  padding: 14px 16px 28px;
}

.hero {
  padding: 8px 2px 18px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(15px, 4.1vw, 25px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.menu-sections {
  display: grid;
  gap: 20px;
}

.menu-section {
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.section-head h2 {
  margin: 0;
  font-size: clamp(14px, 3.6vw, 25px);
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

.section-head p {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  filter: brightness(0.9) saturate(0.95);
}

:root[data-theme="light"] .card img {
  filter: none;
}

.card-body {
  padding: 10px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
}

.card .price {
  margin: 0;
  font-size: 14px;
  color: color-mix(in srgb, var(--brand-highlight) 62%, var(--accent) 38%);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

:root[data-theme="light"] .card .price {
  color: var(--accent);
}

.card .desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, var(--brand-highlight) 8%);
}

.footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px 24px;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer span {
  color: color-mix(in srgb, var(--muted) 70%, var(--brand-cool) 30%);
}

.error-box {
  padding: 18px;
  border: 1px dashed color-mix(in srgb, var(--line) 70%, var(--accent) 30%);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 78%, var(--accent) 22%);
  color: color-mix(in srgb, var(--text) 84%, var(--accent) 16%);
}

/* Product page (Svelte /ui) */
.product-page .back {
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 12px;
}

.product-page .hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 14px;
}

.product-page .hero h1 {
  margin: 0 0 8px;
  font-size: clamp(20px, 3.8vw, 36px);
  font-weight: 800;
  text-transform: none;
  letter-spacing: -0.02em;
}

.product-page #price {
  margin: 0;
  font-size: 22px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.product-page .availability {
  margin: 8px 0 0;
  font-weight: 700;
}

.product-page .availability.ok {
  color: #17a15b;
}

.product-page .availability.off {
  color: #b24732;
}

.product-page .content {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.2fr;
  gap: 14px;
  margin-bottom: 14px;
}

.product-page .cover-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  /* Keep cover image from becoming "too huge" while still looking premium. */
  aspect-ratio: 4 / 3;
  min-height: 220px;
  max-height: 520px;
}

.product-page .cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-page .content > div:last-child {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
}

.product-page .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.product-page .gallery img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  display: block;
}

@media (max-width: 820px) {
  .product-page .content {
    grid-template-columns: 1fr;
  }

  .product-page .cover-wrap {
    aspect-ratio: 1 / 1;
    max-height: none;
  }
}

@media (min-width: 900px) {
  .topbar,
  .page,
  .footer {
    padding-left: 32px;
    padding-right: 32px;
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .card h3 {
    font-size: 20px;
  }

  .card .price {
    font-size: 16px;
  }

  .card .desc {
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    height: 40px;
  }
}
