/* Base & Reset Styles — Apple HIG Foundations */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  letter-spacing: -0.011em;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Ensure flex/grid children don't burst out of their parent containers */
.checkout-grid,
.checkout-main-col,
.checkout-sidebar-col,
.card,
.form-grid,
.form-group,
.input-wrapper,
.selected-course-banner,
.selected-course-banner__main {
  min-width: 0;
  max-width: 100%;
}

/* Typography Defaults (typography.md › Conveying hierarchy) */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}

h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
}

h3 {
  font-size: 1.125rem;
}

p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-accent-text, #065F46);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* Tabular numerals for currency, timers, and references */
.tabular-nums,
.tuition-price,
.total-value,
.apple-pay-amount-hero,
#summaryBaseAmount,
#summaryTotalAmount,
#promptAmount,
#receiptAmount,
#countdownSeconds {
  font-variant-numeric: tabular-nums;
}

/* Keyboard Focus Ring (accessibility.md › Speech / Full Keyboard Access) */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.input-wrapper :focus-visible {
  outline: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(17, 28, 22, 0.2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 28, 22, 0.35);
}

/* Micro-Animations & Apple Spring Physics */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Apple Spring Overshoot Pop */
@keyframes springPop {
  0% {
    transform: scale(0.88);
    opacity: 0;
  }

  65% {
    transform: scale(1.08);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Tactile Rubber-Band Stretch */
@keyframes rubberBand {
  0% {
    transform: scale(1, 1);
  }

  30% {
    transform: scale(1.18, 0.85);
  }

  40% {
    transform: scale(0.88, 1.15);
  }

  55% {
    transform: scale(1.08, 0.94);
  }

  70% {
    transform: scale(0.96, 1.04);
  }

  85% {
    transform: scale(1.02, 0.98);
  }

  100% {
    transform: scale(1, 1);
  }
}

/* Buoyant Floating Rhythm */
@keyframes buoyantFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

/* Luminous Popping Accent Glow Pulse */
@keyframes pulseAccentGlow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(5, 223, 114, 0.55);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(5, 223, 114, 0);
  }
}

@keyframes pulseGlow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(5, 223, 114, 0.45);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(5, 223, 114, 0);
  }
}

/* Celebratory Checkmark Bounce */
@keyframes checkmarkBounce {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }

  60% {
    transform: scale(1.25) rotate(5deg);
    opacity: 1;
  }

  80% {
    transform: scale(0.92) rotate(-2deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Bouncy Staggered Entry for Cards */
.animate-spring-entry {
  animation: springPop 0.42s var(--spring-bounce) forwards;
}

.animate-fade-in {
  animation: fadeIn 0.38s var(--spring-gentle) forwards;
}

.animate-shake {
  animation: shake 0.38s ease-in-out;
}

.animate-rubber {
  animation: rubberBand 0.6s var(--spring-elastic);
}

/* Accessibility: Reduced Motion Support (accessibility.md › Cognitive) */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}