.icon { width: 20px; height: 20px; flex: none; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.button--primary { background: var(--accent); color: var(--accent-contrast); }
.button--primary:active { transform: scale(0.99); }
.button--tonal { background: var(--tone-strong); color: var(--text); }
.button--tonal:active { transform: scale(0.99); }
.button:disabled { background: var(--tone-strong); color: var(--text-muted); cursor: not-allowed; transform: none; }

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--tone-strong);
  transition: background 0.2s, transform 0.2s;
}
.icon-button:disabled { opacity: 0.4; cursor: default; transform: none; }

:is(a, button, [role="radio"], [role="checkbox"]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Segmented control */
.segmented {
  position: relative;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--tone-strong);
}
.segmented__thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  pointer-events: none;
  transition: transform var(--duration-base) var(--ease-out), width var(--duration-base) var(--ease-out), height var(--duration-base) var(--ease-out);
}
.segmented__item {
  position: relative;
  z-index: 1;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s;
}
.segmented--pages .segmented__item { min-width: 48px; padding: 0 14px; }
.segmented--wrap { display: flex; flex-wrap: wrap; align-self: flex-start; border-radius: 24px; }

/* Panel */
.panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: var(--text);
}
.panel::backdrop {
  background: rgba(23, 35, 28, 0.4);
  opacity: 0;
  transition: opacity var(--panel-close) ease;
}
.panel.is-open::backdrop { opacity: 1; transition-duration: var(--panel-open); }

.panel__sheet {
  position: absolute;
  top: 12px;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity var(--panel-close) linear, transform var(--panel-close) var(--ease-in);
  will-change: transform;
}
.panel.is-open .panel__sheet {
  opacity: 1;
  transform: none;
  transition: opacity calc(var(--panel-open) * 0.5) ease, transform var(--panel-open) var(--ease-out);
}

@media (min-width: 720px) {
  .panel__sheet {
    top: 0;
    left: auto;
    width: min(680px, 100%);
    border-radius: 32px 0 0 32px;
    transform: translateX(100%);
  }
}

.panel__close { position: absolute; top: 16px; right: 16px; z-index: 2; background: var(--surface); }
.panel__body { scroll-behavior: smooth; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 0; }

/* Product view */
.product { display: flex; flex-direction: column; gap: 28px; }
.gallery { display: flex; flex-direction: column; gap: 8px; }
.gallery__main { aspect-ratio: 16 / 10; max-height: 46vh; overflow: hidden; border-radius: 24px; background: var(--tone); }
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.gallery__thumb {
  flex: none;
  width: 76px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: var(--tone);
  opacity: 0.55;
  transition: opacity 0.2s;
}
.gallery__thumb[aria-pressed="true"] { opacity: 1; }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }

.product__content { display: flex; flex-direction: column; gap: 28px; padding: 0 12px; }
.product__title { font-size: clamp(26px, 4vw, 34px); }
.option { display: flex; flex-direction: column; gap: 10px; }
.option__label { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.spec-list { display: grid; grid-template-columns: minmax(96px, 0.4fr) 1fr; gap: 14px 20px; }
.spec-list dt { color: var(--text-muted); }
.spec-list dd { font-weight: 500; }
.product__description { color: var(--text-muted); }

.product__bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -12px;
  padding: 16px 24px max(20px, env(safe-area-inset-bottom));
  background: var(--surface);
}
.product__price { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.product__price--unknown { font-size: 18px; }

/* Video view */
.video { aspect-ratio: 16 / 9; margin-top: 72px; overflow: hidden; border-radius: 24px; background: var(--tone); }
.video--portrait { width: min(100%, calc((100dvh - 120px) * 9 / 16)); aspect-ratio: 9 / 16; margin-inline: auto; margin-top: 64px; }
.video__frame { width: 100%; height: 100%; border: 0; }

@media (max-width: 599px) {
  .spec-list { grid-template-columns: 1fr; gap: 0; }
  .spec-list dd { margin-bottom: 14px; }
}

@media (hover: hover) {
  .gallery__thumb:hover { opacity: 1; }
  .button--primary:hover { background: var(--accent-hover); transform: scale(1.02); }
  .button--tonal:hover { background: #cbdcce; transform: scale(1.02); }
  .icon-button:hover { background: #cbdcce; transform: scale(1.04); }
  .segmented__item[aria-checked="false"]:hover { background: rgba(255, 255, 255, 0.55); }
  .panel__close:hover { background: var(--tone-strong); }
}

@media (prefers-reduced-motion: reduce) {
  .panel__body { scroll-behavior: auto; }
}
