/* ═══════════════════════════════════════════════════════════════════════════
   oro-pwa.css — layer 11 · namespace `oroa-`
   Owns: the toast stack, the install affordance, the offline banner.
   Pairs with assets/js/oro-pwa.js. Loaded last. Removable in one line.

   Two constraints from the operating contract are load-bearing here:

   1 · `1rem == 1vw` on this build (inline <style> in index.html), so 1rem is
       3.9px on a 390px phone. EVERYTHING below is authored in px or
       clamp(px, vw, px). Never introduce a rem into this file.
   2 · Additive only. No selector here reaches an element it did not create.

   Occupied space this layer must not collide with:
       .orom-bar   z 4000  · fixed top bar        (≤1024px)
       .orom-drawer z 4500 · slide-in nav         (≤1024px)
       .orom-top   z 3900  · back-to-top, bottom RIGHT, 46px  (≤1024px)
       #oroload    z 99999 · loading plate
   The stack therefore sits bottom-LEFT at z 4600, and reserves the right
   gutter on narrow screens so it never covers the back-to-top control.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --oroa-ink:       #080808;
  --oroa-paper:     #F5F2EC;
  --oroa-dim:       #B8B2A6;   /* 7.4:1 on --oroa-ink — AA at any size */
  --oroa-gold:      #C9A46A;
  --oroa-gold-hi:   #EAD795;
  --oroa-gold-deep: #8C6743;
  --oroa-line:      rgb(245 242 236 / .14);
  --oroa-line-hi:   rgb(201 164 106 / .42);
  --oroa-surface:   rgb(14 13 12 / .88);
  --oroa-ease:      cubic-bezier(.19, 1, .22, 1);
  --oroa-safe-b:    env(safe-area-inset-bottom, 0px);
  --oroa-safe-l:    env(safe-area-inset-left, 0px);
}

/* ── the stack ────────────────────────────────────────────────────────────── */

.oroa-stack {
  position: fixed;
  z-index: 4600;
  left: max(16px, var(--oroa-safe-l));
  bottom: calc(18px + var(--oroa-safe-b));
  width: min(380px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;   /* the stack is a layout box; only cards take input */
}

/* Leave the bottom-right corner to .orom-top (46px control + its 16px gutter). */
@media (max-width: 560px) {
  .oroa-stack { width: calc(100vw - 32px - 62px); }
}

/* ── a card ───────────────────────────────────────────────────────────────── */

.oroa-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 14px 13px;
  border: 1px solid var(--oroa-line);
  border-radius: 14px;
  background: var(--oroa-surface);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
          backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / .8), 0 0 0 1px rgb(0 0 0 / .3);
  color: var(--oroa-paper);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  transform: translate3d(0, 12px, 0) scale(.985);
  transition: opacity .3s ease, transform .5s var(--oroa-ease);
  will-change: transform, opacity;
}

.oroa-toast[data-show="1"] { opacity: 1; transform: none; }

.oroa-toast::after {                 /* the gold hairline, ORO's house signature */
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--oroa-line-hi), transparent);
  pointer-events: none;
}

.oroa-toast--gold { border-color: var(--oroa-line-hi); }

/* ── parts ────────────────────────────────────────────────────────────────── */

.oroa-toast__icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--oroa-gold);
  flex: none;
}
.oroa-toast__icon svg { width: 18px; height: 18px; display: block; }

.oroa-toast__body { min-width: 0; }

.oroa-toast__title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--oroa-paper);
}

.oroa-toast__text {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--oroa-dim);
}

.oroa-toast__actions {
  margin-top: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── buttons ──────────────────────────────────────────────────────────────── */

.oroa-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--oroa-line-hi);
  background: linear-gradient(180deg, #DDBA84, var(--oroa-gold));
  color: #1A1305;                    /* 9.1:1 on the gold fill */
  font: 600 13px/1 inherit;
  font-family: inherit;
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .18s ease, transform .18s var(--oroa-ease);
}
.oroa-btn:hover { filter: brightness(1.07); }
.oroa-btn:active { transform: translateY(1px); }

.oroa-btn--ghost {
  background: transparent;
  border-color: var(--oroa-line);
  color: var(--oroa-paper);
}
.oroa-btn--ghost:hover { border-color: rgb(245 242 236 / .4); filter: none; }

/* Close control. 40px box around a 14px glyph so the target clears WCAG 2.2
   2.5.8 (24px minimum) with room to spare, without a 44px visual button. */
.oroa-toast__close {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 40px;
  height: 40px;
  margin: -9px -9px 0 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--oroa-dim);
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}
.oroa-toast__close:hover { color: var(--oroa-paper); background: rgb(245 242 236 / .07); }
.oroa-toast__close svg { width: 13px; height: 13px; display: block; }

.oroa-stack :focus-visible {
  outline: 2px solid var(--oroa-gold-hi);
  outline-offset: 2px;
}

/* ── offline state ────────────────────────────────────────────────────────── */

.oroa-toast--offline .oroa-toast__icon { color: var(--oroa-gold-deep); }
.oroa-toast--offline { border-color: rgb(140 103 67 / .55); }

/* A hairline across the top of the viewport while the connection is down —
   ambient, not modal, so a reader is never interrupted mid-section. */
.oroa-netline {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 4601;
  background: linear-gradient(90deg, transparent, var(--oroa-gold-deep), transparent);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform .6s var(--oroa-ease), opacity .3s ease;
  opacity: 0;
  pointer-events: none;
}
html[data-oroa-net="offline"] .oroa-netline { transform: scaleX(1); opacity: 1; }

/* ── screen-reader-only live region ───────────────────────────────────────── */

.oroa-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── motion, contrast, print ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .oroa-toast,
  .oroa-btn,
  .oroa-netline,
  .oroa-toast__close { transition: none !important; }
  .oroa-toast { transform: none !important; }
}

@media (forced-colors: active) {
  .oroa-toast { background: Canvas; border-color: CanvasText; }
  .oroa-toast__title, .oroa-toast__text { color: CanvasText; }
  .oroa-btn { background: ButtonFace; color: ButtonText; border-color: ButtonText; }
  .oroa-toast::after, .oroa-netline { display: none; }
}

@media print { .oroa-stack, .oroa-netline { display: none !important; } }

/* ═══════════════════════════════════════════════════════════════════════════
   THE INSTALL DIALOG
   ───────────────────────────────────────────────────────────────────────────
   Promoted out of the corner stack. Installing is a decision, not a status
   update, so it gets the middle of the screen and a moment of the reader's
   attention. The transient cards above — offline, back online, update ready —
   stay bottom-left on purpose: they report, they do not ask.

   The motion is deliberately the loading plate's own: the ORO mark draws as a
   stroke and then fills. Reusing the signature the visitor has already seen
   once makes this read as part of the product rather than a browser prompt
   bolted on top of it.

   Everything is px-authored (1rem == 1vw on this build) and every animation is
   transform/opacity only, so it composites on the GPU and cannot cause layout
   shift. Under prefers-reduced-motion the whole sequence collapses to a fade.
   ═══════════════════════════════════════════════════════════════════════════ */

.oroa-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;               /* over the drawer (4500) and stack (4600),
                                  under the loading plate (99999) */
  display: grid;
  place-items: safe center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .34s ease, visibility 0s linear .34s;
}

.oroa-modal[data-open="1"] {
  opacity: 1;
  visibility: visible;
  transition: opacity .34s ease, visibility 0s;
}

.oroa-modal__scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 45%, rgb(8 8 8 / .55), rgb(4 4 4 / .88)),
    rgb(4 4 4 / .5);
  -webkit-backdrop-filter: blur(0px);
          backdrop-filter: blur(0px);
  transition: -webkit-backdrop-filter .5s ease, backdrop-filter .5s ease;
}
.oroa-modal[data-open="1"] .oroa-modal__scrim {
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
          backdrop-filter: blur(14px) saturate(1.1);
}

/* ── the panel ────────────────────────────────────────────────────────────── */

.oroa-dialog {
  position: relative;
  width: min(420px, 100%);
  max-width: 100%;
  padding: 38px 30px 30px;
  border-radius: 22px;
  border: 1px solid var(--oroa-line-hi);
  background:
    radial-gradient(120% 80% at 50% -10%, rgb(201 164 106 / .13), transparent 62%),
    rgb(11 10 9 / .96);
  box-shadow:
    0 40px 90px -30px rgb(0 0 0 / .9),
    0 0 0 1px rgb(0 0 0 / .5),
    inset 0 1px 0 rgb(245 242 236 / .06);
  text-align: center;
  transform: translate3d(0, 22px, 0) scale(.96);
  opacity: 0;
  transition: transform .62s var(--oroa-ease), opacity .38s ease;
  will-change: transform, opacity;
}
.oroa-modal[data-open="1"] .oroa-dialog { transform: none; opacity: 1; }

/* The aura. Sits behind the panel and blooms open a beat later, so the card
   arrives first and the light follows it. */
.oroa-dialog::before {
  content: "";
  position: absolute;
  inset: -40% -22%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(201 164 106 / .18), transparent 62%);
  opacity: 0;
  transform: scale(.72);
  transition: opacity .9s ease .12s, transform 1.1s var(--oroa-ease) .12s;
  pointer-events: none;
}
.oroa-modal[data-open="1"] .oroa-dialog::before { opacity: 1; transform: scale(1); }

/* ── the mark ─────────────────────────────────────────────────────────────── */

.oroa-dialog__mark {
  width: 132px;
  height: auto;
  display: block;
  margin: 0 auto 22px;
  overflow: visible;
}
.oroa-dialog__stroke {
  fill: none;
  stroke: url(#oroaGradS);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  /* stroke-dasharray / -offset are set from JS via getTotalLength() */
  transition: stroke-dashoffset 1.15s var(--oroa-ease) .1s, opacity .45s ease .95s;
}
.oroa-dialog__fill {
  fill: url(#oroaGrad);
  opacity: 0;
  transition: opacity .5s var(--oroa-ease) .8s;
}
.oroa-modal[data-open="1"] .oroa-dialog__stroke { stroke-dashoffset: 0; opacity: 0; }
.oroa-modal[data-open="1"] .oroa-dialog__fill { opacity: 1; }

/* ── staggered content ────────────────────────────────────────────────────── */

.oroa-rise {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition: opacity .5s ease, transform .7s var(--oroa-ease);
}
.oroa-modal[data-open="1"] .oroa-rise { opacity: 1; transform: none; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="1"] { transition-delay: .30s; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="2"] { transition-delay: .38s; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="3"] { transition-delay: .50s; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="4"] { transition-delay: .58s; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="5"] { transition-delay: .66s; }
.oroa-modal[data-open="1"] .oroa-rise[data-i="6"] { transition-delay: .76s; }

.oroa-dialog__title {
  margin: 0 0 10px;
  font-size: 25px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--oroa-paper);
}
.oroa-dialog__text {
  margin: 0 auto 22px;
  max-width: min(34ch, 100%);
  font-size: 14px;
  line-height: 1.6;
  color: var(--oroa-dim);
}

/* The hairline. Opens from the centre outwards — the same gesture the loading
   plate makes on exit. */
.oroa-dialog__rule {
  height: 1px;
  margin: 0 0 20px;
  background: linear-gradient(90deg, transparent, var(--oroa-gold), transparent);
  transform: scaleX(0);
  opacity: 0;
  transition: transform .9s var(--oroa-ease) .34s, opacity .4s ease .34s;
}
.oroa-modal[data-open="1"] .oroa-dialog__rule { transform: scaleX(1); opacity: .85; }

/* ── the three honest promises ────────────────────────────────────────────── */

.oroa-facts {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 11px;
  text-align: left;
}
.oroa-fact {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  line-height: 1.45;
  color: #D8D2C6;               /* 11.3:1 on the panel */
}
.oroa-fact__i {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgb(201 164 106 / .28);
  background: rgb(201 164 106 / .08);
  color: var(--oroa-gold-hi);
}
.oroa-fact__i svg { width: 14px; height: 14px; display: block; }

/* ── actions ──────────────────────────────────────────────────────────────── */

.oroa-dialog__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oroa-dialog__actions .oroa-btn { min-height: 48px; font-size: 14px; }

/* One sheen across the primary button as the dialog settles, and again on
   hover. Overflow-clipped so the highlight cannot escape the pill. */
.oroa-dialog__actions .oroa-btn:first-child {
  position: relative;
  overflow: hidden;
}
.oroa-dialog__actions .oroa-btn:first-child::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / .5) 50%, transparent 62%);
  transform: translateX(-120%);
  pointer-events: none;
}
.oroa-modal[data-open="1"] .oroa-dialog__actions .oroa-btn:first-child::after {
  animation: oroa-sheen 1.1s var(--oroa-ease) 1s 1;
}
.oroa-dialog__actions .oroa-btn:first-child:hover::after {
  animation: oroa-sheen .9s var(--oroa-ease) 1;
}
@keyframes oroa-sheen {
  to { transform: translateX(120%); }
}

.oroa-dialog__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;                  /* WCAG 2.2 2.5.8 with room to spare */
  height: 44px;
  display: grid;
  place-items: center;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--oroa-dim);
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}
.oroa-dialog__close:hover { color: var(--oroa-paper); background: rgb(245 242 236 / .07); }
.oroa-dialog__close svg { width: 14px; height: 14px; display: block; }

.oroa-modal :focus-visible {
  outline: 2px solid var(--oroa-gold-hi);
  outline-offset: 3px;
}

/* ── narrow screens ───────────────────────────────────────────────────────── */

@media (max-width: 420px) {
  .oroa-dialog { padding: 32px 22px 24px; border-radius: 18px; }
  .oroa-dialog__mark { width: 110px; margin-bottom: 18px; }
  .oroa-dialog__title { font-size: 22px; }
}

/* Short viewports — a landscape phone must not clip the actions. */
@media (max-height: 560px) {
  .oroa-modal { overflow-y: auto; }
  .oroa-dialog { padding-top: 26px; }
  .oroa-dialog__mark { width: 84px; margin-bottom: 12px; }
  .oroa-facts { display: none; }
}

/* ── reduced motion · forced colors ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .oroa-modal,
  .oroa-modal__scrim,
  .oroa-dialog,
  .oroa-dialog::before,
  .oroa-rise,
  .oroa-dialog__rule,
  .oroa-dialog__stroke,
  .oroa-dialog__fill {
    transition: opacity .01ms !important;
    transition-delay: 0s !important;
    transform: none !important;
  }
  .oroa-modal[data-open="1"] .oroa-dialog__rule { transform: none !important; }
  .oroa-dialog__stroke { opacity: 0 !important; stroke-dashoffset: 0 !important; }
  .oroa-dialog__fill { opacity: 1 !important; }
  .oroa-dialog__actions .oroa-btn:first-child::after { animation: none !important; }
}

@media (forced-colors: active) {
  .oroa-dialog { background: Canvas; border-color: CanvasText; }
  .oroa-dialog__title, .oroa-dialog__text, .oroa-fact { color: CanvasText; }
  .oroa-dialog__rule, .oroa-dialog::before { display: none; }
}
