/* DeskKit Automate — the "magic" screen (automate/web/automate.html,
   #panel-magic, built by js/automate-app.js renderMagic / openMagic).
   Loaded after css/theme-v2.css and css/automate-v2.css; uses only the
   v2 tokens, so the light theme (html.dk-light re-points them) works
   with no extra rules except a few shadows at the end.

   --tone is each magic's category colour (data-tone): sales = site blue,
   getting paid = invoice pink, service = CV violet, assistant = deck cyan.

   Sections: 1 tone · 2 first magic (hero) · 3 path (trigger → actions,
   the travelling light) · 4 my magic + live feed · 5 gallery cards
   · 6 dialog · 7 motion + accessibility modes · 8 light theme. */

/* ============================================================ 1 tone */
body.v2-automate-app [data-tone] { --tone: var(--v2-teal); }
body.v2-automate-app [data-tone="site"] { --tone: var(--v2-site); }
body.v2-automate-app [data-tone="invoice"] { --tone: var(--v2-invoice); }
body.v2-automate-app [data-tone="cv"] { --tone: var(--v2-cv); }
body.v2-automate-app [data-tone="deck"] { --tone: var(--v2-deck); }
body.v2-automate-app #au-magic { --tone: var(--v2-teal); }

/* ============================================================ 2 first magic */
body.v2-automate-app .mg-profile { margin-bottom: 16px; }
/* style.css gives every <section> 88px of padding; these are parts of one screen */
body.v2-automate-app #au-magic > section:not(.mg-hero) { padding: 0; }
body.v2-automate-app #au-magic > section { margin: 0 0 30px; }
body.v2-automate-app .mg-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: 22px; padding: clamp(20px, 4vw, 34px);
  border-radius: var(--v2-r-lg, 30px);
  background:
    radial-gradient(60% 90% at 100% 0%, color-mix(in srgb, var(--v2-site) 16%, transparent), transparent 70%),
    radial-gradient(60% 90% at 0% 100%, color-mix(in srgb, var(--v2-teal) 16%, transparent), transparent 70%),
    var(--v2-panel);
  box-shadow: inset 0 0 0 1px var(--v2-line-2);
}
body.v2-automate-app .mg-hero.is-on { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v2-teal) 55%, transparent), 0 0 40px -18px var(--v2-teal); }
body.v2-automate-app .mg-kicker { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--v2-teal-hi); margin-bottom: 8px; }
body.v2-automate-app .mg-hero h2 { margin: 0 0 8px; font-size: clamp(22px, 2.4vw + 12px, 32px); line-height: 1.25; color: var(--v2-hi); font-family: Heebo, Rubik, sans-serif; font-weight: 700; }
body.v2-automate-app .mg-hero p { margin: 0; color: var(--v2-dim); font-size: 16px; line-height: 1.65; max-width: 100ch; }
body.v2-automate-app .mg-nowrap { white-space: nowrap; }
body.v2-automate-app .mg-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
body.v2-automate-app .mg-hint { font-size: 13.5px; color: var(--v2-dim); }
body.v2-automate-app .au-btn.mg-go { font-size: 16px; padding: 11px 22px; border-radius: 999px; }

/* ============================================================ 3 path */
body.v2-automate-app .mg-path { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; align-items: flex-start; }
body.v2-automate-app .mg-node { position: relative; flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 8px; text-align: center; }
/* the line to the next node, and the light that runs along it */
body.v2-automate-app .mg-node:not(:last-child)::before {
  content: ""; position: absolute; top: 21px; inset-inline-start: calc(50% + 24px); width: calc(100% - 48px); height: 2px;
  background: color-mix(in srgb, var(--tone) 35%, transparent); border-radius: 2px;
}
body.v2-automate-app .mg-node:not(:last-child)::after {
  content: ""; position: absolute; top: 18px; inset-inline-start: calc(50% + 24px); width: 8px; height: 8px; border-radius: 50%;
  background: var(--tone); box-shadow: 0 0 12px 2px var(--tone); opacity: 0;
  animation: mg-flow 3.2s var(--v2-ease) infinite; animation-delay: calc(var(--i) * .55s);
}
/* inset-inline-start, so the light runs right→left in Hebrew and left→right in English */
@keyframes mg-flow {
  0% { opacity: 0; inset-inline-start: calc(50% + 24px); }
  10% { opacity: 1; }
  45% { opacity: 1; inset-inline-start: calc(150% - 32px); }
  55%, 100% { opacity: 0; inset-inline-start: calc(150% - 32px); }
}
body.v2-automate-app .mg-dot {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 21px;
  background: color-mix(in srgb, var(--tone) 12%, var(--v2-panel-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 45%, transparent);
  animation: mg-glow 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * .55s);
}
body.v2-automate-app .mg-trigger .mg-dot { border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--tone), 0 0 22px -6px var(--tone); }
@keyframes mg-glow { 0%, 100% { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 45%, transparent); } 12% { box-shadow: inset 0 0 0 1.5px var(--tone), 0 0 22px -4px var(--tone); } }
body.v2-automate-app .mg-lbl { font-size: 13px; line-height: 1.35; color: var(--v2-dim); padding: 0 4px; }
body.v2-automate-app .mg-path-big .mg-lbl { font-size: 14px; color: var(--v2-text); }
/* phones: the path turns vertical, the light runs down */
@media (max-width: 640px) {
  body.v2-automate-app .mg-path { flex-direction: column; gap: 14px; }
  body.v2-automate-app .mg-node { display: flex; gap: 12px; text-align: start; width: 100%; }
  body.v2-automate-app .mg-node:not(:last-child)::before { top: 46px; inset-inline-start: 21px; width: 2px; height: 12px; }
  body.v2-automate-app .mg-node:not(:last-child)::after { top: 44px; inset-inline-start: 18px; animation-name: mg-flow-down; }
  @keyframes mg-flow-down { 0% { opacity: 0; transform: translateY(0); } 10% { opacity: 1; } 45% { opacity: 1; transform: translateY(10px); } 55%, 100% { opacity: 0; transform: translateY(10px); } }
}

/* ============================================================ 4 my magic + live feed */
body.v2-automate-app .mg-mine { margin-top: 8px; }
body.v2-automate-app .mg-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
body.v2-automate-app .mg-count { font-size: 14px; font-weight: 700; color: var(--v2-teal-hi); }
body.v2-automate-app .mg-mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
body.v2-automate-app .mg-mine-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-inline-start: 3px solid var(--tone); }
body.v2-automate-app .mg-mine-open { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border-radius: 10px; }
body.v2-automate-app .mg-mine-open b { display: block; color: var(--v2-hi); font-size: 15px; }
body.v2-automate-app .mg-mine-open:focus-visible { outline: 2px solid var(--v2-teal-hi); outline-offset: 3px; }
body.v2-automate-app .mg-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex: none;
  background: color-mix(in srgb, var(--tone) 13%, var(--v2-panel-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 40%, transparent); }
body.v2-automate-app .mg-icon.sm { width: 38px; height: 38px; font-size: 19px; border-radius: 12px; }
body.v2-automate-app .mg-feed-t { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 15px; color: var(--v2-hi); }
body.v2-automate-app .mg-live { width: 8px; height: 8px; border-radius: 50%; background: var(--v2-ok); box-shadow: 0 0 0 0 var(--v2-ok); animation: mg-pulse 2s infinite; }
@keyframes mg-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--v2-ok) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
body.v2-automate-app .mg-feed { list-style: none; margin: 0; padding: 6px 14px; border-radius: var(--v2-r, 20px); background: var(--v2-panel); box-shadow: inset 0 0 0 1px var(--v2-line); }
body.v2-automate-app .mg-feed > li { padding: 10px 0; }
body.v2-automate-app .mg-feed-item { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--v2-text); animation: mg-in .45s var(--v2-ease) both; }
body.v2-automate-app .mg-feed-item + .mg-feed-item { border-top: 1px solid var(--v2-line); }
body.v2-automate-app .mg-feed-ic { flex: none; width: 26px; text-align: center; }
body.v2-automate-app .mg-feed-txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
body.v2-automate-app .mg-feed-item time { flex: none; font-size: 12.5px; color: var(--v2-muted); }
@keyframes mg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================ 5 gallery */
body.v2-automate-app .mg-gal-sub { margin: -4px 0 6px; }
body.v2-automate-app .mg-cat { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 14px; font-weight: 700; color: var(--v2-dim); }
body.v2-automate-app .mg-cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 10px var(--tone); }
body.v2-automate-app .mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
body.v2-automate-app .mg-card {
  font: inherit; color: inherit; text-align: start; cursor: pointer;
  display: grid; gap: 8px; align-content: start; padding: 16px; border: 0; border-radius: var(--v2-r, 20px);
  background: radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--tone) 9%, transparent), transparent 60%), var(--v2-panel);
  box-shadow: inset 0 0 0 1px var(--v2-line);
  transition: transform .22s var(--v2-ease), box-shadow .22s var(--v2-ease);
}
body.v2-automate-app .mg-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 55%, transparent), 0 16px 40px -22px var(--tone); }
body.v2-automate-app .mg-card:focus-visible { outline: 2px solid var(--v2-teal-hi); outline-offset: 2px; }
body.v2-automate-app .mg-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
body.v2-automate-app .mg-card-title { font-size: 16px; color: var(--v2-hi); line-height: 1.35; }
body.v2-automate-app .mg-card-why { font-size: 14px; color: var(--v2-dim); line-height: 1.55; }
body.v2-automate-app .mg-mini { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 15px; }
body.v2-automate-app .mg-mini i { font-style: normal; }
body.v2-automate-app .mg-mini s { flex: 0 1 14px; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--tone) 45%, transparent); text-decoration: none; }

/* ============================================================ 6 dialog */
body.v2-automate-app .mg-dlg-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
body.v2-automate-app .mg-dlg-head h2 { margin: 0 0 2px; }
body.v2-automate-app .mg-dlg .mg-path { margin: 6px 0 18px; }
body.v2-automate-app .mg-more-how, body.v2-automate-app .mg-more { margin: 12px 0; }
body.v2-automate-app .mg-more-how summary, body.v2-automate-app .mg-more summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--v2-teal-hi); }
body.v2-automate-app .mg-toggles { display: grid; gap: 4px; margin: 14px 0; }
body.v2-automate-app .mg-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--v2-line); cursor: pointer; }
body.v2-automate-app .mg-toggle b { display: block; font-size: 15px; color: var(--v2-hi); font-weight: 600; }
body.v2-automate-app .mg-toggle small { display: block; font-size: 12.5px; color: var(--v2-muted); margin-top: 2px; line-height: 1.5; }
body.v2-automate-app .mg-dlg-actions { margin-top: 18px; }
/* "הפעלה ✨": a short burst of light when the magic turns on */
body.v2-automate-app .mg-go { position: relative; }
body.v2-automate-app .mg-go.mg-burst::after {
  content: ""; position: absolute; inset: -6px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 var(--v2-teal), 0 0 0 0 var(--v2-cv);
  animation: mg-burst .65s var(--v2-ease) forwards;
}
@keyframes mg-burst { to { box-shadow: 0 0 0 18px transparent, 0 0 0 34px transparent; opacity: 0; } }

/* ============================================================ 7 motion + accessibility modes */
@media (prefers-reduced-motion: reduce) {
  body.v2-automate-app :is(.mg-node::after, .mg-dot, .mg-live, .mg-feed-item, .mg-go.mg-burst::after) { animation: none !important; }
  body.v2-automate-app .mg-node:not(:last-child)::after { display: none; }
  body.v2-automate-app .mg-card { transition: none; }
}
html.dka-still body.v2-automate-app :is(.mg-dot, .mg-live, .mg-feed-item) { animation: none !important; }
html.dka-still body.v2-automate-app .mg-node:not(:last-child)::after { display: none; }
html:is(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app :is(.mg-hero, .mg-card) { background: transparent; }
html:is(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app .mg-node:not(:last-child)::after { display: none; }

/* ============================================================ 8 light theme */
html.dk-light:not(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app :is(.mg-hero, .mg-card, .mg-feed) { box-shadow: inset 0 0 0 1px rgba(11, 16, 32, .08), var(--v2-lift-1); }
html.dk-light:not(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app .mg-card:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 50%, transparent), 0 14px 32px -18px color-mix(in srgb, var(--tone) 60%, transparent); }
html.dk-light:not(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app .mg-node:not(:last-child)::after { box-shadow: 0 0 8px 1px color-mix(in srgb, var(--tone) 60%, transparent); }

/* ============================================================ 9 plans ("על מה משלמים") */
body.v2-automate-app .mg-plan-bar { margin-bottom: 16px; border-inline-start: 3px solid var(--v2-teal); }
body.v2-automate-app .mg-plans h2 { margin: 0 0 6px; font-size: clamp(22px, 1.6vw + 14px, 28px); color: var(--v2-hi); }
body.v2-automate-app .mg-plans > p { max-width: 70ch; line-height: 1.65; }
body.v2-automate-app .mg-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 16px 0 10px; }
body.v2-automate-app .mg-plan { display: grid; gap: 10px; align-content: start; padding: 20px; border-radius: var(--v2-r, 20px); background: var(--v2-panel); box-shadow: inset 0 0 0 1px var(--v2-line-2); }
body.v2-automate-app .mg-plan.is-pro { background: radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--v2-cv) 14%, transparent), transparent 70%), var(--v2-panel); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v2-cv) 50%, transparent), 0 20px 50px -30px var(--v2-cv); }
body.v2-automate-app .mg-plan-name { font-size: 17px; color: var(--v2-hi); }
body.v2-automate-app .mg-plan-price { color: var(--v2-dim); font-size: 14px; }
body.v2-automate-app .mg-plan-price span { font-family: "Space Grotesk", Heebo, sans-serif; font-size: 34px; font-weight: 700; color: var(--v2-hi); }
body.v2-automate-app .mg-plan ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; color: var(--v2-text); font-size: 14.5px; line-height: 1.55; }
body.v2-automate-app .mg-plan .au-btn { justify-self: start; }
body.v2-automate-app .mg-plan-note { margin-top: 4px; }
html.dk-light:not(.dka-contrast-dark, .dka-contrast-light) body.v2-automate-app .mg-plan { box-shadow: inset 0 0 0 1px rgba(11, 16, 32, .1), var(--v2-lift-1); }
body.v2-automate-app .mg-plans-lead { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--v2-hi); max-width: 60ch; }
/* the button to press on Gumroad's page, impossible to miss */
body.v2-automate-app .mg-cancel-step { margin-top: 10px; padding: 12px 14px; border-radius: 14px; font-size: 15px; line-height: 1.7; color: var(--v2-text);
  background: color-mix(in srgb, var(--v2-danger) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v2-danger) 40%, transparent); }
body.v2-automate-app .mg-cancel-word { display: inline-block; padding: 1px 10px; border-radius: 8px; font-weight: 800; font-size: 15.5px; letter-spacing: .01em;
  color: #fff; background: #d92d20; box-shadow: 0 0 0 3px color-mix(in srgb, #d92d20 25%, transparent); white-space: nowrap; }

/* Basic plan: automations that are in Pro (js: proLocked) */
body.v2-automate-app .mg-lock { background: rgba(167, 139, 250, .14); color: var(--v2-hi, inherit); border-color: rgba(167, 139, 250, .45); }
body.v2-automate-app .mg-lock-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  background: rgba(167, 139, 250, .1); border: 1px solid rgba(167, 139, 250, .35); }
