/* ==========================================================================
   Base Styles & Components
   ========================================================================== */

/* @font-face declarations */
@font-face {
  font-family: 'IBM Plex Sans Thai';
  src: url('../fonts/IBMPlexSansThai-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans Thai';
  src: url('../fonts/IBMPlexSansThai-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sora';
  src: url('../fonts/Sora-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sora';
  src: url('../fonts/Sora-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  font-family: var(--font-thai);
  background-color: var(--medical-white);
  color: var(--ink);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 88px; /* Room for Sticky CTA */
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

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

/* Typography scale with responsive clamp() */
.p6-display {
  font-size: clamp(32px, 5vw + 1rem, 44px);
  line-height: var(--lh-display);
  font-weight: var(--fw-bold);
}

.p6-h1 {
  font-size: clamp(28px, 4vw + 1rem, 36px);
  line-height: var(--lh-h1);
  font-weight: var(--fw-semibold);
}

.p6-h2 {
  font-size: clamp(23px, 3vw + 0.5rem, 28px);
  line-height: var(--lh-h2);
  font-weight: var(--fw-semibold);
}

.p6-h3 {
  font-size: clamp(19px, 2vw + 0.5rem, 21px);
  line-height: var(--lh-h3);
  font-weight: var(--fw-semibold);
}

.p6-body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
}

.p6-body-lg {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
}

.p6-caption {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--fw-regular);
}

.p6-price {
  font-family: var(--font-eng);
  font-variant-numeric: tabular-nums;
  font-size: clamp(30px, 4vw, 34px);
  line-height: var(--lh-price);
  font-weight: var(--fw-bold);
}

/* Focus ring */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Tap target enforcement */
a, button, input, select, textarea, [role="button"], summary {
  min-height: var(--tap-target-min);
  min-width: var(--tap-target-min);
}

/* For inline links, we do not enforce min-height, but ensure touch area with padding/margin if needed. */
p a {
  min-height: auto;
  min-width: auto;
  text-decoration: underline;
}

/* Button components */
.p6-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap-min);
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-thai);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  transition: all 0.2s ease;
  min-width: var(--tap-target-min);
}

.p6-btn--primary {
  background-color: var(--champagne-gold);
  color: var(--ink);
  height: var(--sticky-cta-btn-height);
  border-radius: var(--radius-pill);
  padding: 0 var(--sp-6);
}
.p6-btn--primary:hover {
  background-color: var(--gold-soft);
}
.p6-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.p6-btn--secondary {
  background-color: transparent;
  color: var(--ink);
  height: 52px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 0 var(--sp-5);
}
.p6-btn--secondary:hover {
  background-color: rgba(13, 13, 15, 0.05);
}

/* Container */
.p6-container {
  max-width: var(--container-commerce);
  padding: 0 20px;
  margin: 0 auto;
  width: 100%;
}

.p6-container--wide {
  max-width: var(--container-content);
}

/* Card component */
.p6-card {
  background-color: var(--medical-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

/* Trust band */
.p6-trust-band {
  background-color: var(--deep-green);
  color: var(--medical-white);
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
}

/* Sticky CTA bar */
.p6-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--sticky-cta-height);
  background: var(--medical-white);
  box-shadow: var(--sticky-cta-shadow);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.p6-sticky-cta--visible {
  transform: translateY(0);
}

/* Block base styles */
.p6-block {
  padding: var(--sp-7) 0;
}

.p6-block__heading {
  margin-bottom: var(--sp-5);
  text-align: center;
}

/* Tier card styles */
.p6-tier-card {
  display: flex;
  flex-direction: column;
  background-color: var(--medical-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  position: relative;
  cursor: pointer;
}
@media (min-width: 768px) {
  .p6-tier-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.p6-tier-card--recommended {
  border-color: var(--champagne-gold);
  box-shadow: 0 4px 12px rgba(198, 163, 106, 0.2);
}
.p6-tier-card--member {
  border-color: var(--deep-green);
}

.p6-tier-card__badge {
  position: absolute;
  top: -12px;
  right: var(--sp-5);
  background-color: var(--champagne-gold);
  color: var(--ink);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
}
.p6-tier-card--member .p6-tier-card__badge {
  background-color: var(--deep-green);
  color: var(--medical-white);
}

.p6-tier-card__price {
  font-family: var(--font-eng);
  font-variant-numeric: tabular-nums;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: var(--fw-bold);
}

.p6-tier-card__fda {
  font-size: var(--fs-caption);
  color: var(--ink-60);
}

/* Hide native radio, show custom */
.p6-tier-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.p6-tier-card__radio-indicator {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  margin-right: var(--sp-3);
  min-width: 28px;
}
.p6-tier-card input[type="radio"]:checked + .p6-tier-card__content .p6-tier-card__radio-indicator,
.p6-tier-card input[type="radio"]:checked ~ .p6-tier-card__radio-indicator {
  border-color: var(--deep-green);
}
.p6-tier-card input[type="radio"]:checked ~ .p6-tier-card__radio-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background-color: var(--deep-green);
  border-radius: 50%;
}

/* Legal block */
.p6-legal {
  background-color: var(--soft-beige);
  color: var(--ink-60);
  font-size: var(--fs-caption);
  line-height: 1.8;
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
}

/* Note: NO --ink-40 anywhere in this project */

/* Breakpoint media queries */
/* Base: < 360 */
@media (min-width: 360px) { }
@media (min-width: 390px) { }
@media (min-width: 768px) { }
@media (min-width: 1024px) { }
@media (min-width: 1280px) { }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
