/* ==========================================================================
   Base Reset, Accessibility, Safe Areas, and Motion Discipline
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--canopy-bg);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  scroll-behavior: auto;
}

html[dir="rtl"] {
  font-family: var(--font-arabic);
}

@media (pointer: fine) {
  html {
    overscroll-behavior: none;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--canvas-bg);
  color: var(--ink-primary);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  -webkit-tap-highlight-color: rgba(241, 128, 16, 0.16);
}

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

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  touch-action: manipulation;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

[dir="ltr"].bidi-ltr,
.phone-number {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

html[dir="rtl"] .phone-number,
html[dir="rtl"] .channel-sub.bidi-ltr {
  text-align: right;
}

/* Focus accessibility */
:focus-visible {
  outline: 2px solid var(--accent-ink-on-light);
  outline-offset: 2px;
}

.canopy :focus-visible,
.sales-card :focus-visible,
.preview-dialog :focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--space-4);
  z-index: 1000;
  padding: 10px 16px;
  background: var(--brand-orange);
  color: #14110F;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  inset-block-start: var(--space-3);
}

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

/* Subtle entrance keyframes — below-the-fold polish; never delays primary content */
@keyframes surface-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-stagger {
  animation: surface-rise 260ms var(--ease-out) both;
}

.reveal-delay-1 {
  animation-delay: 40ms;
}

.reveal-delay-2 {
  animation-delay: 80ms;
}

.reveal-delay-3 {
  animation-delay: 120ms;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-stagger,
  .reveal-delay-1,
  .reveal-delay-2,
  .reveal-delay-3 {
    animation: none !important;
  }

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