/* ==========================================================================
   Case: beauty webshop
   Page-only styles: the language switch and the checkout demo.
   ========================================================================== */

/* ---- Language switch ---------------------------------------------------- */

.lang-switch {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}

.lang-switch__btn {
  min-width: 44px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  color: var(--color-text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  transition: var(--transition-ui);
}

.lang-switch__btn:hover {
  color: var(--color-ink);
}

.lang-switch__btn[aria-pressed="true"] {
  background: var(--color-ink);
  color: var(--color-surface);
}

html:not(.js) .lang-switch {
  display: none;
}

/* ---- Checkout demo ------------------------------------------------------- */

.checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.checkout__card {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.checkout__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.checkout__top .lang-switch {
  margin-bottom: 0;
}

.checkout__title {
  font-size: var(--fs-point);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
}

.checkout__lines,
.checkout__totals {
  margin-top: 20px;
}

.checkout__line,
.checkout__total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--color-line-soft);
  font-size: var(--fs-sm);
}

.checkout__line span:first-child,
.checkout__total dt {
  color: var(--color-text-3);
}

.checkout__line span:last-child,
.checkout__total dd {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.checkout__total--grand {
  border-top: 1px solid var(--color-ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.checkout__total--grand dt {
  color: var(--color-ink);
}

.checkout fieldset,
.checkout__group {
  margin-top: 20px;
  padding: 0;
  border: 0;
}

.checkout legend {
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-field);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: var(--transition-ui);
}

.choice + .choice {
  margin-top: 8px;
}

.choice:hover {
  border-color: var(--color-ink);
}

.choice:has(input:checked) {
  border-color: var(--color-ink);
  background: var(--color-bg);
}

.choice input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--color-ink);
}

.choice__name {
  flex: 1 1 auto;
}

.choice__price {
  color: var(--color-text-4);
  font-variant-numeric: tabular-nums;
}

.checkout__company {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.checkout__company[hidden] {
  display: none;
}

.checkout__company:not([hidden]) {
  animation: hr-up 0.4s var(--ease-out) both;
}

.checkout .btn {
  justify-content: center;
  width: 100%;
  margin-top: 20px;
}

.checkout__status {
  margin-top: 12px;
  color: var(--color-text-4);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.checkout__status:empty {
  display: none;
}

/* What the shop stores, next to what the shopper sees. */
.inspector {
  padding: clamp(20px, 3vw, 28px);
  border-radius: var(--radius-panel);
  background: var(--color-ink);
  color: #e9e8e3;
  font-size: var(--fs-xs);
  line-height: 1.6;
}

.inspector__title {
  color: var(--color-surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.inspector__intro {
  margin-top: 6px;
  color: #c9c8c1;
}

.inspector__label {
  margin-top: 18px;
  color: #c9c8c1;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inspector pre {
  margin-top: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--radius-field);
  background: rgb(255 255 255 / 0.07);
  font: 12.5px/1.65 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre;
}

.inspector .is-new {
  animation: flash 1.2s var(--ease-out);
}

@keyframes flash {
  from { background: rgb(255 255 255 / 0.22); }
  to { background: transparent; }
}

.demo-nojs {
  margin-top: 12px;
  color: var(--color-text-5);
  font-size: var(--fs-xs);
}

.js .demo-nojs {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .checkout__company:not([hidden]),
  .inspector .is-new {
    animation: none;
  }
}
