/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  font-family: 'Roboto', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--md-sys-color-primary);
}

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  background-color: var(--md-sys-color-surface-container);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-title {
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-title:hover {
  color: var(--md-sys-color-primary);
}

/* ── Main Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ── Page Heading ───────────────────────────────────────────── */
.page-heading {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.page-subheading {
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 32px;
}

/* ── Home: Product Grid ─────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--catalog-grid-min-card-width), 1fr));
  gap: 24px;
}

/* ── Product Card ───────────────────────────────────────────── */
.product-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container-low);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .12),
    0 1px 3px 1px rgba(0, 0, 0, .08);
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.product-card:hover {
  box-shadow:
    0 2px 6px 2px rgba(0, 0, 0, .12),
    0 1px 2px rgba(0, 0, 0, .10);
  transform: translateY(-2px);
}

.product-card__image-link {
  display: block;
  text-decoration: none;
}

.product-card__image-wrap {
  position: relative;
  padding-top: var(--catalog-card-image-ratio);
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
}

.product-card__image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 200ms ease;
}

.product-card:hover .product-card__image-wrap img {
  transform: scale(1.03);
}

.product-card__body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card__title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  line-height: 1.4;
}

.product-card__price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.product-card__footer {
  padding: 0 16px 16px;
  display: flex;
  justify-content: flex-end;
}

/* ── Product Detail Page ────────────────────────────────────── */
.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 768px) {
  .product-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ── Carousel ───────────────────────────────────────────────── */
.carousel {
  position: relative;
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
  aspect-ratio: 4 / 3;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, .12),
    0 2px 6px rgba(0, 0, 0, .08);
}

.carousel__track {
  display: flex;
  height: 100%;
  transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}

.carousel__slide {
  flex: 0 0 100%;
  height: 100%;
}

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

.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: color-mix(in srgb, var(--md-sys-color-surface-container-highest) 88%, transparent);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface);
  font-size: 1.5rem;
  line-height: 1;
  transition: background-color 150ms ease;
  z-index: 2;
}

.carousel__btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
}

.carousel__btn--prev { left: 10px; }
.carousel__btn--next { right: 10px; }
.carousel__btn[hidden] { display: none; }

.carousel__dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .6);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background-color 150ms ease, transform 150ms ease;
}

.carousel__dot[aria-current="true"] {
  background-color: #ffffff;
  transform: scale(1.4);
}

/* ── Details Panel ──────────────────────────────────────────── */
.product-details__name {
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 24px;
  line-height: 1.3;
}

.product-details__asking-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  margin-bottom: 24px;
}

.product-details__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.product-details__label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.product-details__value {
  font-size: .9375rem;
  display: flex;
  align-items: center;
}

.product-details__links-heading {
  font-size: .8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px;
}

.product-details__description {
  margin-top: 24px;
  line-height: 1.75;
  color: var(--md-sys-color-on-surface);
}

.product-details__description h2,
.product-details__description h3 {
  margin: 1.25em 0 .5em;
  font-weight: 600;
}

.product-details__description p {
  margin-bottom: .875em;
}

.product-details__description ul,
.product-details__description ol {
  padding-left: 1.5em;
  margin-bottom: .875em;
}

.product-details__description li {
  margin-bottom: .25em;
}

.product-details__description strong {
  font-weight: 600;
}

/* ── Back link ──────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: .9375rem;
  margin-bottom: 28px;
  transition: color 150ms ease;
}

.back-link:hover {
  color: var(--md-sys-color-primary);
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: .8125rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  margin-top: auto;
}

/* ── md-list-item link styling ──────────────────────────────── */
md-list {
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container-low);
}
