/* Barrier (templates/barrier.html, static/motion/barrier.js). Every rule is scoped to the
   page: .mx-app--barrier, or an mx-barrier- class. */

/* the word: seven letters, so a little smaller than the default to stay on screen */
.mx-app--barrier .mx-story__word { --word: 15.4vw; --word-phone: 16.2vw; }

/* ---------- hero: the live rating and the Product Hunt badge on one row ---------- */
.mx-barrier-proof { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 22px; }
.mx-app--barrier .mx-story__hero .mx-barrier-proof .mx-rating { margin: 0; }
.mx-barrier-ph { display: inline-flex; line-height: 0; border-radius: 10px; opacity: .88; transition: opacity .2s var(--ease); }
.mx-barrier-ph:hover, .mx-barrier-ph:focus-visible { opacity: 1; }
.mx-barrier-ph img { width: auto; height: 38px; }

/* ---------- the steps: longer headlines than Cinder's, so a size down ---------- */
.mx-app--barrier .mx-story__step-in { max-width: 500px; }
.mx-app--barrier .mx-story__step h2 { font-size: clamp(40px, 4.2vw, 66px); line-height: .92; }
.mx-app--barrier .mx-story__fig { margin: 24px 0 0; gap: 18px; }
.mx-app--barrier .mx-story__fig .mx-num { font-size: clamp(56px, 5.8vw, 92px); white-space: nowrap; }
.mx-app--barrier .mx-story__fig .mx-read { max-width: 21ch; }
.mx-app--barrier .mx-story__fig .mx-read > span { display: block; margin-top: 2px; color: var(--ash-2); }
.mx-app--barrier .mx-story__sub { margin-top: 22px; }
.mx-app--barrier .mx-story__src strong { font-weight: 600; color: var(--bone-2); }
.mx-app--barrier .mx-story__step .mx-actions { margin-top: 26px; }

/* step 1: the apps behind the barrier, locking as the glass passes them */
.mx-barrier-apps { display: flex; flex-wrap: wrap; gap: 8px; max-width: 470px; margin: 26px 0 0; padding: 0; list-style: none; }
.mx-barrier-apps li {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(14, 14, 17, .6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 14px; font-weight: 550; color: var(--bone-2);
  transition: color .35s var(--ease), border-color .35s var(--ease);
}
.mx-barrier-apps img { width: 24px; height: 24px; border-radius: 7px; transition: filter .35s var(--ease); }
.mx-barrier-lock {
  width: 11px; height: 13px; margin-left: -2px; fill: none; stroke: currentColor; stroke-width: 1.7;
  opacity: 0; transform: scale(.5); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.mx-barrier-lock rect { fill: currentColor; stroke: none; }
.mx-barrier-apps li.is-locked { color: var(--ash); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.mx-barrier-apps li.is-locked img { filter: grayscale(1) brightness(.55); }
.mx-barrier-apps li.is-locked .mx-barrier-lock { opacity: 1; transform: none; color: var(--accent-ink); }
.mx-barrier-count { margin-top: 14px; }
.mx-barrier-count b { font-weight: 650; color: var(--bone); }

/* step 2 holds its copy still while four weeks go by behind it */
.mx-app--barrier .mx-barrier-hold { display: block; min-height: 0; height: 290vh; height: 290svh; padding: 0; }
.mx-barrier-pin { position: sticky; top: 0; display: flex; align-items: center; min-height: 100vh; min-height: 100svh; }
.mx-barrier-weeks { max-width: 460px; margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.mx-barrier-weeks li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 9ch; align-items: baseline; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ash-2); transition: color .3s var(--ease);
}
.mx-barrier-weeks span { font-size: 15px; }
.mx-barrier-weeks b { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.mx-barrier-weeks i { font-style: normal; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.mx-barrier-weeks li.is-done { color: var(--ash); }
.mx-barrier-weeks li.is-now { color: var(--bone); }
.mx-barrier-weeks li.is-now i { color: #30D158; }
.mx-barrier-weeks li:first-child.is-now i { color: var(--ash); }

@media (max-width: 860px) {
  .mx-app--barrier .mx-story__step h2 { max-width: none; font-size: 34px; }
  .mx-app--barrier .mx-story__fig { margin-top: 12px; gap: 12px; }
  .mx-app--barrier .mx-story__fig .mx-num { font-size: 50px; }
  .mx-app--barrier .mx-story__sub { margin-top: 10px; font-size: 14.5px; }
  .mx-app--barrier .mx-story__src { margin-top: 12px; font-size: 12.5px; }
  .mx-app--barrier #lock .mx-story__src, .mx-app--barrier #unlock .mx-story__src { display: none; }
  .mx-app--barrier .mx-story__step .mx-actions { margin-top: 14px; }
  .mx-barrier-apps { flex-wrap: nowrap; gap: 4px; margin-top: 14px; }
  .mx-barrier-apps li { gap: 3px; padding: 3px 6px 3px 3px; }
  .mx-barrier-apps img { width: 20px; height: 20px; border-radius: 6px; }
  .mx-barrier-apps li span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mx-barrier-count { display: none; }
  .mx-barrier-weeks { display: none; }
  .mx-app--barrier .mx-barrier-hold { height: 250vh; height: 250svh; padding: 0; }
  .mx-barrier-pin { align-items: flex-end; padding-bottom: 6vh; }
  .mx-barrier-proof { margin-top: 18px; }
  .mx-barrier-ph img { height: 34px; }
}

/* ---------- what it does: the panels are the app's own UI, drawn in dark ---------- */
.mx-barrier-viz { position: relative; }
.mx-barrier-viz__note { position: absolute; top: 14px; right: 18px; color: var(--ash-2); }

/* the locked apps, as on a Home Screen */
.mx-barrier-home { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 8px; justify-items: center; }
.mx-barrier-home__app { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.mx-barrier-home__icon { position: relative; display: block; width: 58px; height: 58px; overflow: hidden; border-radius: 14px; }
.mx-barrier-home__icon img { display: block; width: 100%; height: 100%; transform: scale(1.1); filter: grayscale(1) brightness(.42); }
.mx-barrier-home__icon svg {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 22px;
  fill: none; stroke: var(--bone); stroke-width: 1.6;
}
.mx-barrier-home__icon svg rect { fill: var(--bone); stroke: none; }
.mx-barrier-home__app i { font-style: normal; font-size: 12px; color: var(--ash); }
.mx-barrier-home__foot { margin-top: 20px; }

/* a Screen Time style comparison: the colours and type of the Screen Time report */
.mx-barrier-st { display: flex; flex-direction: column; gap: 16px; font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; }
.mx-barrier-st__label { font-size: 15px; color: #98989F; }
.mx-barrier-st__rows { display: flex; flex-direction: column; gap: 14px; }
.mx-barrier-st__row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 64px; align-items: center; gap: 12px; }
.mx-barrier-st__wk { font-size: 13px; color: #98989F; }
.mx-barrier-st__bar { display: flex; width: var(--w); height: 26px; overflow: hidden; border-radius: 4px; }
.mx-barrier-st__bar i { display: block; width: var(--v); background: var(--c); }
.mx-barrier-st__row b { font-size: 17px; font-weight: 500; text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.mx-barrier-st__legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; }
.mx-barrier-st__legend span { color: var(--c); }

/* Barrier's own cards: an outline and a hard offset shadow, here in bone on night */
.mx-barrier-card {
  padding: 18px 20px 20px; border: 1.5px solid var(--bone); border-radius: 18px;
  background: var(--night); box-shadow: 4px 5px 0 var(--bone);
}
.mx-barrier-card__t { font-weight: 700; font-size: 20px; }
.mx-barrier-card__time { margin: 4px 0 16px; font-size: 17px; color: var(--bone-2); font-variant-numeric: tabular-nums; }
.mx-barrier-days { display: flex; gap: 5px; }
.mx-barrier-days i {
  display: grid; place-items: center; width: 28px; height: 28px; border: 1.5px solid var(--ash-2); border-radius: 50%;
  font-style: normal; font-weight: 700; font-size: 11.5px; color: var(--ash);
}
.mx-barrier-days i.on { border-color: var(--bone); background: var(--bone); color: var(--night); }
.mx-barrier-tick { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bone); }
.mx-barrier-tick svg { width: 16px; height: 16px; fill: none; stroke: var(--night); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mx-barrier-streakcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.mx-barrier-card__k { margin: 0 0 4px; font-size: 13px; color: var(--ash); }
.mx-barrier-card__big { font-stretch: 112%; font-weight: 800; font-size: 25px; line-height: 1.05; letter-spacing: -.01em; }
.mx-barrier-flame { flex: none; width: 32px; height: 40px; }
.mx-barrier-flame path { fill: var(--bone); }
.mx-barrier-flame path.in { fill: var(--night); }

/* the Live Activity on the Lock Screen */
.mx-barrier-live {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  margin-top: 12px; padding: 14px 16px 16px; border-radius: 24px; background: #050506; box-shadow: 0 0 0 1px var(--line);
}
.mx-barrier-live img { width: 40px; height: 40px; border-radius: 10px; }
.mx-barrier-live__t { display: flex; flex-direction: column; min-width: 0; }
.mx-barrier-live__t b { font-weight: 650; font-size: 15px; }
.mx-barrier-live__t span { font-size: 12.5px; color: var(--ash); }
.mx-barrier-live__n { font-weight: 300; font-size: 34px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mx-barrier-live__bar { grid-column: 1 / -1; height: 5px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: #2C2C31; }
.mx-barrier-live__bar i { display: block; width: 45%; height: 100%; border-radius: 3px; background: var(--accent); }

/* the picker */
.mx-barrier-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin: 0; padding: 0; list-style: none; }
.mx-barrier-pick li {
  display: flex; align-items: center; gap: 11px; min-width: 0; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 15px; color: var(--bone-2);
}
.mx-barrier-pick img { flex: none; width: 28px; height: 28px; border-radius: 7px; }
.mx-barrier-pick__c { flex: none; position: relative; width: 20px; height: 20px; border: 1.5px solid #48484A; border-radius: 50%; }
.mx-barrier-pick li.on .mx-barrier-pick__c { border-color: #0A84FF; background: #0A84FF; }
.mx-barrier-pick li.on .mx-barrier-pick__c::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.mx-barrier-pick__cat { grid-column: 1 / -1; }
.mx-barrier-pick__g { flex: none; width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(135deg, #5E5CE6, #0A84FF); }
.mx-barrier-pick__g--web { background: linear-gradient(135deg, #64D2FF, #0A84FF); }

/* how it is paid for */
.mx-barrier-free { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.mx-barrier-free li { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; color: var(--bone-2); }
.mx-barrier-free li::before {
  content: ""; flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%;
  background: var(--bone) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.6' fill='none' stroke='%230E0E11' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.mx-barrier-free li.ad { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ash); }
.mx-barrier-free li.ad::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4.5v7l5.5-3.5z' fill='%230E0E11'/%3E%3C/svg%3E") center / 14px no-repeat;
}

@media (max-width: 480px) {
  .mx-barrier-home__icon { width: 52px; height: 52px; border-radius: 12px; }
  .mx-barrier-days i { width: 25px; height: 25px; font-size: 10.5px; }
  .mx-barrier-pick { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .mx-barrier-apps li, .mx-barrier-apps img, .mx-barrier-lock, .mx-barrier-weeks li { transition: none; }
  /* motion.css drops the word's transform here, and with it the -50% that centres it */
  .mx-app--barrier .mx-story__word { transform: translateY(-50%) !important; }
}
